/astro:astro-content-collectionsfrom astro
Manages structured content in Astro projects with Zod schemas, querying and filtering collections, dynamic routes, YAML meta files, and MDX support.
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 managing structured content in Astro projects.
src/
├── content.config.ts # Schema and loader definitions
└── content/
├── blog/ # Collection: blog posts
│ └── my-post.md
├── projects/ # Collection: project showcases
│ └── project-1.md
└── formations/ # Collection: training content
└── ddd/
└── jour-1/
└── _meta.yaml
---
import { getCollection, getEntry, render } from 'astro:content';
// Get all, filter drafts in production
const posts = await getCollection('blog', ({ data }) => {
return import.meta.env.PROD ? !data.draft : true;
});
// Sort by date
const sortedPosts = posts.sort(
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()
);
// Get single entry
const post = await getEntry('blog', 'my-post');
// Render the entry's Content component
const { Content } = await render(post);
---
When defining collection schemas with Zod (blog, projects, data-only collections), read
references/collection-patterns.mdfor complete schema examples with typed frontmatter.
When creating dynamic routes or category pages from collections, read
references/collection-patterns.mdfor getStaticPaths patterns and category filtering.
When using MDX with components, YAML meta files, or collection references, read
references/collection-patterns.mdfor advanced content patterns.
| Function | Usage |
|---|---|
getCollection('name') | Get all entries |
getCollection('name', filter) | Get filtered entries |
getEntry('name', 'id') | Get single entry |
render(entry) | Get Content component |
post.id | URL-safe identifier (from the loader) |
post.data | Typed frontmatter data |
post.body | Raw markdown content |
reference('collection') | Cross-collection reference |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub fabiensalles/claude-marketplace --plugin astro11 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-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./astro-i18n