Doc Frontmatter
Generate and validate YAML frontmatter for docs folder documents.
Quick Reference
| Field | Required | Description |
|---|---|---|
title | Yes | Document title (from H1 or filename) |
description | Yes | 50-160 char summary |
type | Yes | tutorial, guide, reference, explanation, adr, troubleshooting, pattern, index |
tags | No | Max 5 tags from controlled vocabulary |
order | No | Numeric order (from filename prefix like 00-) |
Full schema, types, and tags → schema.md
Workflows
1. Add frontmatter to a document
- •Read document content
- •Extract
titlefrom first H1 or derive from filename - •Generate
descriptionfrom first paragraph (50-160 chars) - •Determine
typebased on content patterns (see schema.md) - •Select relevant
tags(max 5) from controlled vocabulary - •Insert frontmatter block at document top
2. Update existing frontmatter
- •Parse existing frontmatter
- •Fill missing required fields
- •Validate values against schema
3. Validate folder
bash
bun scripts/validate-frontmatter.ts docs/
4. Auto-generate for single file
bash
bun scripts/generate-frontmatter.ts docs/path/to/file.md # Use --dry-run to preview without writing
Resources
| Resource | Purpose |
|---|---|
| schema.md | Source of Truth - Complete schema, types, tags definitions |
scripts/generate-frontmatter.ts | Auto-generate frontmatter from document content |
scripts/validate-frontmatter.ts | Validate frontmatter against schema |