/astro:astro-routingfrom astro
Guides file-based and dynamic routing in Astro: single/multiple/nested params, catch-all routes, pagination, API endpoints (JSON/RSS), URL utilities, and redirects.
Ships in astro. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Patterns for file-based and dynamic routing in Astro.
src/pages/
├── index.astro -> /
├── about.astro -> /about
├── blog/
│ ├── index.astro -> /blog
│ └── [slug].astro -> /blog/:slug
├── [...slug].astro -> /* (catch-all)
└── api/
└── data.json.ts -> /api/data.json
---
// src/pages/blog/[slug].astro
import { getCollection } from 'astro:content';
export async function getStaticPaths() {
const posts = await getCollection('blog');
return posts.map((post) => ({
params: { slug: post.id },
props: { post },
}));
}
const { post } = Astro.props;
---
<h1>{post.data.title}</h1>
---
// src/pages/[lang]/blog/[slug].astro
export async function getStaticPaths() {
const posts = await getCollection('blog');
const languages = ['en', 'fr'];
return languages.flatMap((lang) =>
posts.map((post) => ({
params: { lang, slug: post.id },
props: { post, lang },
}))
);
}
---
/about.astro) -- highest/blog/[slug].astro) -- medium/[...slug].astro) -- lowestWhen implementing nested dynamic routes, catch-all routes, pagination, or API endpoints, read
references/routing-examples.mdfor complete implementations with getStaticPaths, paginate, JSON/RSS endpoints, and redirect patterns.
| Pattern | Route | Example URL |
|---|---|---|
index.astro | Root | / |
about.astro | Static | /about |
[slug].astro | Dynamic | /post-1, /post-2 |
[...slug].astro | Catch-all | /a/b/c |
[lang]/[slug].astro | Multi-param | /en/about |
[page].astro + paginate | Pagination | /1, /2 |
file.json.ts | API | /file.json |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
11 skills in this plugin
/astro-basicsACTIVATE when creating Astro components, layouts, pages, or setting up Astro project structure. ACTIVATE for 'Astro component', 'slot', 'layout', 'Astro.props', 'class:list'. Covers: component anatomy (frontmatter/template/style/script), layout pattern with slot, props patterns, scoped vs global styles, script patterns (build-time vs client-side), path aliases. DO NOT use for: content collections (see astro-content-collections), routing (see astro-routing), React islands (see astro-react)./astro-content-collectionsACTIVATE when working with Astro content collections, markdown/MDX files, YAML frontmatter, Zod schemas for content, or content-driven pages. ACTIVATE for 'getCollection', 'getEntry', 'defineCollection', 'content collection', 'content.config.ts'. Covers: collection schema definition with Zod, loader-based collections, querying/filtering collections, dynamic routes with getStaticPaths, YAML meta files, MDX with components, collection references. DO NOT use for: routing logic (see astro-routing), general Astro components (see astro-basics)./astro-envACTIVATE when working with environment variables, feature flags, or runtime configuration in Astro. ACTIVATE for 'import.meta.env', '.env', 'PUBLIC_', 'feature flag'. Covers: server vs client variables (PUBLIC_ prefix), feature flags pattern with centralized config, TypeScript env declarations, build-time vs runtime variables, Netlify/Vercel deployment vars. DO NOT use for: general Astro setup, content configuration.npx claudepluginhub fabiensalles/claude-marketplace --plugin astro