joabgonzalez/ai-agents-skills/astro-best-practices
Claude Code and agent skill by joabgonzalez/ai-agents-skills
- community
Checking that the SKILL.md file is still in the repository.
Astro quality patterns: island philosophy, SEO by page type, and Core Web Vitals. Trigger: When reviewing Astro site quality or hydration decisions.
Install
npx vskill@latest install joabgonzalez/ai-agents-skills/astro-best-practicesSKILL.md
The same SKILL.md was published earlier as joabgonzalez/ai-agents-skills/astro-best-practices.
Astro Best Practices
Quality patterns for Astro island architecture, SEO strategy, and Core Web Vitals. Complements the astro skill (which covers syntax and directives) — this skill covers architecture decisions.
When to Use
- Reviewing an Astro site for quality or hydration decisions
- Deciding page-type SEO strategy
- Evaluating whether an island is justified
- Auditing Core Web Vitals or JS bundle size
Don't use for:
- Client directive syntax (use astro)
- SEO meta tag implementation details (use web-seo)
- Performance tooling and measurement (use web-performance)
Critical Patterns
✅ REQUIRED [CRITICAL]: Zero JS Is the Default
Hydration is a cost, not a feature. Ask "why does this need browser JS?" before every directive.
✅ REQUIRED: Hydration Directive Ladder
Choose the least aggressive directive that meets the requirement.
✅ REQUIRED: SEO Per Page Type
Each page type needs a distinct SEO strategy. Never use the same meta description across pages.
✅ REQUIRED: Content Collection Typing
Every collection needs a Zod schema in src/content/config.ts.
❌ NEVER: SSR Without Purpose
prerender: false only when the page uses Astro.locals, request cookies, or personalization. Never SSR a page that could be static.
❌ NEVER: React for Static Content
Static logo, nav links, footers, and text blocks ship zero JS as .astro components.
✅ REQUIRED: Core Web Vitals Discipline
LCP, CLS, and INP each have specific patterns.
Symptom → Solution
| Symptom | Cause | Fix | |
|---|---|---|---|
| JS bundle > 50kb on static page | client:load on non-interactive component | Remove directive; use .astro | |
| LCP > 2.5s | Hero image missing priority hints | Add fetchpriority="high" + loading="eager" | |
| CLS on hydration | Island changes size when hydrated | Set explicit width/height on island wrapper | |
| Missing OG image on social share | og:image not in Layout | Add og:image to base Layout component | |
| Build fails on SSR page | Missing adapter | Add SSR adapter in astro.config.mjs | |
| Duplicate content on paginated pages | Missing canonical/rel links | Add canonical + rel="next/prev" per page |
Decision Tree
Example
Blog post layout with correct SEO, one justified island, and LCP-optimized hero.
Edge Cases
Third-party React components: If a library only ships React components, use client:visible at minimum — never client:load unless the component is above-fold and interactive on page load.
Dynamic routes with SSR: getStaticPaths cannot be used with prerender: false. If you need both dynamic routes and SSR, use path params via Astro.params in SSR mode.
Content collections vs Markdown imports: Collections are the correct pattern for 5+ content files. Direct imports are fine for 1–3 standalone documents (changelog, about page).
og:image sizing: Minimum 1200×630px for Twitter/Facebook. Generate with @astrojs/og or a static pre-generated image — never a hot-resize URL that adds latency.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/astro-best-practices/SKILL.md
Popularity
- Repository stars
- 9
- 7-day trend score
- 12
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/joabgonzalez/ai-agents-skills/astro-best-practices)