Use when building or editing an Astro site. Triggers on `.astro` files, `astro:content` imports, `Astro.props`, `client:` hydration directives, and prompts about pages, layouts, MDX, content collections, image optimization, or view transitions, even when the user doesn't say 'Astro'.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Using Astro?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/xonovex-using-astro)
---
name: using-astro
description: "Use when building or editing an Astro site. Triggers on `.astro` files, `astro:content` imports, `Astro.props`, `client:` hydration directives, and prompts about pages, layouts, MDX, content collections, image optimization, or view transitions, even when the user doesn't say 'Astro'."
---
# Astro Coding Guidelines
Build Astro pages as static HTML and hydrate only the components that need client interaction.
## Essentials
- **Islands architecture** - Default to static HTML, hydrate only where needed, see [references/islands-architecture.md](references/islands-architecture.md)
- **Project structure** - Use `src/pages`, `src/components`, `src/layouts`, `src/content`, see [references/project-structure.md](references/project-structure.md)
- **Content collections** - Use `astro:content` with schema-validated frontmatter; schema design in **using-zod**, see [references/content-collections.md](references/content-collections.md)
- **Framework components** - Integrate React, Vue, or other frameworks, see [references/components.md](references/components.md)
- **Accessibility** - Use semantic HTML, alt text, ARIA as needed, see [references/accessibility.md](references/accessibility.md)
## Gotchas
- Default rendering is server-side / static: components don't ship JavaScript unless explicitly hydrated with `client:*` directives
- Content Collections enforce a Zod schema at build time; an invalid frontmatter field fails the build, not the page
- `Astro.glob()` is build-time and scans at compile; runtime data needs `getStaticPaths` or endpoints
- Framework components (React/Vue/Svelte) only hydrate on the directive you pick: `client:load`, `client:idle`, `client:visible`, `client:media`, `client:only`
## Progressive disclosure
- Read [references/islands-architecture.md](references/islands-architecture.md) - Load when deciding which components need client-side JavaScript
- Read [references/project-structure.md](references/project-structure.md) - Load when organizing files and directories
- Read [references/content-collections.md](references/content-collections.md) - Load when managing blog posts, docs, or structured content
- Read [references/components.md](references/components.md) - Load when integrating React, Vue, or other framework components
- Read [references/accessibility.md](references/accessibility.md) - Load when adding keyboard navigation or screen reader support