agentleFS
Sir-chawakornSir-chawakorn/sanook-cli/skills/write-adr/SKILL.md

write-adr

Skill9 starsChanged 5 months agoApache-2.0View on GitHub

Sanook captures a significant technical decision as a structured Architecture Decision Record (Michael Nygard format) — context, decision, alternatives considered, consequences — written to docs/adr/ as numbered files with an index.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Do NOT use for: reversible implementation details, code style nits, or decisions with no real alternative (those go in code comments or …

    line 15
  2. Very specific:

    Locate or create docs/adr/: Check whether the repo already has an ADR directory — common locations: docs/adr/, …

    line 21
  3. Very specific:

    Maintain the index: Keep docs/adr/README.md (or index.md) as a table: # | Title | Status | Date, one row per ADR, linking to each file.

    line 52
  4. Distinctive:

    All-positive Consequences: Every real decision has a cost (new dependency to maintain, lock-in, migration work).

    line 62

“Common” is measured: kept by at least 6 in 10 of the 7 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

When to Use

Invoke when a decision is being locked in and would be expensive to reverse or confusing to re-litigate later:

  • A choice was made between real options: "let's go with X instead of Y" — a stack, library, framework, datastore, protocol, pattern, or module boundary.
  • User explicitly says "record this decision" / "write an ADR" / "ADR this".
  • Reversing an earlier decision (the old ADR must be superseded, not silently deleted).

Do NOT use for: reversible implementation details, code style nits, or decisions with no real alternative (those go in code comments or commit messages, not an ADR). One ADR = one decision; if the prompt bundles several, split them.

Steps

  1. Name the decision and its trigger before writing. State it as a single sentence: "We will use X for Y, because Z." If you can't, the decision isn't ripe — ask which option won and why the alternatives lost. Capture the trigger (the problem/forcing function that made a decision necessary) — that becomes Context. If no genuine alternative was ever on the table, stop: it's not an ADR.
  2. Locate or create docs/adr/. Check whether the repo already has an ADR directory — common locations: docs/adr/, docs/architecture/decisions/, doc/adr/, adr/. Reuse the existing one and its filename convention; do NOT invent a parallel directory. If none exists, create docs/adr/.
  3. Assign the next sequential number. List existing files (ls docs/adr/), find the highest NNNN, add 1. Zero-pad to 4 digits. Filename: NNNN-kebab-case-title.md (e.g. 0007-use-postgres-for-event-store.md). Never reuse or renumber an existing ADR number — numbers are permanent IDs other ADRs link to.
  4. Write the record in Nygard format, exactly these sections in order:
    # NNNN. <Short imperative title>
    
    - Status: <Proposed | Accepted | Deprecated | Superseded by ADR-MMMM>
    - Date: <YYYY-MM-DD>
    
    ## Context
    <The forces at play: the problem, constraints, requirements, and assumptions
    that make a decision necessary. Factual and neutral — no solution yet.>
    
    ## Decision
    <"We will ..." — the choice, stated actively and unambiguously. One decision.>
    
    ## Alternatives Considered
    - **<Option A>** — <what it is> — rejected because <concrete reason>.
    - **<Option B>** — <what it is> — rejected because <concrete reason>.
    <Each real alternative + the specific tradeoff that lost it. "Do nothing" can
    be a valid alternative. If you list only the winner, you haven't justified it.>
    
    ## Consequences
    **Positive:** <what gets easier/safer/faster>
    **Negative:** <what gets harder, what we now must maintain, what risk we accept>
    **Neutral / follow-ups:** <new work this creates, things to revisit later>
    Status starts Proposed unless the decision is already final-and-shipped (then Accepted). Context describes why a decision is needed, not the decision. Consequences MUST include negatives — an ADR with only upsides is propaganda, not a record.
  5. Maintain the index. Keep docs/adr/README.md (or index.md) as a table: # | Title | Status | Date, one row per ADR, linking to each file. Append the new row; update the Status cell of any ADR whose status changed. Create the index if it's missing.
  6. On a reversal, supersede — never edit history. To overturn ADR-N: write a new ADR-M for the new decision, and in its Context reference ADR-N. Then change ADR-N's status line to Superseded by ADR-M (with a link) — do not rewrite ADR-N's body or delete it. Link both ways: new ADR points back to the one it replaces. Accepted ADRs are immutable except for the Status field.

Common Errors

  • Editing an accepted ADR's body to "update" a decision. Accepted ADRs are an append-only log. A change of mind is a new, superseding ADR — never a rewrite of the old one. Only the Status line of an existing ADR may change.
  • Reusing/skipping a number. Numbers are permanent references. Deleting ADR-0004 and giving 0004 to a new decision corrupts every link that pointed at the old one. Always take max + 1.
  • No real alternatives section. Listing only the chosen option (or alternatives with no stated reason for rejection) makes the ADR worthless — the whole value is why the other paths lost. Each alternative needs a concrete rejection reason.
  • Context that already contains the decision. Context = forces and constraints only. If "we will use X" appears in Context, you've collapsed the record. Keep the problem and the solution in separate sections.
  • All-positive Consequences. Every real decision has a cost (new dependency to maintain, lock-in, migration work). Omitting negatives hides the tradeoff future readers most need.
  • Multiple decisions in one ADR. "Use Postgres AND adopt hexagonal architecture" is two ADRs. Bundled records can't be individually superseded later. Split them.
  • Forgetting the index / dangling supersede link. A new ADR not added to the index, or an old ADR left as Accepted after being replaced, makes the log lie about current state. Update both sides.
  • Leaking private context — personal/author names, machine paths, internal tickets, secrets in Context or Decision. Keep it about the system, with generic placeholders.

Verify

  • Decision stated as one clear "We will ..." sentence; exactly one decision in the record.
  • File is docs/adr/NNNN-kebab-title.md with NNNN = highest existing + 1, zero-padded; no number reused.
  • All five sections present and correctly scoped: Status, Context (forces only, no solution), Decision, Alternatives Considered (each with a why-rejected reason), Consequences (includes negatives).
  • Status is a valid value (Proposed/Accepted/Deprecated/Superseded by ADR-MMMM) and matches reality.
  • Index (README.md/index.md) has a row for this ADR linking to it; statuses there match the files.
  • If this reverses a prior decision: old ADR's Status changed to Superseded by ADR-N (body untouched), and the new ADR links back to it — both directions.
  • No personal identifiers, absolute home paths, internal URLs, or secrets anywhere in the record.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.