← All extensions

Astro Snippets

v1.0.0 · by kagulion · added 3 November 2026

Comprehensive, modern Astro snippets for Zed IDE with Astro 7+ support

Snippets

How to install

With Forge Super installed, the button above opens the app on this extension, where you press Install. Nothing is installed until you do.

You can also open the Extensions panel in the app and search for Astro Snippets. The extension's id is astro-snippets.

Don't have Forge Super yet? Download it here.

README

From the extension's repository, written by its authors and not by Mentenaz. See the source.

Astro Snippets for Zed

Modern, clean, and comprehensive snippets for Astro development in Zed IDE. All snippets use the uniform a-* prefix.

Astro Snippets

Installation

User Snippets

Copy the files from snippets/ to your Zed snippets directory:

  • Windows: %APPDATA%\Zed\snippets\
  • macOS / Linux: ~/.config/zed/snippets/

Dev Extension

  1. Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).
  2. Run zed: install dev extension.
  3. Select this folder.

Snippets Reference

Components, Pages & Layouts (.astro)

PrefixDescriptionOutput
a-compBasic ComponentComponent with Props interface and container
a-comp-slotComponent with SlotComponent with props and default <slot />
a-pageHTML5 PageComplete HTML5 page template
a-page-layoutPage with LayoutPage wrapped in <Layout>
a-layoutBase LayoutLayout with SEO metadata and <slot />
a-layout-themeLayout with ThemeLayout with dark/light mode detection script
a-prerenderPrerender Toggleexport const prerender = true;
a-gspStatic Paths Functionexport async function getStaticPaths() { ... }
a-page-gspDynamic SSG PagePage with getStaticPaths and typed props
a-page-collectionContent Collection PageDynamic collection route with render

Directives & Server Islands (.astro)

PrefixDescriptionOutput
a-client-loadHydrate on Loadclient:load
a-client-idleHydrate when Idleclient:idle
a-client-visibleHydrate when Visibleclient:visible
a-client-mediaHydrate on Media Queryclient:media="(max-width: 768px)"
a-client-onlyClient-only Componentclient:only="react"
a-server-deferServer Island Directiveserver:defer
a-server-islandServer Island with SlotComponent with <div slot="fallback">

Slots & Fragments (.astro)

PrefixDescriptionOutput
a-slotDefault Slot<slot />
a-slot-fallbackSlot with Fallback<slot>Fallback content</slot>
a-slot-namedNamed Slot<slot name="header" />
a-frag-slotFragment with Slot<Fragment slot="header">...</Fragment>
a-frag-htmlFragment with HTML<Fragment set:html={rawHtml} />
a-set-htmlSet HTML Attributeset:html={rawHtml}
a-set-textSet Text Attributeset:text={text}
a-is-rawRaw Text Directiveis:raw

Actions, Sessions & Env (.astro, .ts, .js)

PrefixScopeDescription
a-action-form.astro<form method="POST" action={actions.myAction}>
a-action-call.astro, .tsawait Astro.callAction(actions.myAction, { ... })
a-action-define.ts, .jsDefine action in src/actions/index.ts with Zod
a-session-get.astro, .tsawait Astro.session.get('user')
a-session-set.astro, .tsawait Astro.session.set('user', data)
a-env-server.astro, .tsimport { SECRET } from 'astro:env/server'
a-env-client.astro, .tsimport { PUBLIC_URL } from 'astro:env/client'
a-env-configastro.configDefine envField schema in config

Template Expressions (.astro)

PrefixDescriptionOutput
a-mapArray Map{items.map((item) => (<div key={item.id}>...</div>))}
a-ternaryTernary Operator{condition ? trueValue : falseValue}
a-ifLogical AND{condition && (...)}
a-classlistClass List Directiveclass:list={['base', { active: isActive }]}
a-iifeIIFE in Template{(() => { ... })()}

Assets, Fonts & Navigation (.astro)

PrefixDescriptionOutput
a-img-importImport Image Componentimport { Image } from 'astro:assets';
a-imageImage Component<Image src={...} alt="..." width={800} height={600} />
a-picturePicture Component<Picture src={...} formats={['avif', 'webp']} alt="..." />
a-routerClientRouter Component<ClientRouter />
a-router-importImport ClientRouterimport { ClientRouter } from 'astro:transitions';
a-fontFont Component<Font src="/fonts/font.woff2" />

Styles & Scripts (.astro)

PrefixDescriptionOutput
a-styleScoped Style Block<style>...</style>
a-style-globalGlobal Style Block<style is:global>...</style>
a-scriptClient Script Block<script>...</script>
a-script-inlineInline Script Block<script is:inline>...</script>
a-style-scriptStyle and Script PairCombined <style> and <script> blocks

Content Collections (.ts, .js, .astro)

PrefixScopeDescription
a-content-configsrc/content.config.tsContent Layer config with glob loader and Zod
a-collection-definecontent.config.tsCollection definition with glob loader
a-collection-datacontent.config.tsData collection with file loader
a-collection.astro, .tsawait getCollection('blog')
a-entry.astro, .tsawait getEntry('blog', slug)

API Endpoints & Middleware (.ts, .js)

PrefixDescriptionOutput
a-api-getGET Route Handlerexport const GET: APIRoute = async (...) => Response
a-api-postPOST Route Handlerexport const POST: APIRoute = async (...) => Response
a-api-allUniversal Route Handlerexport const ALL: APIRoute = async (...) => Response
a-api-honoHono Router Endpointconst app = new Hono(); export const ALL = app.fetch;
a-middlewareAstro Middlewareexport const onRequest = defineMiddleware(...)
a-redirectServer-side Redirectreturn Astro.redirect('/url', 302);

Credits

Inspired by and based on:


License

MIT