Doctrina
AGENTS.md5 starsChanged 2 days agoMITView on GitHub
Doctrina is a library of portable rules for AI coding agents. Any repository can copy a rule into its own .claude/rules/ folder and fill in the values that are specific to it. Doctrina is also where classes are built: courses, workbooks, and articles go in courses/, workbooks/, and articles/. Doctrina uses three of its own rules and two of its own skills in Claude Code and Codex. - rules/ is portable. Treat its files as the product you are editing,…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 33,398 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- build-courseSkill
- set-up-githubSkill
- build-courseSkill
- set-up-githubSkill
- build-courseSkill
- build-language-packsSkill
- build-roadmap-and-docsSkill
- draw-diagramsSkill
- fix-doc-driftSkill
- next-taskSkill
- phase-gatesSkill
- security-sweepSkill
- set-up-githubSkill
- simplify-codeSkill
- sweep-codeSkill
The file
We split this AGENTS.md into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
rules/is portable: Treat its files as the product you are editing, not as instructions. - Distinctive: line 19
Never fill in their placeholders, and never name a particular repository in their general text, because other repositories copy these files …
- Very specific: line 28
If you use Codex or another coding agent, read every Markdown file in .agents/rules/ before starting work.
- Very specific: line 42
Check that every copy still matches.
- Very specific: line 62
When you update an imported skill in .claude/skills/, copy its SKILL.md to the matching folder in .agents/skills/ in the same commit.
- Very specific: line 68
Put everything that differs between repositories in Project details, one value per bullet, in the form - Name: [FILL IN: what it is, with …
- Distinctive: line 72
Start Project details with the same introduction the existing rules use, and refer to each value by its bold name everywhere else in the …
- Very specific: line 74
Add paths front matter only when the rule matters only for certain files, as web-front-end.md does for HTML, CSS, and JavaScript.
- Very specific: line 81
Put each skill in its own folder, skills/<name>/SKILL.md, with name, description, and argument-hint front matter.
≈ “Common” is an estimate: at least 1 in 5 of the 43,423 AGENTS.md 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
Doctrina: conventions for coding agents
Doctrina is a library of portable rules for AI coding agents. Any repository can copy a rule into
its own .claude/rules/ folder and fill in the values that are specific to it. Doctrina is also
where classes are built: courses, workbooks, and articles go in courses/, workbooks/, and
articles/. Doctrina uses three of its own rules and two of its own skills in Claude Code and
Codex.
Repository rules and skills
rules/ | .claude/rules/ | |
| What it holds | The portable library: what Doctrina publishes | Doctrina's own rules: copies of rules/writing.md, rules/commits.md, and rules/teaching-materials.md |
| Project details | Every value stays a [FILL IN: …] placeholder | Every value is filled in for Doctrina |
| Loaded by Claude Code | No | Yes: writing.md and commits.md in every session, and teaching-materials.md when Claude works on files its paths front matter matches |
| Instructions for you | No: it's content you edit | Yes: follow them while you work here |
rules/is portable. Treat its files as the product you are editing, not as instructions. Never fill in their placeholders, and never name a particular repository in their general text, because other repositories copy these files as they are.skills/is portable too. Its skills are content you edit, like the rules inrules/. Doctrina uses two itself, as copies in.claude/skills/:build-course/, for the courses built here, andset-up-github/, for Doctrina's own GitHub files. Claude Code offers them as/build-courseand/set-up-github..claude/rules/holds this repository's rules. They also govern edits torules/. Claude Code loads them on its own..agents/holds Doctrina's Codex imports..agents/rules/links to.claude/rules/. If you use Codex or another coding agent, read every Markdown file in.agents/rules/before starting work. Applywriting.mdandcommits.mdthroughout the repository. Applyteaching-materials.mdto the files itspathsfront matter matches, including both courses. Codex discoversbuild-courseandset-up-githubin.agents/skills/for explicit invocation.- Doctrina has adopted the three rules shown in the table. Other files in
rules/, including the Lua and Python rules, remain available for repositories that choose to adopt them.
Keep each copy in sync with its source
A copy in .claude/rules/ matches its source in rules/ everywhere except Project details.
- To change a rule's general text, edit it in
rules/, then make the same edit to its copy in.claude/rules/in the same commit. Never change the general text only in the copy. - To change one of Doctrina's own values, edit Project details in the copy only.
Check that every copy still matches. This command prints
<file> matchesfor each copy, or the differing lines when one doesn't:for f in .claude/rules/*.md; do strip() { awk '/^## Project details/{s=1; next} s && /^## /{s=0} !s' "$1"; } diff <(strip "rules/$(basename "$f")") <(strip "$f") && echo "$f matches" done
A copy in .claude/skills/ matches its source in skills/ exactly, because a skill has no
Project details. Edit the skill in skills/, then copy it over in the same commit. This
command prints <folder> matches for each copy, or the differences when one doesn't:
for d in .claude/skills/*/; do
diff -r "skills/$(basename "$d")" "$d" && echo "$d matches"
doneWhen you update an imported skill in .claude/skills/, copy its SKILL.md to the matching
folder in .agents/skills/ in the same commit. Each Codex skill keeps its explicit-invocation
setting in agents/openai.yaml inside its skill folder.
Write a portable rule
- Put everything that differs between repositories in Project details, one value per bullet,
in the form
- **Name:** [FILL IN: what it is, with examples, or "none"]. Start each placeholder on the bullet's first line, because the placeholder check inREADME.mdsearches only those lines. - Start Project details with the same introduction the existing rules use, and refer to each value by its bold name everywhere else in the rule.
- Add
pathsfront matter only when the rule matters only for certain files, asweb-front-end.mddoes for HTML, CSS, and JavaScript. - Wrap lines at 100 characters. Table rows may run longer.
- List the new rule in
README.mdin the same commit.
Write a portable skill
- Put each skill in its own folder,
skills/<name>/SKILL.md, withname,description, andargument-hintfront matter. Adddisable-model-invocation: trueto a skill that only the user should start. - Give a skill no values of its own. Say near its top which rules it relies on, and refer to their values by their bold names, so a repository fills each value in once, in the rule.
- List the new skill in
README.md's "Skills" section in the same commit.
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.

