CommunityProductivity & Collaborationgithub.com

maintaining-project-docs

Place and update a project's documents (README, AGENTS.md/CLAUDE.md, CHANGELOG, ROADMAP, AUDIT, docs/). Fires BEFORE declaring done any task that merged a batch, shipped, audited, changed direction, or changed how the project is built, run or configured.

What is maintaining-project-docs?

maintaining-project-docs is a Claude Code agent skill that place and update a project's documents (README, AGENTS.md/CLAUDE.md, CHANGELOG, ROADMAP, AUDIT, docs/). Fires BEFORE declaring done any task that merged a batch, shipped, audited, changed direction, or changed how the project is built, run or configured.

Works with✓Claude Code✓Codex CLI✓Cursor✓Gemini CLI
npx skills add https://github.com/Martingale42/cy-skills/tree/HEAD/skills/maintaining-project-docs

Installed? Explore more Productivity & Collaboration skills: steipete/gemini, steipete/gh-issues, steipete/skill-creator · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Maintaining Project Documentation

Overview

Two families of documents drift for different reasons, so they have different rules:

  • Lifecycle docs (root): ROADMAP.md, CHANGELOG.md, AUDIT.md. They drift because update triggers were never defined: a session establishes a convention, the session ends, the convention evaporates, and the next run reverse-guesses it and guesses wrong.
  • Knowledge docs (docs/): guides, concept/architecture docs, reference, reports. They drift because nothing structurally binds them to the code.

Open work is not a document this skill keeps. It lives in the tracker that ~/.claude/skills/ticketing/references/tracker.md defines, issues or ticket files, and moving it through its states is triage's job, user-invoked, so that sitting is the owner's to open. This skill writes a deferred item into the tracker and stops there.

The canonical rule

Every mechanism here is one move: name a single canonical source, and make every other copy derived: copied, generated, or symlinked. Drift is what happens when two copies can both be hand-edited.

