adr-writer
Skill1 starsChanged 2 months agoMITView on GitHub
Record a design decision as an Architecture Decision Record (ADR) in the project's `docs/adr/` directory. Use this skill whenever the user says "let's ADR this", "record this decision", "write an ADR for X", or when context-sync Phase 3 needs to extract a buried decision. The skill resolves the target ADR directory from cwd, picks the next sequence number with no collision, writes the 7-section body (incl. `Review-when` expiry conditions) in the main loop, runs the mechanical evidence and the adr-reviewer, and updates the ADR index. Also the canonical place for the filing bar — an ADR is written only for a mechanism / gate / threshold / agent-tier change that other artifacts cite, or for superseding / annotating a prior ADR; everything else goes into the commit body. Works across any repo — auto-detects or creates `docs/adr/` from the repo root.
10 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- shimo4228/claude-harnessedited, first seen Sep 27, 2026
- llopresto87/Cypresstheir own version, first seen Sep 22, 2026
- imtiazrayhan/agentscamp-librarytheir own version, first seen Aug 25, 2026
- codebygarv/Ai-skillstheir own version, first seen Aug 16, 2026
- kuju63/skillstheir own version, first seen Aug 1, 2026
- brpaz/agent-skillstheir own version, first seen May 17, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- shimo4228/claude-harness★ 398% same
Wrote their own version · 9
- oxbshw/LLM-Agents-Ecosystem-Handbook★ 550same name
- llopresto87/Cypress★ 95same name
- 45ck/software-architecture-skills★ 26same name
- codebygarv/Ai-skills★ 26same name
- brpaz/agent-skills★ 1same name
- imtiazrayhan/agentscamp-library★ 1same name
- michelve/hugin-cowork★ 1same name
- kuju63/skills★ 0same name
- michelve/hugin-v0★ 0same 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 repository18 other files it gives its agents.
- llms-full.txtllms.txt
- llms.txtllms.txt
- agent-stocktakeSkill
- author-calibrated-evalSkill
- context-syncSkill
- generation-auditSkill
- harness-boundarySkill
- jev-judgment-designSkill
- learn-evalSkill
- llm-as-judgeSkill
- repo-asset-stocktakeSkill
- review-to-lintSkill
- rules-distillSkill
- rules-stocktakeSkill
- search-firstSkill
- skill-complySkill
- skill-healthSkill
- skill-stocktakeSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 9 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
9
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Write an ADR when at least one holds:
- Very specific: line 46
If $ADR_DIR does not exist, create it — the ADR request itself covers the directory, and git makes it reversible.
- Distinctive: line 108
Verify uniqueness right before writing (race safety):
- Very specific: line 114
If COLLISION, recompute NEXT_NUM from the latest state.
- Distinctive: line 118
Ask the user (or accept from caller) for:
- Distinctive: line 128
If 3-7 are missing, request them — do not proceed.
- Distinctive: line 130
Preventive check (before settling the packet): Read references/review-findings.md (a dated casebook of frequent review findings) and …
- Very specific: line 141
Read the 2 most recent ADRs in $ADR_DIR for house style (heading form, link style, whether Consequences splits into Positive / Negative / …
- Distinctive: line 147
Every Context fact, Decision clause, rejection reason and Consequence comes from the packet.
- Distinctive: line 155
If a packet field is missing, stop and ask.
- Very specific: line 168
When you want an ad hoc blocking verdict, add --gate.
- Very specific: line 190
Before commit, launch agent: adr-reviewer and hand it the ADR you just wrote — do not skip this.
- Very specific: line 195
After Step 4 writes the file, append a row to $ADR_DIR/README.md index table:
- Distinctive: line 203
If the index table is malformed or absent, regenerate it from the directory:
- Distinctive: line 244
Do not: commit the file. The user owns the commit step.
“Common” is measured: kept by at least 6 in 10 of the 9 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
ADR Writer
Capture a design decision as a numbered ADR with consistent structure. The skill handles the boilerplate (directory detection, sequence numbering, index update) in scripted steps, and the main loop writes the prose.
Why the main loop writes
Deterministic concerns — where the ADR goes, what number it gets, which index needs updating — are easy to get wrong silently (number collisions, sub-directory cwd confusion, index drift), so they live in scripted steps. The prose is written by the main loop that holds the decision: rendering to the house template is cheap for it, and the decision packet (Step 3) is the discipline that keeps decide and render apart — the packet is settled first, the file is a faithful expression of it, nothing is inferred while writing. That principle is ADR-0016 (writer agents render, they do not decide), applied in the main loop per ADR-0072; the evidence script (Step 4.5) is the fidelity check.
When to Use (filing conditions — canonical)
Write an ADR when at least one holds:
- The change moves a mechanism, gate, threshold, or agent tier that other artifacts cite (a hook, a lint boundary, a chain step, a rule's default, a model pin) — the ADR is what those artifacts point at
- The decision supersedes or partially weakens a prior ADR (a Status flip or a dated Note is needed on the old one)
Entry points: the user says "let's ADR this" / "record this decision", context-sync Phase 3 surfaced a buried decision, a debate concluded and the outcome must outlive the session. Apply the two conditions to the request; when neither holds, say so and use the commit body.
When NOT to Use — the commit body carries it
Everything else is recorded in the commit body, in three lines, so git log --grep finds it later:
Context: <what was observed, with its source>
Decision: <what changed, as a commitment>
Review-when: <the observation that would void it, or "none — record">This covers bug fixes, reversible refactors, wording changes to rules / skills that nothing else cites, stocktake outcomes (retire / keep verdicts — the stocktake's own results file plus the commit), and personal preferences. When a commit-body decision later gets superseded or cited by another artifact, promote it: write the ADR then, quoting the commit.
Workflow
Step 1: Resolve the ADR directory
REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || REPO_ROOT="$(pwd)"
ADR_DIR="$REPO_ROOT/docs/adr"If $ADR_DIR does not exist, create it — the ADR request itself covers the directory, and
git makes it reversible. Mention the creation in your final report. Write a minimal
README.md index alongside:
# Architecture Decision Records
## Index
| ADR | Title | Status | Date |
|-----|-------|--------|------|
## Template
ADRs in this repository use the 7-section template
(`scripts/adr_lint.py` checks section presence mechanically):
```markdown
# ADR-NNNN: [Title]
## Status
accepted | superseded | deprecated
## Date
YYYY-MM-DD
## Context
[what was the problem]
## Decision
[what was decided]
## Review-when
[expiry conditions — an ADR is a dated hypothesis, not a permanent constraint]
## Alternatives Considered
[rejected options and why]
## Consequences
[what becomes easier / harder]
```
File name: `NNNN-kebab-case-title.md` (zero-padded 4-digit sequence).
Index rows link the number: `| [NNNN](NNNN-slug.md) | Title | status | YYYY-MM-DD |`.(Index rows make the number a relative link — the same form as existing indexes such as harness / CA.
adr_lint.py reads the expected section set from this README's Template fenced block, so
placing the README doubles as the lint's template declaration.)
Step 2: Pick the next sequence number
LAST_NUM=$(ls "$ADR_DIR"/[0-9]*-*.md 2>/dev/null | sort -V | tail -1 | sed -E 's|.*/([0-9]+)-.*|\1|')
if [ -z "$LAST_NUM" ]; then
NEXT_NUM="0001"
else
NEXT_NUM=$(printf "%04d" $((10#$LAST_NUM + 1)))
fiVerify uniqueness right before writing (race safety):
[ -e "$ADR_DIR/$NEXT_NUM-"*.md ] && echo "COLLISION" || echo "OK"If COLLISION, recompute NEXT_NUM from the latest state.
Step 3: Gather the 7 inputs
Ask the user (or accept from caller) for:
- Title — short, kebab-case-friendly (e.g.,
context-sync-cascade-and-writer-agents). The skill will compose the filename. - Status —
proposed | accepted | superseded | deprecated. Defaultaccepted. - Context — what problem prompted this decision (raw text OK).
- Decision — what was decided (raw text OK).
- Review-when — the expiry conditions: which observation or premise failure would void or weaken this decision, 1-3 lines. It can only be captured at write time (ADR-0021); an ADR without it reads as permanent. If there genuinely is none, say so explicitly and write "none — a record, not a permanent decision".
- Alternatives — what else was considered and why rejected, or, for an alternative that stays live, "Open — revisit when: …" (raw text or list). Keeping a rival open is allowed; a straw man is not.
- Consequences — what becomes easier / harder (raw text or list).
If 3-7 are missing, request them — do not proceed. ADRs without these sections are noise.
Preventive check (before settling the packet). Read references/review-findings.md (a dated casebook of frequent review findings) and self-check against the matching patterns — cited ADRs exist and say what is cited, where surviving scope is placed, provenance of coined terms, grounds for judging full vs partial supersede, references to gitignored paths, sources and denominators of numbers, what is held fixed in count conditions. This is write-time prevention, not a substitute for semantic review — do not skip the adr-reviewer before commit.
Assemble and approve the decision packet before writing. Settle the actual content here: the real Context, the decision as decided, the Review-when triggers, why each Alternative was rejected (or under what condition it is revisited), which Consequences genuinely follow. Confirm this packet with the user (especially the Review-when, the rejection reasons and both sides of Consequences) before Step 4 — Step 4 expresses the packet and adds nothing, so a fuzzy decision is resolved here.
Step 4: Write the file (main loop)
Read the 2 most recent ADRs in $ADR_DIR for house style (heading form, link style, whether
Consequences splits into Positive / Negative / Neutral), then write
$ADR_DIR/$NEXT_NUM-<title>.md from the Step 3 packet:
- Heading
# ADR-NNNN: <title>, then the 7 sections in template order (Step 1's template, or the repo's owndocs/adr/README.mdTemplate block when it differs) - Every Context fact, Decision clause, rejection reason and Consequence comes from the packet. Writing is expression, not synthesis — a consequence that feels "logically entailed" but is not in the packet goes back to Step 3 for the user to approve, not into the file
- Decision in imperative voice ("do X", "pin X to Y"); Review-when as observable triggers; each Alternative with its rejection reason or "Open — revisit when: …"
- Links to sibling ADRs are relative (
./NNNN-slug.md) and the file name is copied fromls, not typed from memory — Step 4.5'srefs.links_brokenis the check
If a packet field is missing, stop and ask; do not write a partial ADR.
Step 4.5: Run the mechanical lint and the per-ADR evidence
python3 ${CLAUDE_PLUGIN_ROOT}/skills/adr-writer/scripts/adr_lint.py --root "$REPO_ROOT"Evidence mode (no verdict, exit 0). In the output JSON, fix the deviations in the ADR you just wrote (missing_sections / case_mismatch / status / date / index / naming) before moving on. Deviations in existing ADRs are report-only — do not fix them in this step (separate task). The lint covers mechanical properties only and is not a substitute for semantic review (adr-reviewer).
When you want an ad hoc blocking verdict, add --gate. The exemption boundaries are unbounded by
default, so pass per-repo values — harness uses --sections-from 44 --require-review-when-from 44
(exempting ADR-0009's two missing sections and the absent Review-when in 0043 and earlier, ADR-0051).
Next, take the per-ADR evidence for the one ADR you just wrote (ADR-0071 — the machine-countable part of the findings adr-reviewer repeated across 24 reports):
python3 ${CLAUDE_PLUGIN_ROOT}/skills/adr-writer/scripts/adr_review_evidence.py --root "$REPO_ROOT" --adr "$NEXT_NUM" --diff worktreeFix here what can be fixed at write time in the JSON — refs.unresolved (ADR / RFC numbers that do not exist),
refs.links_broken, missing (nonexistent paths) and ignored (gitignored evidence — promote it to
docs/evidence/ or rewrite to be path-independent) in paths.flagged, paths.line_refs_out_of_range,
numbers.percent_without_denominator, numbers.relative_referents (conversation references),
and targets in relations.targets whose annotation_lines is empty (the Note on the old ADR — the
partial weakening row of the Edge cases table). If diff_scope.changed_not_mentioned lists changes the ADR
does not mention, write them into the Decision or split them into a separate commit. The remaining keys
(numbers.unanchored, review_when, alternatives, consequences, second_record) need judgment and go to the Step 4.6 reviewer.
Step 4.6: Run the semantic review (adr-reviewer)
Before commit, launch agent: adr-reviewer and hand it the ADR you just wrote — do not skip this.
This skill is the only wiring for adr-reviewer (ADR-0055). The main loop accepts or rejects each finding against the Step 3 packet, and fixes only the accepted ones.
Step 5: Update the index
After Step 4 writes the file, append a row to $ADR_DIR/README.md index table:
# Read current index
# Find the table block (lines between the "| ADR |" header and the next "##" heading)
# Append: | [$NEXT_NUM]($NEXT_NUM-<slug>.md) | <title human-readable> | <status> | <date> |If the index table is malformed or absent, regenerate it from the directory:
for f in "$ADR_DIR"/[0-9]*-*.md; do
num=$(basename "$f" | sed -E 's|([0-9]+)-.*|\1|')
title=$(head -1 "$f" | sed -E 's|^# ADR-[0-9]+: ||')
status=$(awk '/^## Status/{getline; getline; print; exit}' "$f")
date=$(awk '/^## Date/{getline; getline; print; exit}' "$f")
echo "| [$num]($(basename "$f")) | $title | $status | $date |"
doneStep 6: Report
Tell the user:
ADR written
---
File: docs/adr/<NNNN>-<title>.md
Number: <NNNN>
Status: <status>
Index: updated (+1 row)Edge cases
| Case | Handling |
| Called from a sub-directory of the repo | Use git rev-parse --show-toplevel; never trust raw cwd |
| Not a git repo | Fall back to cwd, warn the user that they should git init |
| ADR number was reserved verbally but not yet written ("I'll write ADR-0010 later") | Skill cannot know; ask the user whether to take the next free number or the reserved one |
| User wants to supersede an existing ADR | Update the old ADR's Status to superseded by ADR-NNNN, then create the new one. Two file writes. |
| New ADR partially weakens an old one (a premise expired, a Review-when trigger fired) but does not supersede it | Do not flip Status. Append under the affected section of the old ADR: > **Note (YYYY-MM-DD, ADR-NNNN)**: <what changed and what still stands>. Never delete the original text — the strength history stays readable in place (precedents: ADR-0018 §Consequences, ADR-0028). Do this after Step 4 has written the new file. |
| Title contains spaces or non-ASCII | Skill normalizes to kebab-case ASCII for the filename; preserves original in the # ADR-NNNN: ... heading |
Boundaries
- Do not invent missing sections. Refuse to write an ADR with
Context: [TBD]or similar placeholders. - Do not modify ADRs other than the new one and (optionally) the index, except the two explicit main-loop steps above (Status flip on full supersede; dated Note on partial weakening).
- Do not infer the user's decision from chat history without confirming. Ask, even if the answer feels obvious.
- Do not commit the file. The user owns the commit step.
Reference Files
- ADR template canonical source: read the target repo's existing ADRs to mirror their voice. For the harness itself, see
~/.claude/docs/adr/README.md. - Mechanical lint (evidence mode +
--gate):scripts/adr_lint.py(ADR-0051; adapts the template automatically from the repo'sdocs/adr/README.mdTemplate; tests aretests/test_adr_lint.py). - Per-ADR review evidence (evidence mode only):
scripts/adr_review_evidence.py(ADR-0071; cited references exist, Note reciprocity, path classification, diff scope, unsourced numbers; tests aretests/test_adr_review_evidence.py). This one file is the entry point for running and importing; the checks themselves are split acrossscripts/adr_evidence_common.py/_paths.py/_prose.py(the ADR-0056 file-LOC budget). - Casebook of frequent review findings:
references/review-findings.md(read during the Step 3 preventive check). - Evals:
evals/evals.json(3 scenarios — new ADR / missing docs-adr / sequence collision).
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.

