roninforge/roninforge-astro/astro-migrate-to-content-layer
Claude Code and agent skill by roninforge/roninforge-astro
- community
Checking that the SKILL.md file is still in the repository.
Stage-by-stage migration of an Astro 4 collection to the Astro 5+ Content Layer: move src/content/config.ts to src/content.config.ts (Astro 6 removed the old path), replace type:'content' / type:'data' with loader:glob() or loader:file() from astro/loaders, replace getEntryBySlug with getEntry, replace post.render() with render(post) imported from astro:content, replace entry.slug with entry.id, drop Astro.glob in favour of getCollection on a glob loader. Includes before/after diffs and a checklist for each numbered anti-pattern. Pairs with astro-content-layer and astro-anti-patterns rules.
Install
npx vskill@latest install roninforge/roninforge-astro/astro-migrate-to-content-layerSKILL.md
The same SKILL.md was published earlier as roninforge/roninforge-astro/astro-migrate-to-content-layer.
Migrate Astro 4 collections to the Content Layer
When to use
Run when:
- The codebase still has
src/content/config.ts - Any collection uses
type: 'content'ortype: 'data' - Any code calls
getEntryBySlug,entry.render(),entry.slug, orAstro.glob
Target: astro ^6.3.3. Source pages: https://docs.astro.build/en/guides/upgrade-to/v5/ and https://docs.astro.build/en/guides/content-collections/
Stage 1: bump versions
Run pnpm install (or your manager). Run astro check and accept that it will print errors; the next stages fix them.
Stage 2: move the config file
Astro 6 no longer reads src/content/config.ts (anti-pattern #47).
Stage 3: replace type with loader
Stage 4: rename slug to id, drop entry.render
For the parameter file rename: src/pages/blog/[slug].astro should become src/pages/blog/[...id].astro if the URL still needs to accept slashes; otherwise src/pages/blog/[id].astro.
Stage 5: replace Astro.glob
Note that the property changed from post.frontmatter.x to post.data.x.
Stage 6: drop hybrid output
If most routes were SSR, use output: 'server' and add export const prerender = true to the static ones. If most were static, use output: 'static' and add export const prerender = false to the SSR ones (anti-pattern #11).
Stage 7: switch from @astrojs/tailwind to @tailwindcss/vite
Delete tailwind.config.js (Tailwind 4 reads CSS-only config).
Stage 8: rename ViewTransitions to ClientRouter
Stage 9: switch zod imports inside src/actions/
Stage 10: re-run astro check + astro build
If you see "could not prerender": that page still uses request-time data. Either move the data to a build-time fetch, or set prerender = false.
Per-anti-pattern checklist
| Pattern | What to do | |
|---|---|---|
| #6 getEntryBySlug | Rename to getEntry | |
| #7 Astro.glob | Replace with getCollection on a glob() loader | |
| #8 entry.render() | Replace with render(entry) from astro:content | |
| #9 type:'content' | Replace with loader: glob(...) or loader: file(...) | |
| #10 entry.slug | Rename to entry.id | |
| #11 output:'hybrid' | Pick static or server, set prerender per-route | |
| #16 @astrojs/tailwind | Switch to @tailwindcss/vite in vite.plugins | |
| #23 ViewTransitions | Rename to ClientRouter | |
| #45 node 18 | Bump engines to >=22.12.0 | |
| #46 zod in actions | Import from astro:schema | |
| #47 src/content/config.ts | Move to src/content.config.ts |
Security
- Security scanPassed, 100 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-migrate-to-content-layer/SKILL.md
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
[](https://verified-skill.com/skills/roninforge/roninforge-astro/astro-migrate-to-content-layer)