Skip to main content

CODITECT Frontmatter Standard

Purpose

This standard defines YAML frontmatter requirements for all CODITECT documents, enabling automated classification, search, and organization through the MoE (Mixture of Experts) system.

Scope

Applies to:

  • All Markdown documents (.md)
  • Agent definitions
  • Skill definitions
  • Command definitions
  • Workflow documents
  • Documentation files

1. Frontmatter Basics

1.1 Format

Frontmatter is YAML enclosed in triple dashes at the top of the file:

---
type: document
title: Document Title
version: 1.0.0
---

# Document Content Starts Here

1.2 Requirements by Component Type

ComponentFrontmatterRequired Fields
AgentMANDATORYtype, name, description, tools, model
SkillMANDATORYtype, name, description, version
CommandMANDATORYtype, name, description
WorkflowMANDATORYtype, title, status
DocumentationRECOMMENDEDtype, title, status
READMEOPTIONALtype, title

2. Core Fields

2.1 Universal Fields

FieldTypeDescriptionRequired
typestringDocument type (see §3)Yes
titlestringHuman-readable titleYes
versionstringSemantic versionRecommended
statusstringactive/draft/deprecatedRecommended

2.2 MoE Classification Fields

FieldTypeDescriptionAuto-generated
component_typestringComponent categoryYes
keywordsarraySearch keywordsYes
tagsarrayClassification tagsYes
moe_confidencefloatClassification confidence (0-1)Yes
moe_classifiedbooleanWhether MoE classifiedYes

2.3 Metadata Fields

FieldTypeDescription
createdstringCreation date (YYYY-MM-DD)
updatedstringLast update date
authorstringAuthor name/identifier
audiencestringTarget audience (user/contributor/admin)
summarystringBrief description
tokensstringEstimated token count

3. Type Values

3.1 Component Types

type: agent          # AI agent definition
type: skill # Reusable skill
type: command # Slash command
type: hook # Event hook
type: script # Automation script
type: workflow # Process workflow
type: prompt # AI prompt template

3.2 Documentation Types

type: standard       # Standard/specification
type: guide # How-to guide
type: reference # Reference documentation
type: tutorial # Step-by-step tutorial
type: adr # Architecture Decision Record
type: plan # Project plan
type: checklist # Validation checklist
type: index # Index/navigation document

4. Component-Specific Fields

4.1 Agent Fields

---
type: agent
name: agent-name
description: Brief description of what agent does
tools: [Read, Write, Edit, Bash, Grep, Glob]
model: sonnet # or opus, haiku
context_awareness:
project_state: true
file_system: true
git_state: true
triggers:
- pattern: "keyword"
priority: 1
---

4.2 Skill Fields

---
type: skill
name: skill-name
description: What this skill does
version: 1.0.0
status: active
difficulty: beginner # beginner/intermediate/advanced
estimated_tokens: 500
prerequisites:
- prerequisite-skill
related_skills:
- related-skill
---

4.3 Command Fields

---
type: command
name: command-name
description: What this command does
usage: /command-name [options]
arguments:
- name: arg1
type: string
required: true
description: Argument description
options:
- name: --flag
type: boolean
default: false
description: Flag description
---

4.4 Workflow Fields

---
type: workflow
title: Workflow Name
status: active
complexity: high # low/medium/high
estimated_time: 30m
phases:
- name: Phase 1
steps: 5
- name: Phase 2
steps: 3
---

5. Examples

5.1 Minimal Frontmatter

---
type: guide
title: Getting Started Guide
---

5.2 Standard Frontmatter

---
type: guide
title: Getting Started Guide
version: 1.0.0
status: active
audience: user
summary: Quick introduction to the project
keywords: [getting-started, setup, installation]
tags: [documentation, onboarding]
---

5.3 Full Frontmatter (Auto-classified)

---
type: guide
component_type: documentation
title: Getting Started Guide
version: 1.0.0
status: active
audience: user
summary: Quick introduction to the project
keywords: [getting-started, setup, installation, beginner]
tags: [documentation, onboarding, guide]
tokens: ~800
created: '2026-01-02'
updated: '2026-01-02'
moe_confidence: 0.92
moe_classified: true
---

6. Validation

6.1 Required Field Validation

# Agent - MUST have these fields:
type: agent ✓
name: string ✓
description: string ✓
tools: array ✓
model: string ✓

# Skill - MUST have these fields:
type: skill ✓
name: string ✓
description: string ✓
version: string ✓

6.2 Automated Validation

# Validate frontmatter
/validate-frontmatter path/to/file.md

# Batch validate directory
/validate-frontmatter path/to/directory/ --recursive

# Auto-fix common issues
/validate-frontmatter --fix

6.3 CI/CD Integration

- name: Validate Frontmatter
run: python scripts/validate-frontmatter.py --strict

7. MoE Classification

7.1 Automatic Classification

The MoE classifier automatically adds:

  • component_type - Inferred from content
  • keywords - Extracted from content
  • tags - Categorization tags
  • moe_confidence - Classification confidence
  • moe_classified - Classification flag

7.2 Classification Command

# Classify single file
/classify path/to/file.md

# Classify directory
/classify path/to/directory/

# Reclassify with force
/classify --force path/to/file.md

7.3 Confidence Thresholds

ConfidenceAction
≥0.85Auto-apply classification
0.70-0.84Apply with review flag
<0.70Manual classification needed

8. Anti-Patterns

8.1 Avoid These

Anti-PatternProblemSolution
Missing frontmatterCannot be classifiedAdd required fields
Invalid YAMLParse errorsValidate YAML syntax
Wrong type valueMisclassificationUse standard types
Missing required fieldsIncomplete metadataAdd all required fields
Inconsistent formatSearch/filter issuesFollow standards

8.2 Common Mistakes

❌ WRONG - Invalid YAML
---
type: agent
description: "This has "quotes" inside"
---

✅ CORRECT - Escaped quotes
---
type: agent
description: "This has 'quotes' inside"
---

❌ WRONG - Missing required fields
---
type: agent
name: my-agent
---

✅ CORRECT - All required fields
---
type: agent
name: my-agent
description: Does something useful
tools: [Read, Write]
model: sonnet
---

9. Templates

9.1 Document Template

---
type: guide
title: Title Here
version: 1.0.0
status: draft
audience: user
summary: Brief summary
keywords: []
tags: []
---

9.2 Agent Template

---
type: agent
name: agent-name
description: Agent description
tools: [Read, Write, Edit, Grep, Glob, Bash]
model: sonnet
context_awareness:
project_state: true
file_system: true
triggers:
- pattern: "keyword"
priority: 1
---

9.3 Skill Template

---
type: skill
name: skill-name
description: Skill description
version: 1.0.0
status: active
difficulty: beginner
prerequisites: []
related_skills: []
---

10. Frontmatter in Context

10.1 How Claude Uses Frontmatter

Claude Code reads frontmatter for:

  • Agent selection: Matching task to agent capabilities
  • Tool access: Determining available tools
  • Model selection: Choosing appropriate model
  • Context building: Understanding document relationships

10.2 Search and Discovery

Frontmatter enables:

  • Keyword search across documents
  • Type-based filtering
  • Status tracking
  • Version management

References


Version: 1.0.0 Status: Active Owner: CODITECT Core Team Last Updated: 2026-01-02