Context-efficient codebase navigation and documentation using structured frontmatter headers. Use this when exploring an unfamiliar codebase, answering "where is X / how does Y work" questions, or when asked to add/maintain file-level documentation. Index a tree's headers in one pass instead of reading every file, and generate or validate frontmatter with the bundled scripts. Reach for it whenever token budget matters while navigating code, even if the user does not say "frontmatter".
71
100%
Does it follow best practices?
Impact
52%
4.33xAverage score across 7 eval scenarios
Passed
No known issues
Version: 0.1.0
Status: Draft
This specification defines a structured metadata format for source code files. The frontmatter block provides machine-readable context about a file's purpose, interface, and relationships without requiring the full file to be parsed.
AI coding assistants consume tokens proportional to the content they read. Loading a 300-line file to discover it implements "a genetic algorithm for team selection" wastes context window space that could be used for actual work.
By standardising a frontmatter format, tools can:
Frontmatter MUST appear at the very beginning of a file, within the first comment block.
The frontmatter block MUST be delimited by --- markers on their own lines within the comment.
The content between delimiters MUST be valid YAML.
Core schema. In practice only two fields carry the navigation value:
purpose(required) andrelated(recommended). Everything below is permitted by this spec but should be used sparingly — most of it is better expressed elsewhere (see "Discouraged fields").SKILL.mdis the day-to-day guidance; this document is the exhaustive reference.
| Field | Type | Description |
|---|---|---|
purpose | string | A concise description of what the file does (max 120 chars recommended) |
| Field | Type | Description |
|---|---|---|
related | list | Connected files as path - reason. The highest-value nav field. |
| Field | Type | Description |
|---|---|---|
inputs | list | Parameters, arguments, or data the file/module expects |
outputs | list | Return values, side effects, or data produced |
note | string | Non-obvious context (naming history, gotchas) |
tags | list | Categorical labels for filtering |
status | string | stable, experimental, deprecated |
These are valid YAML but tend to go stale or duplicate information the language already carries. Prefer the alternative:
| Field | Prefer instead |
|---|---|
dependencies | the file's own import/require statements |
exports | the language's export/pub/public symbols and types |
usage | a doctest or JSDoc @example that stays runnable |
modified | git history (authoritative, never drifts) |
Stale frontmatter is worse than none — it misleads with confidence. Only record what the header can realistically be kept true.
Each input or output entry SHOULD follow the pattern:
- name: type - descriptionExample:
inputs:
- players: list[Player] - available player pool
- budget: float - maximum spend allowed
outputs:
- team: list[Player] - optimal 15-player squad
- score: float - predicted pointsDependencies SHOULD use:
./ or ../) for internal filesExample:
dependencies:
- numpy
- pandas
- ./utils/scoring.py
- ../config.pyEach related entry SHOULD include the path and relationship:
related:
- ./cache.py - provides caching layer used by this fetcher
- ./models.py - defines data structures returned"""
---
purpose: Description here
---
"""/**
* ---
* purpose: Description here
* ---
*//*
---
purpose: Description here
---
*///! ---
//! purpose: Description here
//! ---# ---
# purpose: Description here
# ---# ---
# purpose: Description here
# ---After the shebang if present:
#!/bin/bash
# ---
# purpose: Description here
# ------ delimiters within comment blocks#, *, //!)Recommended shape — purpose + related, with inputs/outputs only where they aid a caller:
"""
---
purpose: Genetic algorithm for Fantasy Premier League team optimisation
inputs:
- players: list[Player] - all available players with stats
- budget: float - maximum team cost (default 100.0)
outputs:
- team: list[Player] - optimal 15-player squad
- fitness: float - predicted total points
related:
- ./fitness.py - fitness function implementation
- ./selection.py - player selection strategies
---
"""
import numpy as np
from .player import Player
from .fitness import calculate_fitness
# ... rest of implementationNote what is absent: dependencies (the imports below already say it), exports (Python's
public symbols say it), usage (a doctest stays runnable), and modified (git knows). Adding
them creates four more things that can drift out of sync with the code.
These three tools ship with the skill as subcommands of scripts/frontmatter.py
(stdlib-only, no install):
indexScans a directory and emits every file's frontmatter in one pass, plus the files that
lack it. --format json produces:
{
"files": [
{
"path": "src/ga.py",
"purpose": "Genetic algorithm for FPL team optimisation",
"related": ["./fitness.py - fitness function implementation"]
}
],
"missing_frontmatter": ["src/legacy.py"],
"coverage": "1/2"
}validateChecks that frontmatter parses, purpose is present and non-empty, and every related
path resolves on disk (extension-optional). Exits non-zero when any issue is found, so it
drops straight into a pre-commit hook or CI step.
generateCreates skeleton frontmatter for a file by detecting its internal (relative/aliased)
imports and seeding the related list from them, leaving purpose as a TODO for human
or model judgement. --write inserts the block in place, after any shebang.
This specification follows Semantic Versioning. The version is indicated in the document header.
This specification is released under CC0 1.0 Universal (Public Domain).
.tessl-plugin
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scripts