astro-best-practices
Skill10 starsChanged 7 months agoMITView on GitHub
Apply performant, accessible, and maintainable defaults when building or reviewing Astro projects.
In this repository5 other files it gives its agents.
- add-integrationSkill
- content-collectionSkill
- create-componentSkill
- docs-lookupSkill
- migrateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. About 0 are common, 19 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈19
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 8
Use this skill as the baseline when designing, implementing, or reviewing Astro work.
- Distinctive: line 12
prefer static generation when request-time rendering is not necessary
- Distinctive: line 13
keep client-side JavaScript minimal
- Distinctive: line 14
use framework islands only for real interactivity
- Very specific: line 22
use .astro components for static and mostly static UI
- Distinctive: line 24
keep interactive islands small and leaf-like
- Distinctive: line 33
Default away from hydrating broad layout regions.
- Distinctive: line 50
Do not invent novel folder structure without a clear project-specific reason.
- Distinctive: line 54
use content collections for structured content
- Distinctive: line 57
keep data flow obvious and close to the component or page that owns it
- Very specific: line 61
use semantic landmarks such as header, nav, main, article, and footer
- Distinctive: line 62
ensure keyboard access for all interactive controls
- Distinctive: line 65
use appropriate image alt text
- Distinctive: line 67
treat color contrast as a non-negotiable baseline
- Very specific: line 71
use astro:assets or the project’s chosen image pipeline intentionally
- Distinctive: line 73
avoid unnecessary client hydration
- Distinctive: line 74
keep CSS and JavaScript scoped to the features that need them
- Distinctive: line 75
prefer simple server-rendered markup over client complexity
- Distinctive: line 79
default to scoped component styles unless the project has a defined styling system
- Distinctive: line 80
use CSS custom properties for reusable tokens
- Distinctive: line 82
keep responsive behavior intentional and testable
- Distinctive: line 86
Before finalizing Astro work, check:
≈ “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
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
.astrocomponents 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:visiblefor deferred UIclient:idlefor lower-priority enhancementclient:loadfor critical immediate interactivity onlyclient:onlyonly when skipping server rendering is intentional
Default away from hydrating broad layout regions.
Keep the project shape predictable
Typical structure:
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, andfooter - 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:assetsor 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
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.

