Adr

From indigoai-us/hq-core · View interactive version

Adr is an AI agent skill from the GitHub repository indigoai-us/hq-core. Capture qualifying architecture decisions as ADRs in the right HQ or repo location.

How to use this skill

Skill file

ADR

Architectural Decision Records — minimal, dated, sequentially numbered. The point is recording that a decision was made and why, not filling out template sections.

Pattern adapted from mattpocock/skills (grill-with-docs/ADR-FORMAT.md).

Step 0 — Resolve company + scope

$ARGUMENTS may include:

If scope is ambiguous, ask via AskUserQuestion:

| Choice | Home | When |

|---|---|---|

| repo | <repo>/docs/adr/ | Decision is bound to specific code; reviewers will read it alongside the code |

| hq | companies/{co}/knowledge/adrs/ | Decision is org-level (e.g. "we use Linear, not Jira"; "all auth via Cognito") |

If no company resolves and scope is hq, default to core/knowledge/public/adrs/ (rare — most ADRs have a tenant).

Step 1 — Three-condition gate (HARD BLOCK)

Ask the user three yes/no questions via a single AskUserQuestion call:

  1. Hard to reverse — would changing your mind later cost meaningful effort? (refactor, migration, contract renegotiation)
  2. Surprising without context — would a future reader look at the result and wonder "why on earth did they do it this way?"
  3. Result of a real trade-off — were there genuine alternatives, and did you pick this one for specific reasons?

If any answer is no → DO NOT WRITE THE ADR. Offer alternatives:

| Failed condition | Alternative |

|---|---|

| Easy to reverse | Skip — you'll just reverse it later |

| Not surprising | Skip — nobody will wonder |

| No real trade-off | Add to GLOSSARY.md glossary instead, or skip |

Re-prompt: "Skip ADR / Add to GLOSSARY.md / Force-write anyway (rarely correct)". Only Force-write proceeds; record reasoning in the ADR body so the override is explicit.

Step 2 — Locate or create target directory

# repo scope
mkdir -p <repo>/docs/adr/

# hq scope
mkdir -p companies/{co}/knowledge/adrs/

Lazy-create only when the first ADR is needed.

Step 3 — Compute next number

ls <target>/[0-9][0-9][0-9][0-9]-*.md 2>/dev/null \
  | sed 's|.*/\([0-9]*\)-.*|\1|' \
  | sort -n \
  | tail -1

Increment by 1. Default to 0001 if no existing ADRs. Format: NNNN (4-digit zero-padded).

Slug from the user's title:

Final filename: NNNN-slug.md

Step 4 — Walk the user through 1–3 sentences

Single AskUserQuestion (or sequential prompts) collecting:

That's the minimum. The value is in recording the decision, not in completing a template.

Step 5 — Optional sections (offer, don't force)

Ask via AskUserQuestion (multiSelect) which (if any) to include:

If user picks none, the ADR is just title + 1–3 sentences. Good.

Step 6 — Write ADR

Template (use only the sections selected in Step 5):

---
status: <accepted|proposed|...>          # only if Status was selected
date: <YYYY-MM-DD>
related: []                              # ADR numbers, optional
---

# <Title>

<1-3 sentences: context, decision, why.>

## Considered Options                    <!-- optional -->

- <Option A> — <why rejected>
- <Option B> — <why rejected>

## Consequences                          <!-- optional -->

- <non-obvious downstream effect>

Step 7 — Cross-link

If new domain terms surfaced during the conversation, offer to update GLOSSARY.md (in the same repo for repo scope; in companies/{co}/knowledge/GLOSSARY.md for hq scope).

If this ADR supersedes an earlier one, update the older ADR's frontmatter to status: superseded by ADR-NNNN (after asking).

If this ADR is accepting a /architect candidate, add a backlink in workspace/reports/{slug}-architect.md under that candidate's "Outcome" section.

Step 8 — Report

Print:

✓ ADR written: <target>/NNNN-slug.md
  Title: <title>
  Scope: repo | hq
  Optional sections: <Status / Considered Options / Consequences / none>
  GLOSSARY.md updated: yes / no
  Supersedes: ADR-MMMM / none

What qualifies (examples)

What does NOT qualify

Cross-references

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.