What driftsCanonicalHow the derived copy stays honest
Doc formats across projectstemplates/*.template.mdcopied verbatim by scaffold-docs.sh
API referencerustdoc / docstringscompiler + doctests
Translationsthe declared source-language docregenerated at each release sweep
Agent instructionsAGENTS.mdCLAUDE.md is one line, @AGENTS.md, importing it
A finding's evidenceits docs/audits/ reportthe tracker item, in the tracker reference's shape, links the report instead of copying its measurements
Doc and comment shapescripts/doc-lint.py in the projectthe hook, prek and CI all call that one script

Authoring or restructuring any doc this skill owns starts by opening the matching templates/*.template.md and following its section order. Placeholders are <ANGLE_BRACKET>; the <!-- HINT … --> comments go away once filled.

scripts/scaffold-docs.sh <project-dir> [--agent] [--audit-report <scope>] copies those templates in verbatim without clobbering. Use it for new-project bootstrap and for dropping a fresh audit-report shell.

When this fires

landing runs this on the branch before it merges, so the doc rewrites and the CHANGELOG line travel with the merge; the table is the same check for work that lands any other way. Before you declare a task done, touch what each row the task matches names:

Trigger eventTouch
Merge a fix/feature batchCHANGELOG [Unreleased]: one line per change someone using or working on the project sees · re-verify every knowledge doc whose Updated: stamp predates the batch · each item the batch deferred goes to the tracker in needs-triage
Ship a crate / cut a releaseROADMAP: rewrite the item's status sentence and the Updated line · CHANGELOG version section + tag · doc freshness sweep
Complete an audit / re-auditnew report in docs/audits/ + AUDIT index row · each open finding to the tracker in needs-triage, linking its report · ROADMAP quality-history line
Change direction / decide a gaterewrite the affected ROADMAP section
A design doc shipsdistill the durable parts into docs/concepts/; the design doc itself is not edited
Edit user-facing docs (guide/concept/reference)place per the docs/ layout · update the doc's Updated: stamp · regenerate any translation
Change how the project is built, tested, run or configuredREADME: rewrite the affected how-to · AGENTS.md Commands block, each command run first (Family 3) · never a dated note in either
Start a new project, or change a project-specific conventioncreate or update AGENTS.md per Family 3

Every action above is a rewrite of the affected text. The only document that appends is CHANGELOG, and it appends one line. A "docs: record the round" commit that grows README or ROADMAP is the failure this table exists to prevent, and scripts/doc-lint.py (see Enforcement) rejects the shapes it produces.

A deferred item is written in the needs-triage shape the tracker reference gives, into the tracker form it picks for this repository, and its evaluation is left to the triage sitting. A repository that still carries an older append-only list sends new items to the tracker all the same; folding the old list in is triage's one-time pass, which only the owner starts.

If none of the rows apply, this skill is not needed.


Family 1 — Lifecycle docs (live in repo root)

Root, not docs/: these are the project dashboard, meant to be the first thing a reader sees.

Roles (one sentence each; keep them distinct)

DocRoleMutability
ROADMAP.mdThe map: direction, vision, layer/status, gates, sequencing, and the development process. An item's status is one sentence using two words only: code complete (merged) or accepted, in the sense landing defines: the spec's verification step passedLiving: rewrite whole sections freely
CHANGELOG.mdWhat shipped (Keep a Changelog format)Append-only; a released section is immutable
AUDIT.mdThe audit index; each full report is an immutable file in docs/audits/Index is living; the reports it points to are frozen

When the spec's verification step can only run after deploy, the status stays code complete and the sentence names the pending step in the spec's words.

AUDIT rules (index + frozen reports)

  • A completed audit writes its full report to docs/audits/YYYY-MM-DD-<scope>.md: verdict, method, and every finding with its mechanism / measurement / evidence. That file is immutable once written: a later re-audit gets its own file, never an overwrite.
  • Root AUDIT.md is an index table: Date | Scope | Verdict | Open findings | Report.
  • A re-audit is a new report. Its measurements stay in that report; the tracker item links the report rather than copying them, so the evidence has one home.
  • Templates: templates/AUDIT.template.md (the index), templates/audit-report.template.md (each report).

CHANGELOG rules

  • The merge that changes what someone using or working on the project sees (behaviour, a command, a configuration key) updates [Unreleased] in the same commit. A separate "update the changelog later" step is a missed step.
  • One entry, one line: what changed and where, as that reader sees it. The why is the commit message's job, the evidence is the report's. CHANGELOG is the only lifecycle doc that appends, which is exactly why each append is small.
  • At release: move [Unreleased] into a [x.y.z] — YYYY-MM-DD section, create the matching VCS tag, and point the compare/release footer links at the real remote.
  • Frozen public contracts (e.g. a pinned RNG bit-stream) get a standing note at the top stating that any change to them is a semver-major event.
  • Template: templates/CHANGELOG.template.md.

Family 2 — Knowledge docs (live under docs/)

Layout (Diátaxis-derived — classify by reader intent)

docs/
  guides/      how-to: deployment, trading manual, runbooks, migration guides
  concepts/    explanation: architecture, design rationale, mental models
  reference/   look-up facts that live outside the code: file formats, fixture
               schemas, config-key catalogues
  reports/     dated, immutable deliverables: investor report, feasibility study
  plans/       one job's design doc and its tickets, as
               YYYY-MM-DD-<topic>-design.md and YYYY-MM-DD-<topic>-tickets.md,
               plus out-of-scope.md, the rejections triage keeps
  reviews/ qa/ audits/ benchmarks/ sessions/   process trail (as-is)
  • API reference is rustdoc / docstrings, canonical in the code, where doctests keep the examples honest and the compiler flags drift. A docs/reference/api.md restating signatures has no canonical source, so it rots.
  • A design doc in docs/plans/ is a write-once historical record. When it ships, distill the durable parts into a docs/concepts/ doc, which becomes the living current truth.
  • Every living knowledge doc opens with Updated: YYYY-MM-DD (@<commit>).

Bilingual policy

The canonical rule applied to language. Each document declares one canonical-language source, chosen by audience (investor/ops-facing → per project norm; developer-facing → English). Translations are derived: regenerate them from the canonical source at each release sweep. Name them <name>.<lang>.md (e.g. deployment.zh.md) so the canonical/derived relationship reads off the filename. A single-audience doc keeps one file.


Family 3 — Agent instruction files and README (project root)

The operating brief for the next agent session, the one reader that is you, next time.

  • AGENTS.md is canonical. It is the file Codex, Cursor and Gemini CLI read on their own; Claude Code reads CLAUDE.md, so that file is one line, @AGENTS.md, importing it. One source, every tool. Claude-only material (a .claude/rules/ pointer, a skill name) goes below the import line in CLAUDE.md, and almost nothing qualifies.
  • Content rule: only what is UNIQUE to this project and NOT derivable. The highest-ROI section is the exact command block: agents burn tokens guessing whether it's cargo test or uv run pytest. Everything else points rather than duplicates: architecture → docs/concepts/ + ROADMAP.md. Whatever is global already applies from ~/.claude/CLAUDE.md.
  • README.md is for humans: quick start, configuration, where things are. It is rewritten when those change and holds no dates, rounds or history: an operational narrative belongs in docs/guides/, a change in CHANGELOG. A README that collects session notes stops answering "how do I run this" within a few rounds.

Template: templates/AGENTS.template.md + templates/CLAUDE.template.md (or scaffold-docs.sh … --agent). Sections: What this is · Commands · Architecture · Project-specific conventions · Gotchas · Lifecycle docs.

The next-session test

Every line earns its place by one question: remove it — does the next session take a wrong turn, one you would have to step in and correct? Keep the line if yes. Everything else is load the project pays for on every single turn.

The test has teeth because it asks about a wrong turn, not about usefulness. Plenty of true, interesting facts pass "useful" and fail this.

Writing one

  1. Read the ground truth first: build manifests (Cargo.toml, pyproject.toml, package.json), the CI config, README.md, and any existing agent file. Facts come from these, never from inference.
  2. Run every command you intend to write. The command block is the highest-ROI section and a wrong invocation there misleads every future session. Done when each line has been executed once in this project and its output seen; no line arrives by pattern-matching from another repo.
  3. Draft from templates/AGENTS.template.md, section by section, deleting the <!-- HINT --> comments as you fill them.
  4. Apply the next-session test to every line, including ones you just wrote.
  5. Sweep the failure modes below. Done when each has been checked against the draft. A file that still runs long is almost always carrying material that belongs somewhere else, so a long one gets a second pass with that question.

Failure modes

  • Restating the global file: anything in ~/.claude/CLAUDE.md already applies to this project. Repeating it doubles the cost and creates two places to edit.

  • Restating a skill's description: a model-invoked skill's description is already in every window; naming its triggers again is duplication.

  • Always-on material only some tasks need: a section that matters to one kind of work belongs in a skill or a docs/ doc the file points at.

  • Unverified commands: an invocation copied from a sibling project, or from memory of how this stack usually works.

  • A rule where a fact would do: "use the semantic index for code search" is a rule that fires even when grep is the better move; "this repo has a semantic code index" is a fact the agent can act on with judgement. Prefer the fact.

  • Maintenance: update Commands when an invocation changes; add a line when a new convention or gotcha is found; refresh Architecture pointers on structural change.

  • Legacy / missing files are migrated on touch, not in a sweep: the next task that lands in a project brings its agent file up to template.

  • /init produces a first draft; trim it to the template and then maintain it. A generated file left unpruned rots as fast as no file at all.


Enforcement — the shapes are checked, not requested

Instruction files and skills are advisory: a rule the model can ignore will be ignored the day it is inconvenient. What holds is a check that runs where the writing happens.

  • scripts/doc-lint.py (template: templates/doc-lint.template.py) lives in the project and checks: the ROADMAP Updated line and per-item status length, CHANGELOG entry length, README prose length and dated history sentences, design-doc write-back sections, and in source files consecutive-comment-block length and comments that cite a task, round, ticket or commit. Every limit carries the commit it was measured on; scripts/doc-lint-measure.py re-derives them. A limit with no provenance is a guess, and the template's starting values are somebody else's measurements, so re-measure before the project's first release.
  • Change-scoped by default. --diff, --base REF and --from-hook report only findings the change introduced, matched against the base by rule and offending line. A tree carrying old debt is gated on "adds none" while the debt is cleared in its own sub-project; --all reports everything for that job.
  • Three callers, one script. .claude/settings.json (template: templates/claude-settings.template.json) runs it as a PostToolUse hook on Write|Edit (exit 2 feeds the reason back to the model, which fixes the file in the same turn) and as a Stop hook over the diff. The project's pre-commit config and CI lint job call the same script, so a human edit is held to the same shape. Keep .claude/settings.json and .claude/rules/ tracked; only .claude/settings.local.json is personal.
  • .claude/rules/docs.md (template: templates/docs-rule.template.md) is the four-line statement of the shapes, path-scoped to the lifecycle docs so it costs nothing until one of them is opened.

New-project bootstrap

When a project first grows past a README, run:

scripts/scaffold-docs.sh <project-dir> --agent

It drops ROADMAP.md, CHANGELOG.md, AUDIT.md, and (with --agent) AGENTS.md, CLAUDE.md, .claude/rules/docs.md, .claude/settings.json, scripts/doc-lint.py and scripts/doc-lint-measure.py from the templates, verbatim and without clobbering. Then fill the <PLACEHOLDERS> (the Commands block of AGENTS.md first, it has the highest ROI), wire doc-lint into the project's pre-commit and CI, and re-measure its limits before the first release. Open work needs no root file: the first deferred item goes wherever the tracker reference sends it.

Add each docs/ subfolder when its first document exists (YAGNI). AUDIT.md starts as a bare index header; its first row is added when the first audit lands.

Individual skills in this repo

This repo contains 3 individual skills — each has its own dedicated page.

Related Skills