Read-only mirror of https://github.com/eth-library/four-kinds — ETH Library. Issues & pull requests at the source.
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Germano Giuliani (ETHZ) e364439ab1
Add files via upload
chore: add Apache 2.0 license
2026-08-03 18:46:52 +02:00
.claude/skills/grill-me docs: initial import of the four-kinds documentation scaffold 2026-08-02 17:50:24 +02:00
docs docs: initial import of the four-kinds documentation scaffold 2026-08-02 17:50:24 +02:00
.gitattributes chore: enforce LF line endings via .gitattributes 2026-08-02 17:53:24 +02:00
CLAUDE.md docs: initial import of the four-kinds documentation scaffold 2026-08-02 17:50:24 +02:00
LICENSE Add files via upload 2026-08-03 18:43:18 +02:00
NOTICE Add files via upload 2026-08-03 18:46:52 +02:00
README.md docs: initial import of the four-kinds documentation scaffold 2026-08-02 17:50:24 +02:00

Four Kinds

A small documentation setup for projects built with an AI coding agent.

Four kinds of document, each with one job, one trigger that says when to write it, and one rule that says whether you may edit it later. Plus one file the agent reads every single time.

That's the whole idea. This repository is a working scaffold — clone it, delete this README, start your project.


1. The one thing to understand first

Your agent reads exactly one documentation file automatically: CLAUDE.md.

Everything else in docs/ is invisible to it until something points it there.

This is not a detail — it determines the entire shape of the setup. If you put your conventions in a beautifully organised docs/ folder and nothing in CLAUDE.md, the agent will never see them, and you will spend your days repeating yourself in chat. If you put everything in CLAUDE.md, it becomes a wall of text that gets skimmed, and it costs context on every single request.

So the split is:

Goes in CLAUDE.md Goes in docs/
What Rules the agent must apply without being asked Detail it should look up when relevant
Examples "Write an ADR before changing how auth works" The ADR format, the templates, the actual ADRs
Size Short. Every line costs context on every request. As long as it needs to be.

CLAUDE.md is the triggers. docs/ is the content. When you find yourself repeating an instruction to the agent in chat, that's the signal it belongs in CLAUDE.md.

On the filename: CLAUDE.md is what Claude Code loads automatically. Other agents use other names (AGENTS.md, .cursorrules, …). The principle doesn't change — find out which file your tool always reads, and treat that as your entry point.

2. The four kinds

Kind Answers Write it Edit later?
ADR — docs/adr/NNNN-title.md Why the system looks like it does Before the decision is implemented No. Supersede with a new ADR.
Spec — docs/specs/NN-name.md What gets built Before the module is implemented Yes. Edit in place as intent changes.
Runbook — docs/runbooks/NN-task.md How to run, deploy, recover In the same commit as the operational change Yes. It describes today's procedure.
Summary — README.md, overview pages Orientation for readers On demand, never as a required step Yes. It has no authority of its own.

Three things make this work, and all three are load-bearing:

Each kind has a trigger, not a vibe. "Document your decisions" is useless advice — nobody knows when to start. "Write an ADR before you adopt or replace a framework, runtime, hosting platform or database; before you change how auth or secrets work; before you add an integration across a trust boundary" is a rule you can actually follow, and an agent can apply it without asking you.

ADRs are immutable, everything else is living. This is the distinction people get wrong most often. An ADR records what you believed at the time you decided — its value is that it is a snapshot. Editing it destroys the only reason it exists. A spec describes what the module should do now; freezing it makes it a lie. Same folder structure, opposite maintenance rule.

Summaries have no authority. The README and any overview page are derived — they summarise what the other three kinds and the code already say. They link to procedures instead of restating them. The moment a README explains how to deploy instead of linking to the runbook that does, you have two sources of truth and one of them is already wrong.

3. Don't start with all four

The full setup fits a project with a production deployment and a few months of history. On day one it is too much, and a scaffold you don't maintain is worse than no scaffold — a stale runbook gets followed, a stale spec gets believed.

Add each kind when you feel its absence:

Add When
CLAUDE.md Day one. Always. Even a 20-line one pays for itself in the first afternoon.
docs/adr/ The first time you make a choice you'd have to defend in three months — a framework, a database, an auth model.
docs/runbooks/ The first time you deploy from memory and get a step wrong. Or the first time someone else needs to.
docs/specs/ When work gets planned before it's built — because a second person is involved, or because the agent keeps building the wrong thing.
Summaries When someone outside the project needs to understand it. Not before.

Most solo projects live happily at CLAUDE.md + docs/adr/ for a long time. That's not a failure to adopt the method; that's the method working.

4. The loop

Once all four kinds exist, work runs like this:

1. Spec      the module in docs/specs/           → review
2. ADR       if the work hits a trigger          → review    (before the code, not after)
3. Plan      the implementation (plan mode)      → review
4. Implement on a branch when there is a spec
5. Review    and test
6. Close     ADR → Accepted, spec → Implemented,
             update the runbook if a procedure changed,
             update the index of anything you added
7. Commit    with Conventional Commits

Three review gates before any code is written. That is the point. With an agent, the cost of writing the wrong thing is near zero and the cost of reviewing the wrong thing is your whole afternoon — so the leverage sits entirely in steps 1–3.

Step 2 is where people slip. It is tempting to implement first and write the ADR afterwards, because then you know what you built. But an ADR written after the fact reconstructs a decision rather than recording it, and it will quietly agree with whatever you happened to do. Write it while the alternatives are still open — the ## Alternatives considered section is worthless otherwise.

5. What's in this repository

