Rzemiosło · The Craft
What is The CraftLevelsGet startedChapters Search Download PLEN
Level 2 · Technical ~2 min read

In one sentence: Document for the AI agent, not for the archive: an AI_README in every folder, CLAUDE.md as the project’s constitution.

This chapter in plain terms

This chapter answers the question: how to document a project so the AI (and the next person) understand it without reading all the code. Documentation here isn’t an archive “for posterity” — it’s an instruction read every session.

There are three layers, each for a different reader:

  • CLAUDE.md — the project’s constitution: stack, how to run it, rules (“never Deploy — Releasing a new version of the app “live”, where real people use it. It’s the moment a change reaches real people — which is why it happens only on an explicit “deploy”. more in the glossary → without approval”). The assistant reads it at the start of every conversation.
  • AI_README — A map file in every code directory: what’s here, what it’s for and what to watch out for — written for search. The assistant finds the right file with one search instead of reading the whole directory. more in the glossary → in every important folder — a map: what’s here, what to watch for. You read it before you touch the code in that folder.
  • docs/ — heavier reference (architecture, database schema) and plans.

(README.md is something else — the public “front door” on GitHub, not the place for Maintenance window — A short, planned period when users see a “work in progress” page while the database or configuration changes behind it. It guarantees the app never runs, even briefly, on half-changed data. more in the glossary → details.)

The most important habit: update the docs together with the code, not “at the end” — because the end never comes, and stale docs start to lie. And write AI_README dense with keywords, so you can quickly “grep” a topic in it instead of reading everything.

Example: a good AI_README entry warns about a trap invisible from the code — e.g. “Facebook doesn’t render WebP — A modern image format, noticeably lighter than JPG or PNG at the same quality. Lighter images mean a faster page — especially on a phone. more in the glossary → as Open Graph (OG) — Tags that decide how a link looks when pasted into Facebook, LinkedIn or a messenger (image, title, description). A good link card means more clicks — a bad one can show what you don’t want (e.g. a price). more in the glossary →”. Nobody would guess that reading the functions alone.

Read more: Markdown (CommonMark) · what is grep · project memory in Claude Code.

01 — Documentation and AI_README

Commandment I: document for the agent, not for the archive. The goal: the next session understands a directory without reading all of its code.

Three layers, split by reader

LayerFileHolds
ConstitutionCLAUDE.md (root)what the project is, exact run commands, policies that override default behavior, a dated “Current state” with numbers. Loaded every session.
Directory mapAI_README — A map file in every code directory: what’s here, what it’s for and what to watch out for — written for search. The assistant finds the right file with one search instead of reading the whole directory. more in the glossary → in every directory with codemodule Index (database) — A lookup in the database that makes searching instant instead of scanning everything in order. The first move for slow queries — like an index at the back of a book instead of reading 400 pages. more in the glossary →, key APIs (signature + contract), gotchas, numbers, the grep index. Read before touching that directory.
Reference / plansdocs/architecture, data model, Runbook — A written step-by-step guide for production operations, with numbered lessons from incidents. The memory of outages can’t live in someone’s head — the next deploy starts by reading the runbook. more in the glossary →, plans/.

README.md is the public front door (what it is, how to start) — not a layer for the agent. Where does a fact go? Ask who reads it — and write it once; the other files link.

Rules

  1. CLAUDE.md points to the AI_README.md maps — without that pointer a new session doesn’t know they exist.
  2. AI_README.md is updated before the Commit — A saved, labelled point in the project’s history — a confirmation of a specific batch of changes. Small, described commits make a history you can return to any working state from. more in the glossary →, in the same commit as the code. A test enforces the index (every module named, size ceiling) → 17.
  3. Write the index for grep, not for reading. Keyword-dense one-liners: concrete names, synonyms, both languages if the project is bilingual. grep -i <topic> should hit one line pointing at one file.
  4. One file = one topic. A topic spread over five files is five hits and burned context.
  5. State, not intent. Describe what the code does now; delete entries for removed code — a dead entry is worse than none. Numbers (records, tests) go stale → update them.
  6. docs/ describes the current version only. History lives in git and the CHANGELOG; update the doc, don’t keep the old version beside it.
  7. docs/plans/ is a living backlog. Problem → options → choice → why. When a plan lands, fold the decision into the doc / CLAUDE.md it governs and delete the plan — git keeps the record.
  8. A new directory is created together with its AI_README.md — never “later”.
  9. Generated artifacts (HTML, Snapshot — A saved state of data from a specific moment — e.g. a database copy or a file of computed statistics. It speeds things up and keeps them safe, but is stale from the moment it’s taken — you need to know where fresh data comes from. more in the glossary →) are derivatives: commit them, never edit them by hand, regenerate on command (a skill), not on every commit.

Update the docs for: a new module/function/script/flag, a schema change, a behavior change (threshold, fallback), changed counts. Not for: a pure bugfix with no API — An agreed way for two programs to talk to each other — one asks, the other answers in a set format. Through an API your app connects to outside services (payments, maps, AI). Treat an API key like a password. more in the glossary → change, typos.

Anti-patterns

  • 🚫 “I’ll update the docs at the end” — the end never comes, the docs lie.
  • 🚫 An AI_README describing wishes instead of state.
  • 🚫 The same state copied into five files — one source of truth, the rest link.
  • 🚫 Generic descriptions (“helpers”, “various rules”) — grep misses, the agent reads everything.
Chapter deep-dive 01Why these rules, examples and stories from projects — what the core deliberately leaves out.

The canonical doctrine is written in English.