use-content-collections-for-markdown

Installation
SKILL.md

Summary

Use Astro's Content Collections (src/content) for managing Markdown/MDX types. Define strict schemas using Zod in src/content/config.ts. Avoid placing content directly in src/pages.

Rationale

  • Type Safety: Content Collections generate TypeScript interfaces for frontmatter, preventing runtime errors.
  • Validation: Zod schemas ensure all content meets requirements (e.g. valid dates, required images).
  • Separation: Decouples content structure from routing logic.

Guidance

  1. Define Schema: Always create a config.ts in src/content and define a schema for each collection.
  2. Query, Don't Import: Use getCollection() to fetch content, not import * from '*.md'.

Examples

Installs
1
First Seen
Apr 5, 2026
use-content-collections-for-markdown — mew-ton/coding-guidelines