.
├── CLAUDE.md                  ← the entry point. The only file the agent always reads.
├── README.md                  ← this guide. Delete it when you start your project.
├── .claude/skills/grill-me/
│   └── SKILL.md               ← the interview that starts a project. See section 6.
└── docs/
    ├── README.md              ← formats, templates, index rules. The agent reads this when pointed at it.
    ├── adr/
    │   ├── README.md          ← index + status table. Source of truth for what exists.
    │   ├── TEMPLATE.md        ← copy this to start
    │   └── 0001-sqlite-for-link-storage.md      ← worked example
    ├── specs/
    │   ├── README.md          ← index + status ladder
    │   ├── TEMPLATE.md
    │   ├── 00-shortlink.md                      ← worked example: the project brief
    │   └── 01-link-shortening.md                ← worked example: a module spec
    └── runbooks/
        ├── README.md          ← index + shared conventions
        ├── TEMPLATE.md
        └── 01-deploy.md                         ← worked example

The four worked examples describe the same imaginary project — a URL shortener — so you can see how a brief, an ADR, a spec and a runbook relate to each other rather than reading four disconnected samples. Read them in that order; each one refers to the last. Delete them once you've read them.

What each file is for

File Purpose Who reads it
CLAUDE.md Behavioural rules + the triggers for each document kind The agent, on every request
docs/README.md Formats, the four kinds, precedence, where the loop lives The agent when pointed there; humans browsing
docs/*/README.md Index. What exists, its status, the rules for that kind Anyone looking for a document
docs/*/TEMPLATE.md The shape of a new document, with prompts explaining each section Whoever writes the next one

The indexes are not optional. An index is what makes a folder navigable instead of a pile. It is also the only place a status lives — an ADR header that says Accepted and an index that says Superseded by 0007 is a contradiction, and the index wins. Adding a document without updating the index is the single most common way this setup rots.

6. Using it on a new project

  1. Copy this repository's contents into your project (or clone it as a starting point).
  2. Delete this README.md — your project's README is a summary of your project, not this guide.
  3. Delete the four worked examples in docs/adr/, docs/specs/, docs/runbooks/, and empty the index tables.
  4. Run /grill-me and answer the questions.
  5. Delete the parts of CLAUDE.md for kinds you aren't using yet (see section 3).
  6. Start working, at step 3 of the loop.

That's it. There is no tooling, no CI check, no linter. The whole thing is markdown files, one interview, and the discipline to keep the indexes honest.

/grill-me — where projects actually start

The four kinds all begin after you know what you're building. A spec presupposes you know what the module is; an ADR presupposes you know what you're choosing between. The step before that — a vague idea turning into something buildable — is where most projects go wrong, and it's the step an agent will happily do for you, badly.

So the skill interviews you instead. Five questions, pushback when an answer is too vague to build against, and then it writes:

  • docs/specs/00-<project>.md — the brief: who it's for, one concrete moment where it works, what it deliberately won't do
  • docs/adr/… — one ADR per irreversible decision, Proposed where you haven't actually decided
  • docs/specs/01-<module>.md — the first slice
  • the spec trigger in CLAUDE.md, which you now know enough to write

It is allowed to refuse. If you can't say who it's for or describe one moment where it works, it stops and tells you what to go find out. That's a real outcome — a skill that always produces a plan produces bad plans, and the confident-sounding wrong plan is the expensive failure mode of working with an agent.

The 00-shortlink.md example is what its output looks like.

7. How this goes wrong

Each of these is a real failure mode, not a hypothetical.

Failure What it looks like Fix
Docs the agent never reads Everything is in docs/, CLAUDE.md is empty, and you repeat the same instruction in chat every day Move the trigger into CLAUDE.md; leave the detail in docs/
CLAUDE.md bloat It grows to 300 lines, the agent skims it, and every request pays for it Keep triggers, move everything else out. If it duplicates docs/README.md, delete one copy.
Stale index A new ADR exists, the index doesn't know Update the index in the same commit. Non-negotiable.
Edited ADR Someone "corrects" an accepted ADR's Decision to match what was actually built Write a superseding ADR instead. Fixing a typo is fine; changing what the decision was is not.
Spec written from the code A spec produced by reading the implementation. It agrees with the code by construction and can therefore never contradict it — so it can never catch a bug Write specs from intent, before the code. For existing modules, record the gap honestly instead of back-filling.
Summary drift The README explains the deploy steps, and so does the runbook, and they disagree The runbook is authoritative. The README links to it.
Adopted wholesale, maintained never All four kinds on day one, all stale by week three Section 3. Add each kind when you feel its absence.

8. Precedence

When two documents disagree:

  • An ADR beats everything. It is the record of a decision that was actually made.
  • On scope, a spec's acceptance criteria beat CLAUDE.md — don't trim agreed scope in the name of simplicity.
  • On process and style, CLAUDE.md wins.
  • A summary never wins. It's derived.

And when you find a conflict, fix the document. Working around it silently is how the next person inherits a contradiction with no record of which side was right.


Why this is worth the effort with an agent specifically

Plain good practice, all of it. None of this was invented for AI. What changes with an agent is the economics:

  • Writing is cheap, reviewing is not. The bottleneck moves to deciding what to build. Specs and ADRs are exactly the artefacts that make that decision reviewable before the code exists.
  • The agent has no memory between sessions. Your documentation is its long-term memory. A decision that only exists in a chat log from last Tuesday effectively does not exist.
  • The agent will confidently do the wrong thing if the right thing isn't written down. It won't push back on a convention it has never seen.
  • Stale docs mislead an agent harder than they mislead a person. A developer reading a runbook that describes last quarter's process notices something is off. An agent follows it.

That last point is the reason for every "keep the index honest" rule in this repository. The discipline isn't bureaucracy — it's the thing that keeps your agent from acting on a document that stopped being true.