context-md
Skill5 starsChanged 13 days agoMITView on GitHub
Write and maintain CONTEXT.md files, the per-directory notes that give AI agents the facts, conventions, decisions and gotchas they can't quickly get from the code. Use when creating a module, when a change makes a CONTEXT.md wrong or incomplete, or when asked to document a directory for agents.
2 other projects use a version of this.
Adopted by
Most recently taken up by
- amajorai/context.mdtheir own version, first seen May 28, 2026
- kaisdavis/claude-skillstheir own version, first seen May 22, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- amajorai/context.md★ 1same name
- kaisdavis/claude-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- commits-and-prsSkill
- debuggingSkill
- diagramsSkill
- implementationSkill
- project-profileSkill
- project-scanSkill
- session-retroSkill
- task-plansSkill
- tddSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 7 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈7
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
Only stable facts. Leave out what goes stale on its own: test counts, coverage numbers, open issues, current status, "last updated" dates.
- Distinctive: line 21
No content a quick read of the code gives: lists of every function, file-by-file descriptions.
- Distinctive: line 30
Not every folder needs one.
- Very specific: line 38
Every line costs tokens each time an agent reads the file.
- Distinctive: line 54
Update it in the same change when you:
- Distinctive: line 56
add, remove, rename or move a module, or change what it's responsible for,
- Distinctive: line 61
No update is needed for internal refactors, bug fixes that restore documented behavior, or test-only changes.
- Very specific: line 70
If a directory has gained non-obvious design and has no CONTEXT.md, create one from the template.
- Very specific: line 77
Write the root CONTEXT.md first, as an index: what the system does, its main parts and how they connect, and where to read next.
- Distinctive: line 78
Add one to an area only where reading the code turned up something non-obvious: a convention, a decision, a constraint or a trap.
- Very specific: line 79
If an existing CONTEXT.md or similar file is too long or mixes in volatile facts, split it by area and drop the volatile parts.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- From agentic-defaults. Kit updates replace this file except a "## This project" section at the end, which belongs to the project. Edit nothing else. Rules for all work go in AGENTS.md "This project". -->CONTEXT.md files
A CONTEXT.md gives an AI agent what it can't quickly learn from the code: what this part is for, how it is meant to be used, the rules it relies on, and what will bite. People can read it too, but agents are the audience.
- For agents:
CONTEXT.md(what the code is),AGENTS.md(how to work), plan files (what is being done). - For people:
README.mdand guides underdocs/. Don't copy content between the two kinds; link instead.
Write for an agent
- Dense and scannable: short lines, lists and tables, no narrative, no marketing, no emojis.
- Exact names: file paths, classes, functions, endpoints, environment variables, commands. Agents search for them.
- State rules as rules: "Never expose integer primary keys; use
public_id." - Only stable facts. Leave out what goes stale on its own: test counts, coverage numbers, open issues, current status, "last updated" dates. The test run, the issue tracker and git hold those.
- No content a quick read of the code gives: lists of every function, file-by-file descriptions.
Where: levels that get more concrete
- Root: an index of the system that points to the rest. The
project-scanskill describes its shape. - Area (
backend/,ui/, a service or package): how that area is built, its conventions and traps. - Module (
backend/billing/): that module's rules, only when they aren't obvious from its code. - Each level adds only what is specific to it and never repeats its parent. Start each file below the root with a line pointing to its parent, such as
Parent: ../CONTEXT.md. - Agents read the chain from the root down to the folder they're changing, so put detail where it's used: backend detail in
backend/CONTEXT.md, not the root. - Not every folder needs one. Add a level only when it says something its parent doesn't; every level costs tokens on every read.
Link the real documents
A CONTEXT.md is a map. Point to the documents that hold the detail (decision records, API specifications such as OpenAPI files, schema files, guides in docs/) with a one-line summary each, instead of restating them. A link stays right when the document changes; a copy doesn't.
Size
Every line costs tokens each time an agent reads the file. Aim for about 150 lines at the root and 80 in an area. When a file grows past that, move area detail down into that area's CONTEXT.md rather than cutting facts agents need.
What goes in
Start from template.md.
- Purpose: what this part is responsible for, and what it deliberately isn't.
- How it fits: entry points, who calls it, what it depends on. Add a diagram when the flow or structure is easier to show than to list (see the
diagramsskill). - Conventions: patterns code here must follow.
- Key decisions: choices a reader might question, one line each with the reason. If the project keeps decision records (for example
docs/adr/), link the record instead of repeating it. - Invariants and gotchas: rules the code relies on, traps, non-obvious behavior.
Record a decision's reason only if you actually know it, from the user, a decision record, code comments, commit messages or existing docs. Never invent a rationale. If the reason is unknown, write "reason unknown" so agents know to ask before changing it.
When to update
Update it in the same change when you:
- add, remove, rename or move a module, or change what it's responsible for,
- change an interface, data model or behavior that other code depends on,
- make or reverse a design decision, or add a constraint,
- discover a gotcha the hard way.
No update is needed for internal refactors, bug fixes that restore documented behavior, or test-only changes.
The context check: the last step of every task
Agents maintain these files, because agents are who reads them. Every task ends with this check, before reporting done:
- Run check.sh:
bash <this skill's folder>/check.shfor uncommitted changes. If the work is already committed, add--base origin/<default branch>, which also includes uncommitted changes. To find that ref, rungit symbolic-ref --short refs/remotes/origin/HEAD, which prints it in full; if that prints nothing, look for "HEAD branch" ingit remote show origin. It lists the nearestCONTEXT.mdabove each changed code file that wasn't itself changed. - For each one listed, and for the root one if the change crosses areas, decide whether your change made it wrong or incomplete.
- Edit only what is now wrong or missing; don't rewrite whole files. Delete statements that are no longer true: stale context is worse than none.
- If a directory has gained non-obvious design and has no
CONTEXT.md, create one from the template. - In your report, say which files you updated, or in one line why none needed it.
The same script can enforce the check automatically: --strict fails a pre-commit hook or CI job, and --hook reminds an agent at the end of its turn. The kit's README shows how to set these up.
Adding CONTEXT.md to an existing project
- Write the root
CONTEXT.mdfirst, as an index: what the system does, its main parts and how they connect, and where to read next. - Add one to an area only where reading the code turned up something non-obvious: a convention, a decision, a constraint or a trap.
- If an existing
CONTEXT.mdor similar file is too long or mixes in volatile facts, split it by area and drop the volatile parts. Keep every stable fact somewhere. - Mark anything you inferred rather than confirmed with "(unverified)".
- List the files you created and the "(unverified)" points, so a person can review them.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

