| name | frontmatter-validation |
| description | Validate and fix YAML frontmatter metadata in markdown documentation files. Covers required fields, field formats, and schema compliance for SKILL.md and knowledge-copilot files. Use proactively when auditing documentation frontmatter, reviewing SKILL.md files, or fixing YAML metadata errors. |
| version | 1.0.0 |
| allowed-tools | ["Read","Edit","Glob","Grep"] |
| tags | ["frontmatter","yaml","documentation","validation","metadata","knowledge-copilot"] |
Frontmatter Validation
Validate and fix YAML frontmatter metadata in markdown documentation files.
Purpose
Frontmatter enables efficient AI navigation of documentation. This skill ensures all files have correct, complete metadata for their document type.
Frontmatter Schemas by Document Type
Tier 1: Skills (SKILL.md)
---
name: forces-analysis
description: >-
One-line description covering use cases and when to invoke this skill.
version: 1.2
allowed-tools: [Read, Write, Edit]
tags: [forces, organization]
---
Tier 2: Product Documentation
---
product: Insights Copilot
status: active
last_updated: 2025-01-15
owner: Platform Team
token_estimate: 650
doc_type: architecture
source_of_truth: ../repo/docs/...
dependencies: [product-a, product-b]
summary: Brief description
key_entities: [Force, Pattern]
integration_endpoints: [POST /api/x]
---
Tier 3: Operational Documentation
---
title: Documentation Strategy Guide
doc_type: guide
category: operations
last_updated: 2025-01-15
version: 2.1
status: active
primary_audience: [developers]
required_reading: false
token_estimate: 2500
replaces: _archive/old-doc.md
related: [other-doc.md]
---
Procedure
1. Identify Target Files
find . -name "*.md" -type f -not -path "./_archive/*"
2. Detect Document Type
Infer from path and filename:
| Pattern | Document Type |
|---|
*/SKILL.md | Tier 1: Skill |
02-products/* | Tier 2: Product |
03-ai-enabling/03-operations/* | Tier 3: Operational |
*/00-overview.md | Product overview |
*-profile.md or 02-profiles/* | Agent profile |
3. Extract Existing Frontmatter
Frontmatter is YAML between --- markers at file start:
sed -n '/^---$/,/^---$/p' file.md | head -n -1 | tail -n +2
4. Validate Against Schema
Check for:
| Check | Severity | Description |
|---|
| Required fields missing | ERROR | Must be present |
| Wrong type | ERROR | e.g., string instead of array |
| Invalid value | ERROR | e.g., status: "live" not in enum |
| Missing token_estimate | WARNING | Should be calculated and added |
| Stale last_updated | WARNING | Older than file modification |
| Broken path reference | WARNING | source_of_truth doesn't exist |
5. Auto-Fix Where Possible
| Missing Field | Auto-Fix Strategy |
|---|
token_estimate | Calculate from word count × 1.4 |
last_updated | Use current date |
status | Default to "active" |
name | Derive from directory name |
doc_type | Infer from path/filename |
6. Generate Missing Frontmatter
For files without frontmatter, generate based on type:
---
title: [Derived from H1 or filename]
doc_type: [Inferred from path]
last_updated: 2025-12-21
status: active
token_estimate: [Calculated]
---
Output Format
## Frontmatter Validation Report
### Summary
- Files scanned: N
- Valid: N
- Errors: N
- Warnings: N
- Fixed: N
### Errors (Must Fix)
| File | Issue | Field | Details |
|------|-------|-------|---------|
| skills/x/SKILL.md | Missing required | name | Add skill name |
| products/y.md | Invalid value | status | "live" not valid, use "active" |
### Warnings
| File | Issue | Field | Suggestion |
|------|-------|-------|------------|
| docs/guide.md | Missing | token_estimate | Add: 1,250 (calculated) |
| docs/api.md | Stale | last_updated | Update to current date |
### Auto-Fixes Applied
| File | Field | Old Value | New Value |
|------|-------|-----------|-----------|
| docs/setup.md | token_estimate | (missing) | 890 |
| docs/setup.md | last_updated | 2024-06-01 | 2025-12-21 |
Validation Rules
Field Value Rules
| Field | Valid Values |
|---|
status | active, deprecated, draft, beta |
skill_category | analysis, engineering, facilitation, strategy, documentation |
doc_type | overview, architecture, api, integration, security, guide, standard, reference, runbook |
allowed_tools | Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch |
Path Validation
For path fields (source_of_truth, methodology, replaces, related):
- Resolve relative to file location
- Check target exists
- Warn if external to repository
Token Estimate Accuracy
Compare token_estimate to actual:
- Within 10%: OK
- 10-25% off: WARNING
-
25% off: ERROR (likely stale)