astro-patterns
Skill4 starsChanged 3 months agoMITView on GitHub
Astro project conventions: components, content collections, islands, and styling. Apply when writing or reviewing Astro code.
In this repository53 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- actionableSkill
- astro-bootstrapSkill
- autopilotSkill
- axon-code-intelSkill
- brainstormingSkill
- commit-conventionsSkill
- cross-repo-contextSkill
- django-bootstrapSkill
- django-patternsSkill
- executeSkill
- find-sessionSkill
- flutter-bootstrapSkill
- flutter-patternsSkill
- full-featureSkill
- intelSkill
- nextjs-bootstrapSkill
- nextjs-fullstack-bootstrapSkill
- nextjs-fullstack-patternsSkill
- nextjs-mui-bootstrapSkill
- nextjs-patternsSkill
- nextjs-shadcn-bootstrapSkill
- orchestratorSkill
- phase-breakdownSkill
- plan-and-scopeSkill
- prdSkill
- reactSkill
- recallSkill
- reflectSkill
- relaySkill
- rememberSkill
- scaffoldSkill
- scratchSkill
- tailwindSkill
- ux-specSkill
- ux-to-promptsSkill
- verify-astroSkill
- verify-djangoSkill
- verify-flutterSkill
- verify-nextjs-fullstackSkill
- verify-nextjs-muiSkill
- verify-nextjs-shadcnSkill
- verify-nextjsSkill
- verifySkill
- visual-feedbackSkill
- work-disciplineSkill
- worktreesSkill
- wrapSkill
- write-as-friendSkill
- write-as-humanSkill
- writing-clearlySkill
- writing-skillsSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 1 is distinctive, and 9 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
Prefer .astro components over framework components unless interactivity is needed
- Very specific: line 27
Use <slot /> for child content.
- Very specific: line 30
Only add client:* directives when JavaScript interactivity is truly required
- Distinctive: line 37
No framework integration is installed by default — add only when you need an island
- Very specific: line 44
Always create src/pages/404.astro for custom 404
- Very specific: line 67
All commands run via make (Docker Compose under the hood) — never run npm directly on host
- Very specific: line 68
Use /astro-bootstrap when setting up a new project from scratch
- Very specific: line 75
Use <ViewTransitions /> from astro:transitions for smooth page navigation
- Very specific: line 79
Add @astrojs/sitemap integration for automatic sitemap generation
- Very specific: line 80
Place robots.txt and favicons in public/
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Skill: Astro Patterns
Purpose
Guide Claude Code when building Astro sites (landing pages, marketing, docs). Targets Astro 5.x. Follow these conventions unless the project's CLAUDE.md overrides them.
Project Structure
- File-based routing from
src/pages/ - Components in
src/components/organized by section (layout/,landing/,ui/) - Layout templates in
src/layouts/ - Content collections in
src/content/with schema insrc/content.config.ts - Global styles in
src/styles/ - Static assets in
public/ @/*path alias via tsconfig
Components (.astro files)
- Code fence (
---) for server-only TypeScript — never sent to browser - Define
Propsinterface above usage, destructure fromAstro.props - PascalCase filenames matching component name (
Hero.astro,FeatureGrid.astro) - Scoped
<style>by default — useis:globalonly when intentional - Prefer
.astrocomponents over framework components unless interactivity is needed - Use
<slot />for child content; named slots with<slot name="footer" />
Islands (Interactive Components)
- Only add
client:*directives when JavaScript interactivity is truly required client:load— immediately interactive (nav menus, forms with validation)client:idle— hydrate when browser idle (carousels, counters)client:visible— hydrate when scrolled into view (comment sections, chat)server:defer— defer server rendering for personalized content- Each island hydrates independently — keep them small and self-contained
- To add a framework:
npx astro add react(or vue, svelte, solid) inside the container - No framework integration is installed by default — add only when you need an island
Pages & Routing
- Each
.astrofile insrc/pages/= one route (index.astro→/,about.astro→/about) - Wrap page content in a layout component:
<BaseLayout title="About">...</BaseLayout> - Dynamic routes use
[param].astroor[...slug].astrowithgetStaticPaths() - Set page metadata via layout props (
title,description) - Always create
src/pages/404.astrofor custom 404
Content Collections
- Define schemas in
src/content.config.tsusingdefineCollectionwith Zod - Query with
getCollection('blog')/getEntry('blog', 'my-post') - Render markdown content with the
<Content />component - Frontmatter is type-safe and validated at build time
Styling
- Tailwind v4 via
@tailwindcss/viteplugin (Astro uses Vite natively) - DaisyUI as
@plugin "daisyui"in global CSS - DaisyUI semantic colors:
base-100,base-content,primary— never hardcoded hex - Scoped
<style>in.astrofiles for component-specific overrides - Responsive-first: mobile breakpoints before desktop
Naming
- Components: PascalCase (
Hero.astro,FeatureCard.astro) - Pages: kebab-case matching URL slugs (
about-us.astro,contact.astro) - Layouts: PascalCase with Layout suffix (
BaseLayout.astro,BlogLayout.astro) - Content collections: kebab-case directories and files
- CSS custom properties:
--color-*,--font-*,--spacing-*
Development Environment
- All commands run via
make(Docker Compose under the hood) — never runnpmdirectly on host - Use
/astro-bootstrapwhen setting up a new project from scratch make devstarts the dev server (default port 4321)make astro-checkfor TypeScript and template validationmake buildfor production static build,make previewto test it locally
SEO & Performance
- Set
<title>and<meta name="description">on every page via layout props - Use
<ViewTransitions />fromastro:transitionsfor smooth page navigation - Images: use
<Image>fromastro:assetsfor automatic optimization - Fonts: self-host via
@fontsourcepackages — no external CDN requests - Include OG tags (
og:title,og:description,og:image) on all pages - Add
@astrojs/sitemapintegration for automatic sitemap generation - Place
robots.txtand favicons inpublic/
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.

