astro-best-practices — Claude Code skill: what it does, how to install
Architectural rules and review checklists for building performant, accessible Astro projects across AI coding assistants.
npx skills add incluud/astro-agent-skills --skill astro-best-practices -a claude-codeWhat astro-best-practices does
This skill injects Astro development standards into coding agents. It enforces .astro components as the baseline choice and restricts UI frameworks like React or Vue to compact interactive islands. Static generation is prioritized whenever request-time rendering is unnecessary.
The instructions mandate deliberate hydration directives: client:visible for deferred components, client:idle for background tasks, and client:load strictly for immediate UI needs. It also demands schema validation for content collections, semantic landmarks, and image sizing via astro:assets to prevent layout shifts.
If your setup relies on heavy client-side hydration across entire page layouts, this skill will actively push back during code reviews.
What it helps with
- eliminate unnecessary client hydration in Astro components
- enforce schemas for structured content collections
- audit templates for keyboard accessibility and heading structure
- configure image assets with
astro:assetsto prevent layout shifts
Example prompts for the agent
- Review
src/pages/index.astroagainst the astro-best-practices checklist - Build a newsletter signup island using
client:visibleinside an.astrolayout - Define a typed content collection schema for author profiles
How to install astro-best-practices
1Skills CLI (Vercel)
npx skills add incluud/astro-agent-skills --skill astro-best-practices -a claude-code2Manually: put the files in place
~/.claude/skills/astro-best-practices/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/astro-best-practices/
1Skills CLI (Vercel)
npx skills add incluud/astro-agent-skills --skill astro-best-practices -a codex2Manually: put the files in place
.agents/skills/astro-best-practices/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add incluud/astro-agent-skills --skill astro-best-practices -a cursor2Manually: put the files in place
.cursor/skills/astro-best-practices/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install incluud/astro-agent-skills astro-best-practices2Manually: put the files in place
.github/skills/astro-best-practices/SKILL.md1Skills CLI (Vercel)
npx skills add incluud/astro-agent-skills --skill astro-best-practices -a gemini-cli2Platform CLI
gemini skills install https://github.com/incluud/astro-agent-skills --path skills/astro-best-practicesManually: put the files in place
.devin/skills/astro-best-practices/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add incluud/astro-agent-skills --skill astro-best-practices -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about astro-best-practices
How do I install astro-best-practices in Claude Code?
Run npx skills add incluud/astro-agent-skills --skill astro-best-practices -a claude-code in your terminal. Alternatively, place the file directly at ~/.claude/skills/astro-best-practices/SKILL.md.
What does the astro-best-practices skill do?
It guides AI agents through Astro architectural patterns. The assistant prioritizes .astro files, selective hydration directives, semantic markup, and schema-backed content collections.
When does this skill allow React or Vue components?
Only when an element requires genuine browser-side interactivity or local component state. For static presentation, it requires .astro components.
Source text
SKILL.md · MIT
--- name: astro-best-practices description: Apply performant, accessible, and maintainable defaults when building or reviewing Astro projects. --- # Astro Best Practices Use this skill as the baseline when designing, implementing, or reviewing Astro work. It translates Astro-specific architectural guidance into portable instructions that can be applied across agents. ## Core Principles - prefer static generation when request-time rendering is not necessary - keep client-side JavaScript minimal - use framework islands only for real interactivity - preserve clear project structure and predictable routing - optimize for accessibility and maintainability, not just output parity ## Architecture Defaults ### Prefer `.astro` first - use `.astro` components for static and mostly static UI - reach for React, Vue, or another framework only when local state or client-side behavior is genuinely needed - keep interactive islands small and leaf-like ### Use hydration deliberately - `client:visible` for deferred UI - `client:idle` for lower-priority enhancement - `client:load` for critical immediate interactivity only - `client:only` only when skipping server rendering is intentional Default away from hydrating broad layout regions. ### Keep the project shape predictable Typical structure: ```text src/ components/ layouts/ pages/ content/ styles/ assets/ public/ ``` Do not invent novel folder structure without a clear project-specific reason. ## Content and Data - use content collections for structured content - define schemas instead of accepting loose frontmatter - fetch server-side data in Astro frontmatter unless there is a clear reason not to - keep data flow obvious and close to the component or page that owns it ## Accessibility - use semantic landmarks such as `header`, `nav`, `main`, `article`, and `footer` - ensure keyboard access for all interactive controls - provide meaningful labels and accessible names - maintain correct heading hierarchy - use appropriate image alt text - preserve visible focus states - treat color contrast as a non-negotiable baseline ## Performance - use `astro:assets` or the project’s chosen image pipeline intentionally - prevent layout shift by providing image dimensions or stable containers - avoid unnecessary client hydration - keep CSS and JavaScript scoped to the features that need them - prefer simple server-rendered markup over client complexity ## Styling - default to scoped component styles unless the project has a defined styling system - use CSS custom properties for reusable tokens - favor maintainable layout patterns over one-off utility sprawl when the project is not already utility-first - keep responsive behavior intentional and testable ## Review Checklist Before finalizing Astro work, check: - is any hydrated code unnecessary - does the HTML stay semantic - is the route/layout structure still clear - are content schemas strong enough - is the result accessible by keyboard and assistive tech - does the implementation match the existing project conventions
© incluud · MIT · incluud/astro-agent-skills