Skills astro
install
source · Clone the upstream repo
git clone https://github.com/TerminalSkills/skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/TerminalSkills/skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/astro" ~/.claude/skills/terminalskills-skills-astro && rm -rf "$T"
manifest:
skills/astro/SKILL.mdsource content
Astro
Overview
Astro is a web framework for building content-driven websites that ships zero JavaScript by default. Its island architecture hydrates only interactive components, achieving excellent Lighthouse scores while supporting React, Vue, Svelte, or any UI framework where interactivity is needed.
Instructions
- When creating pages, use file-based routing in
withsrc/pages/
,.astro
, or.md
files, and organize shared structure in.mdx
.src/layouts/ - When adding interactivity, use client directives on framework components: prefer
orclient:visible
overclient:idle
since most components do not need immediate hydration.client:load - When managing content, define Content Collections in
with strict Zod schemas usingsrc/content/
, and query withdefineCollection()
andgetCollection()
.getEntry() - When choosing rendering modes, default to static (SSG) for marketing and content pages, use
for dynamic pages, or use hybrid rendering with per-pageoutput: "server"
.export const prerender = false - When optimizing images, use the
component from<Image>
for automatic format conversion (WebP/AVIF), resizing, and lazy loading instead of rawastro:assets
tags.<img> - When adding page transitions, enable View Transitions with
for SPA-like navigation without shipping a client-side router.<ViewTransitions /> - When integrating UI frameworks, install the appropriate integration (
,@astrojs/react
,@astrojs/vue
) and use Astro components for static content, reaching for framework components only when interactivity is required.@astrojs/svelte
Examples
Example 1: Build a blog with Content Collections
User request: "Create an Astro blog with type-safe Markdown content"
Actions:
- Define a blog Content Collection with Zod schema for frontmatter (title, date, tags, author)
- Create dynamic route
withsrc/pages/blog/[slug].astrogetStaticPaths() - Build blog index page querying
with sortinggetCollection("blog") - Add layout with SEO meta tags, navigation, and View Transitions
Output: A statically generated blog with validated content, clean URLs, and smooth page transitions.
Example 2: Add interactive components to a static site
User request: "Add a React search component to my Astro documentation site"
Actions:
- Install
integration@astrojs/react - Create the React search component with state and event handling
- Add the component to the page with
directiveclient:idle - Pass static data as props from the Astro page frontmatter
Output: A documentation site that is fully static except for the interactive search island.
Guidelines
- Use Astro components (
) for static content; only use React/Vue/Svelte when interactivity is needed..astro - Default to
orclient:visible
overclient:idle
for hydration directives.client:load - Define Content Collections with strict Zod schemas to catch content errors at build time.
- Use
astro:assets
over raw<Image>
tags for automatic optimization.<img> - Keep layouts thin with shared
, navigation, and footer; put page-specific content in pages.<head> - Use hybrid rendering: static for marketing pages, SSR only for personalized or dynamic pages.
- Enable View Transitions for SPA-like navigation without shipping a router.