roninforge/roninforge-astro/astro-new-content-collection

Claude Code and agent skill by roninforge/roninforge-astro

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Scaffold a new Astro 6 Content Layer collection in src/content.config.ts (NOT the legacy src/content/config.ts) using glob() loader from astro/loaders for Markdown bodies or file() for JSON / YAML data, a zod schema with image() helper for cover images and reference() for cross-collection joins. Refuses type:'content' / type:'data' (removed in Astro 5), refuses entry.slug (renamed entry.id), refuses getEntryBySlug (renamed getEntry), refuses entry.render() (use module-level render(entry)). Pairs with the astro-content-layer and astro-anti-patterns rules.

Install

npx vskill@latest install roninforge/roninforge-astro/astro-new-content-collection

SKILL.md

The same SKILL.md was published earlier as roninforge/roninforge-astro/astro-new-content-collection.

Scaffold a New Content Collection

When to use

Use when:

  • Adding a new collection (blog posts, authors, products, docs)
  • Migrating an Astro 4 collection (drop type: 'content', replace with a loader)
  • Wiring a custom data source (CMS, database) via a custom loader

Target: astro ^6.3.3. The companion astro-content-layer and astro-anti-patterns rules cover the surrounding patterns.

Output

For a blog collection backed by src/content/blog/*.md:

src/content.config.ts
ts
import { defineCollection, reference, z } from 'astro:content'
import { glob, file } from 'astro/loaders'
const blog = defineCollection({
loader: glob({ pattern: '**/*.md', base: './src/content/blog' }),
schema: ({ image }) => z.object({
title: z.string().min(1),
summary: z.string().max(280),
publishedAt: z.coerce.date(),
cover: image().optional(),
author: reference('authors'),
draft: z.boolean().default(false),
}),
})
const authors = defineCollection({
loader: file('src/content/authors.json'),
schema: z.object({
id: z.string(),
name: z.string(),
bio: z.string().optional(),
}),
})
export const collections = { blog, authors }
src/content/blog/hello.md
md
---
title: Hello, Astro 6
summary: First post on the new content layer.
publishedAt: 2026-05-14
author: jens
---
Welcome to the new collection.
src/content/authors.json
json
[
{ "id": "jens", "name": "Jens Krause", "bio": "Forge bench" }
]

Workflow

  1. Place the config at src/content.config.ts (NOT inside src/content/). Astro 6 removed the old path (anti-pattern #47).
  2. Pick a loader:
  • glob({ pattern, base }) for Markdown / MDX folders
  • file(path) for one JSON / YAML file
  • Custom loader: { load(ctx) { ... } } for CMS or database
  1. Write the schema. Use the function form schema: ({ image }) => z.object(...) if you need the image() helper for cover images. Use reference('otherCollection') to join collections.
  2. Read with getCollection('blog'), getEntry('blog', id), getEntries(refs). Render bodies with render(entry).

Examples

Reading the collection from a page
astro
---
import { getCollection, getEntry, render } from 'astro:content'
const posts = await getCollection('blog', ({ data }) => !data.draft)
const post = await getEntry('blog', Astro.params.id)
if (!post) return new Response('Not found', { status: 404 })
const author = await getEntry(post.data.author)
const { Content } = await render(post)
---
<h1>{post.data.title}</h1>
<p>by {author?.data.name}</p>
<Content />

Common mistakes

  • Putting the config at src/content/config.ts; Astro 6 ignores it.
  • Using type: 'content' (removed in 5.0; use a loader).
  • Using entry.slug (renamed entry.id).
  • Using getEntryBySlug (use getEntry).
  • Using entry.render() (use render(entry) from astro:content).
  • Using Astro.glob (removed; use a glob loader collection).

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

Popularity

7-day trend score
5

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/roninforge/roninforge-astro/astro-new-content-collection/badge)](https://verified-skill.com/skills/roninforge/roninforge-astro/astro-new-content-collection)

Something wrong with this skill or its page? Tell us.