Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
Claude Skills Maintainers avatar

Content Collections

  • 196 repo stars
  • Updated July 25, 2026
  • secondsky/claude-skills

Use Content Collections, a TypeScript-first build tool for Markdown/MDX, to build blogs and docs with Vite + React and type-safe Zod schemas.

About

A skill for using Content Collections, a TypeScript-first build tool for Markdown and MDX content. Developers use it for blogs, docs, and content sites with Vite + React, MDX components, and type-safe Zod schemas, and to resolve TypeScript import, path-alias, and collection-validation errors.

  • TypeScript-first content tool
  • Markdown/MDX with Vite + React
  • Type-safe Zod schemas
  • Contentlayer migration

Content Collections by the numbers

  • Data as of Jul 28, 2026 (Skillselion catalog sync)
/plugin marketplace add secondsky/claude-skills
/plugin install content-collections@claude-skills

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
repo stars196
Last updatedJuly 25, 2026
Repositorysecondsky/claude-skills

What it does

Use Content Collections, a TypeScript-first build tool for Markdown/MDX, to build blogs and docs with Vite + React and type-safe Zod schemas.

README.md

Content Collections

Status: Production Ready ✅ Last Updated: 2025-11-07 Production Tested: Multiple production sites using Content Collections for type-safe content


Auto-Trigger Keywords

Claude Code automatically discovers this skill when you mention:

Primary Keywords

  • content-collections
  • @content-collections/core
  • @content-collections/vite
  • @content-collections/mdx
  • content collections vite
  • type-safe content
  • markdown blog
  • MDX blog
  • contentlayer migration
  • contentlayer replacement

Secondary Keywords

  • defineCollection
  • defineConfig
  • compileMDX
  • MDXContent
  • frontmatter validation
  • content schema
  • zod content validation
  • markdown with zod
  • static site generation
  • blog with react
  • documentation site
  • vite markdown
  • react markdown
  • typescript blog
  • content transform
  • allPosts import

Error-Based Keywords

  • "Cannot find module 'content-collections'"
  • "module not found content-collections"
  • "content-collections path alias"
  • ".content-collections/generated"
  • "vite constant restart"
  • "mdx type errors"
  • "transform types not working"
  • "collection not updating"
  • "shiki langAlias error"
  • "MDX import custom path"
  • "content validation errors"
  • "frontmatter parsing error"

Use Case Keywords

  • blog setup vite
  • documentation site react
  • content-heavy app
  • markdown content management
  • static content blog
  • type-safe blog posts
  • MDX with React components
  • migrate from contentlayer

What This Skill Does

Sets up production-ready Content Collections for Vite + React, transforming local Markdown/MDX files into type-safe TypeScript data with automatic validation at build time.

Core Capabilities

Type-safe content - Automatic TypeScript types from Zod schemas ✅ Zod validation - Runtime content validation at build time ✅ MDX support - React components in markdown ✅ HMR integration - Instant updates without restart ✅ Error prevention - Fixes path alias, restart loop, type issues ✅ Transform functions - Computed fields, async operations ✅ Cloudflare Workers - Static asset deployment patterns ✅ Templates - Proven configurations ready to copy


Known Issues This Skill Prevents

Issue Why It Happens How Skill Fixes It
Module not found Missing tsconfig path alias Provides exact path configuration
Vite restart loop .content-collections not ignored Correct .gitignore setup
MDX type errors Version incompatibility Compatible version matrix
Transform types wrong TS doesn't infer Explicit type annotations
Collection not updating Wrong glob patterns Verified pattern examples
Unclear errors Zod errors not formatted Custom error messages
Process hangs Watcher not cleaning up Proper cleanup patterns
Custom aliases fail MDX compiler doesn't resolve Files appender configuration

Total: 8+ documented issues with sources


When to Use This Skill

✅ Use When:

  • Building blogs or documentation sites
  • Need type-safe content with Zod schemas
  • Working with Markdown or MDX content
  • Using Vite + React for static site generation
  • Migrating from Contentlayer (abandoned project)
  • Need computed properties in content (reading time, slugs)
  • Integrating React components in markdown
  • Deploying to Cloudflare Workers

❌ Don't Use When:

  • Using CMS with API (Sanity, Contentful, Strapi)
  • Need real-time content updates without rebuilds
  • Building purely server-rendered apps (Next.js SSR)
  • Content stored in database (use Drizzle/Prisma)
  • No TypeScript in project
  • User prefers manual content loading

Quick Usage Example

# 1. Install dependencies
bun add -d @content-collections/core @content-collections/vite zod
# or
pnpm add -D @content-collections/core @content-collections/vite zod

# 2. Add path alias to tsconfig.json
#    "paths": { "content-collections": ["./.content-collections/generated"] }

# 3. Add Vite plugin to vite.config.ts
#    plugins: [react(), contentCollections()]

# 4. Create content-collections.ts and define collection

# 5. Create content/posts/first-post.md

# 6. Import and use
#    import { allPosts } from "content-collections"

Result: Type-safe content with autocomplete, validation, and HMR!

Full instructions: See SKILL.md


Package Versions (Verified 2025-11-07)

Package Version Status
@content-collections/core 0.12.0 ✅ Latest stable
@content-collections/vite 0.2.7 ✅ Latest stable
@content-collections/mdx 0.2.2 ✅ Latest stable
@content-collections/markdown 0.1.4 ✅ Latest stable
zod 3.23.8 ✅ Latest stable

Dependencies

Prerequisites: None

Integrates With:

  • tailwind-v4-shadcn - Styling for blogs/docs
  • cloudflare-worker-base - Deployment foundation
  • react-hook-form-zod - Form validation patterns
  • drizzle-orm-d1 - If mixing CMS with database

File Structure

content-collections/
├── SKILL.md                          # Complete documentation (~4,500 words)
├── README.md                         # This file (quick reference)
├── templates/                        # Copy-paste ready configs
│   ├── content-collections.ts        # Basic blog setup
│   ├── content-collections-multi.ts  # Multiple collections
│   ├── content-collections-mdx.ts    # MDX with syntax highlighting
│   ├── tsconfig.json                 # TypeScript config
│   ├── vite.config.ts                # Vite plugin setup
│   ├── blog-post.md                  # Example content file
│   ├── BlogList.tsx                  # React list component
│   ├── BlogPost.tsx                  # React MDX component
│   └── wrangler.toml                 # Cloudflare Workers config
├── references/                       # Deep-dive docs
│   ├── schema-patterns.md            # Zod schema examples
│   ├── transform-cookbook.md         # Transform recipes
│   ├── mdx-components.md             # MDX + React patterns
│   └── deployment-guide.md           # Cloudflare deployment
└── scripts/
    └── init-content-collections.sh   # One-command setup

Official Documentation


Related Skills

  • tailwind-v4-shadcn - Styling for content sites
  • cloudflare-worker-base - Deployment to Workers
  • react-hook-form-zod - Form validation patterns
  • drizzle-orm-d1 - Database integration if needed

License

MIT License - See main repo LICENSE file


Production Tested: ✅ Multiple sites in production Token Savings: ~65% Error Prevention: 100% (all 8 documented issues) Ready to use! See SKILL.md for complete setup.

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.