AgentSkillsCN

doc-frontmatter

为docs文件夹中的文档生成并验证YAML前言元数据。当用户希望添加前言元数据、更新前言元数据、生成前言元数据的元信息,或根据Schema验证现有前言元数据时使用此功能。

SKILL.md
--- frontmatter
name: doc-frontmatter
description: Generate and validate YAML frontmatter for docs folder documents.
  Use when users want to add frontmatter, update frontmatter, generate frontmatter
  metadata, or validate existing frontmatter against the schema.

Doc Frontmatter

Generate and validate YAML frontmatter for docs folder documents.

Quick Reference

FieldRequiredDescription
titleYesDocument title (from H1 or filename)
descriptionYes50-160 char summary
typeYestutorial, guide, reference, explanation, adr, troubleshooting, pattern, index
tagsNoMax 5 tags from controlled vocabulary
orderNoNumeric order (from filename prefix like 00-)

Full schema, types, and tagsschema.md

Workflows

1. Add frontmatter to a document

  1. Read document content
  2. Extract title from first H1 or derive from filename
  3. Generate description from first paragraph (50-160 chars)
  4. Determine type based on content patterns (see schema.md)
  5. Select relevant tags (max 5) from controlled vocabulary
  6. Insert frontmatter block at document top

2. Update existing frontmatter

  1. Parse existing frontmatter
  2. Fill missing required fields
  3. 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

ResourcePurpose
schema.mdSource of Truth - Complete schema, types, tags definitions
scripts/generate-frontmatter.tsAuto-generate frontmatter from document content
scripts/validate-frontmatter.tsValidate frontmatter against schema