astro
Skill4 starsChanged 6 months agoMITView on GitHub
Skill for building static sites with the Astro web framework. Helps create Astro components and pages, set up content collections, optimize images, configure SEO, and deploy static builds. Use when the user needs to work with Astro, mentions .astro files, asks about static site generation (SSG), islands architecture, content collections, or deploying an Astro project.
- Installs packages
9 other projects use a version of this.
Adopted by
Most recently taken up by
- devantler-tech/ksailtheir own version, first seen Oct 3, 2026
- lgzarturo/codeconductortheir own version, first seen Sep 30, 2026
- one-ie/onetheir own version, first seen Jul 2, 2026
- joabgonzalez/ai-agents-skillstheir own version, first seen Jun 8, 2026
- miketromba/skillstheir own version, first seen Apr 8, 2026
- astrolicious/agent-skillstheir own version, first seen Mar 20, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- Mindrally/skills★ 266same name
- devantler-tech/ksail★ 166same name
- one-ie/one★ 131same name
- astrolicious/agent-skills★ 14same name
- joabgonzalez/ai-agents-skills★ 9same name
- wrsmith108/astro-claude-skill★ 4same name
- miketromba/skills★ 2same name
- tygwan/skills★ 1same name
- lgzarturo/codeconductor★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
16 rules. 0 are common, 2 are distinctive, and 14 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
14
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Read these files for detailed patterns and templates:
- Very specific: line 41
Use the lightest client:* directive that works:
- Distinctive: line 58
Always install fonts locally via Fontsource npm packages — never Google Fonts CDN links.
- Very specific: line 71
Use src/layouts/Layout.astro as the base layout.
- Very specific: line 73
Use src/components/Head.astro for SEO meta tags, Open Graph, Twitter Cards, canonical URLs, and JSON-LD structured data.
- Very specific: line 77
Always include @astrojs/sitemap — it auto-generates sitemap-index.xml at build time.
- Very specific: line 87
Create src/pages/robots.txt.ts — Astro will build it into a static robots.txt file at the site root.
- Very specific: line 109
Always use <Image /> from astro:assets — not <img> tags.
- Very specific: line 114
Every collection needs a loader (use glob from astro/loaders)
- Very specific: line 115
Use z.image() for validated, optimized image fields
- Very specific: line 116
Use z.enum() for constrained values instead of booleans
- Very specific: line 117
Use reference() for relations between collections
- Very specific: line 121
Always use output: 'static' (the default) — all pages are pre-rendered to HTML at build time.
- Very specific: line 122
Do NOT use output: 'hybrid' — removed in Astro v5.
- Very specific: line 123
Do NOT use output: 'server' or SSR adapters.
- Very specific: line 128
Always use trailing slashes in internal links (/about/ not /about) to avoid duplicate content issues.
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Astro Skill
Reference for building static Astro sites (output: 'static'). Covers architecture decisions, content collections, SEO, image optimization, pagination, and deployment patterns.
Consult docs.astro.build and llms.txt for latest APIs when needed.
References
Read these files for detailed patterns and templates:
| Reference | What it covers |
content-collections.md | Schemas (z.image, z.enum, reference()), querying, dynamic routes, entry.body |
image-optimizations.md | <Image /> component, downscaling tip, SVG components, aspect ratios |
seo-checklist.md | Head component, per-page checklist, structured data (JSON-LD), hreflang, content rules |
pagination.md | paginate(), nested pagination, page prop |
Architecture Rules
1. Astro-first
.astrofiles for everything presentational — zero JS shipped to client.- Framework components (
.tsx,.svelte,.vue, etc.) only when interactivity is needed.
2. Minimal hydration
Use the lightest client:* directive that works:
| Directive | Use case |
client:load | Critical above-the-fold interactivity |
client:idle | Non-critical (modals, popovers) |
client:visible | Below-the-fold widgets |
client:media | Screen-size-specific UI (e.g. mobile sidebar toggle) |
client:only="<framework>" | Browser-only APIs (e.g. localStorage, WebGL) |
3. Keep islands small
- Wrap only the interactive subtree in a framework component. Surrounding static markup stays in
.astro. - Pass data via props from the
.astroparent — never refetch inside islands.
4. Fonts via Fontsource
Always install fonts locally via Fontsource npm packages — never Google Fonts CDN links.
Example if using Inter
npm install @fontsource-variable/interKey Patterns
Layout & Head
Use src/layouts/Layout.astro as the base layout. Import with @/layouts/Layout.astro.
Use src/components/Head.astro for SEO meta tags, Open Graph, Twitter Cards, canonical URLs, and JSON-LD structured data. Import it inside your layout — see seo-checklist.md for the full component and per-page checklist.
Sitemap
Always include @astrojs/sitemap — it auto-generates sitemap-index.xml at build time. Install and add it to integrations in astro.config.mjs:
npx astro add sitemapExclude admin pages, API routes, and utility pages from the sitemap.
robots.txt
Create src/pages/robots.txt.ts — Astro will build it into a static robots.txt file at the site root. It dynamically references the sitemap URL using Astro.site:
import type { APIRoute } from 'astro';
const getRobotsTxt = (sitemapURL: URL) => `\
User-agent: *
Allow: /
Sitemap: ${sitemapURL.href}
`;
export const GET: APIRoute = ({ site }) => {
const sitemapURL = new URL('sitemap-index.xml', site);
return new Response(getRobotsTxt(sitemapURL));
};This requires site to be set in astro.config.mjs so the sitemap URL resolves correctly.
Image optimization
Always use <Image /> from astro:assets — not <img> tags. Set explicit width/height to downscale large source images (e.g., 10000×10000 → 1024×1024 = smaller WebP output).
Content collections (v5+)
- Config at
src/content.config.ts(NOTsrc/content/config.ts) - Every collection needs a
loader(useglobfromastro/loaders) - Use
z.image()for validated, optimized image fields - Use
z.enum()for constrained values instead of booleans - Use
reference()for relations between collections
Static output
- Always use
output: 'static'(the default) — all pages are pre-rendered to HTML at build time. - Do NOT use
output: 'hybrid'— removed in Astro v5. - Do NOT use
output: 'server'or SSR adapters.
Trailing slashes
- Set
trailingSlash: 'always'inastro.config.mjsto enforce trailing slashes on all generated URLs. - Always use trailing slashes in internal links (
/about/not/about) to avoid duplicate content issues.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

