Skip to content
179 changes: 179 additions & 0 deletions skills/architecture-decision-records/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
name: architecture-decision-records
description: Capture architectural decisions made during Claude Code sessions as structured ADRs. Auto-detects decision moments, records context, alternatives considered, and rationale. Maintains an ADR log so future developers understand why the codebase is shaped the way it is.
origin: ECC
---

# Architecture Decision Records

Capture architectural decisions as they happen during coding sessions. Instead of decisions living only in Slack threads, PR comments, or someone's memory, this skill produces structured ADR documents that live alongside the code.

## When to Activate

- User explicitly says "let's record this decision" or "ADR this"
- User chooses between significant alternatives (framework, library, pattern, database, API design)
- User says "we decided to..." or "the reason we're doing X instead of Y is..."
- User asks "why did we choose X?" (read existing ADRs)
- During planning phases when architectural trade-offs are discussed

## ADR Format

Use the lightweight ADR format proposed by Michael Nygard, adapted for AI-assisted development:

```markdown
# ADR-NNNN: [Decision Title]

**Date**: YYYY-MM-DD
**Status**: proposed | accepted | deprecated | superseded by ADR-NNNN
**Deciders**: [who was involved]

## Context

What is the issue that we're seeing that is motivating this decision or change?

[2-5 sentences describing the situation, constraints, and forces at play]

## Decision

What is the change that we're proposing and/or doing?

[1-3 sentences stating the decision clearly]

## Alternatives Considered

### Alternative 1: [Name]
- **Pros**: [benefits]
- **Cons**: [drawbacks]
- **Why not**: [specific reason this was rejected]

### Alternative 2: [Name]
- **Pros**: [benefits]
- **Cons**: [drawbacks]
- **Why not**: [specific reason this was rejected]

## Consequences

What becomes easier or more difficult to do because of this change?

### Positive
- [benefit 1]
- [benefit 2]

### Negative
- [trade-off 1]
- [trade-off 2]

### Risks
- [risk and mitigation]
```

## Workflow

### Capturing a New ADR

When a decision moment is detected:

1. **Initialize (first time only)** — if `docs/adr/` does not exist, ask the user for confirmation before creating the directory, a `README.md` seeded with the index table header (see ADR Index Format below), and a blank `template.md` for manual use. Do not create files without explicit consent.
2. **Identify the decision** — extract the core architectural choice being made
3. **Gather context** — what problem prompted this? What constraints exist?
4. **Document alternatives** — what other options were considered? Why were they rejected?
5. **State consequences** — what are the trade-offs? What becomes easier/harder?
6. **Assign a number** — scan existing ADRs in `docs/adr/` and increment
7. **Confirm and write** — present the draft ADR to the user for review. Only write to `docs/adr/NNNN-decision-title.md` after explicit approval. If the user declines, discard the draft without writing any files.
8. **Update the index** — append to `docs/adr/README.md`

### Reading Existing ADRs

When a user asks "why did we choose X?":

1. Check if `docs/adr/` exists — if not, respond: "No ADRs found in this project. Would you like to start recording architectural decisions?"
2. If it exists, scan `docs/adr/README.md` index for relevant entries
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: ADR lookup is brittle because it relies only on the README index and can miss existing ADR files when the index is stale or incomplete.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At skills/architecture-decision-records/SKILL.md, line 90:

<comment>ADR lookup is brittle because it relies only on the README index and can miss existing ADR files when the index is stale or incomplete.</comment>

<file context>
@@ -82,6 +82,15 @@ When a decision moment is detected:
+When a user asks "why did we choose X?":
+
+1. Check if `docs/adr/` exists — if not, respond: "No ADRs found in this project. Would you like to start recording architectural decisions?"
+2. If it exists, scan `docs/adr/README.md` index for relevant entries
+3. Read matching ADR files and present the Context and Decision sections
+4. If no match is found, respond: "No ADR found for that decision. Would you like to record one now?"
</file context>
Suggested change
2. If it exists, scan `docs/adr/README.md` index for relevant entries
2. If it exists, scan `docs/adr/README.md` index for relevant entries; if the index is missing, unreadable, or has no match, fall back to scanning `docs/adr/*.md` (excluding `template.md`) for likely matches
Fix with Cubic

3. Read matching ADR files and present the Context and Decision sections
4. If no match is found, respond: "No ADR found for that decision. Would you like to record one now?"

### ADR Directory Structure

```
docs/
└── adr/
├── README.md ← index of all ADRs
├── 0001-use-nextjs.md
├── 0002-postgres-over-mongo.md
├── 0003-rest-over-graphql.md
└── template.md ← blank template for manual use
```

### ADR Index Format

```markdown
# Architecture Decision Records

| ADR | Title | Status | Date |
|-----|-------|--------|------|
| [0001](0001-use-nextjs.md) | Use Next.js as frontend framework | accepted | 2026-01-15 |
| [0002](0002-postgres-over-mongo.md) | PostgreSQL over MongoDB for primary datastore | accepted | 2026-01-20 |
| [0003](0003-rest-over-graphql.md) | REST API over GraphQL | accepted | 2026-02-01 |
```

Comment on lines +11 to +117
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Align section headers with required skill template (When to Use / How It Works / Examples).

This skill is well-structured, but it doesn’t use the required section naming/presence from repo guidelines. Please rename/add explicit sections so automated/consistent parsing stays predictable.

Suggested doc-only adjustment
-## When to Activate
+## When to Use

 ...

-## Workflow
+## How It Works

 ...

+## Examples
+
+- **Trigger phrase**: “ADR this decision: REST over GraphQL for public API.”
+- **Expected output**: A new `docs/adr/NNNN-rest-over-graphql.md` entry + README index row.
+- **Read path**: “Why did we choose X?” → locate and summarize matching ADR(s).

As per coding guidelines, “Skills should be formatted as Markdown with clear sections for When to Use, How It Works, and Examples.”

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## When to Activate
- User explicitly says "let's record this decision" or "ADR this"
- User chooses between significant alternatives (framework, library, pattern, database, API design)
- User says "we decided to..." or "the reason we're doing X instead of Y is..."
- User asks "why did we choose X?" (read existing ADRs)
- During planning phases when architectural trade-offs are discussed
## ADR Format
Use the lightweight ADR format proposed by Michael Nygard, adapted for AI-assisted development:
```markdown
# ADR-NNNN: [Decision Title]
**Date**: YYYY-MM-DD
**Status**: proposed | accepted | deprecated | superseded by ADR-NNNN
**Deciders**: [who was involved]
## Context
What is the issue that we're seeing that is motivating this decision or change?
[2-5 sentences describing the situation, constraints, and forces at play]
## Decision
What is the change that we're proposing and/or doing?
[1-3 sentences stating the decision clearly]
## Alternatives Considered
### Alternative 1: [Name]
- **Pros**: [benefits]
- **Cons**: [drawbacks]
- **Why not**: [specific reason this was rejected]
### Alternative 2: [Name]
- **Pros**: [benefits]
- **Cons**: [drawbacks]
- **Why not**: [specific reason this was rejected]
## Consequences
What becomes easier or more difficult to do because of this change?
### Positive
- [benefit 1]
- [benefit 2]
### Negative
- [trade-off 1]
- [trade-off 2]
### Risks
- [risk and mitigation]
```
## Workflow
### Capturing a New ADR
When a decision moment is detected:
1. **Identify the decision** — extract the core architectural choice being made
2. **Gather context** — what problem prompted this? What constraints exist?
3. **Document alternatives** — what other options were considered? Why were they rejected?
4. **State consequences** — what are the trade-offs? What becomes easier/harder?
5. **Assign a number** — scan existing ADRs in `docs/adr/` and increment
6. **Write the file** — save to `docs/adr/NNNN-decision-title.md`
7. **Update the index** — append to `docs/adr/README.md`
### ADR Directory Structure
```
docs/
└── adr/
├── README.md ← index of all ADRs
├── 0001-use-nextjs.md
├── 0002-postgres-over-mongo.md
├── 0003-rest-over-graphql.md
└── template.md ← blank template for manual use
```
### ADR Index Format
```markdown
# Architecture Decision Records
| ADR | Title | Status | Date |
|-----|-------|--------|------|
| [0001](0001-use-nextjs.md) | Use Next.js as frontend framework | accepted | 2026-01-15 |
| [0002](0002-postgres-over-mongo.md) | PostgreSQL over MongoDB for primary datastore | accepted | 2026-01-20 |
| [0003](0003-rest-over-graphql.md) | REST API over GraphQL | accepted | 2026-02-01 |
```
## When to Use
- User explicitly says "let's record this decision" or "ADR this"
- User chooses between significant alternatives (framework, library, pattern, database, API design)
- User says "we decided to..." or "the reason we're doing X instead of Y is..."
- User asks "why did we choose X?" (read existing ADRs)
- During planning phases when architectural trade-offs are discussed
## ADR Format
Use the lightweight ADR format proposed by Michael Nygard, adapted for AI-assisted development:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/architecture-decision-records/SKILL.md` around lines 11 - 107, Rename
and/or add the required top-level sections so the skill uses "When to Use", "How
It Works", and "Examples": change the existing "When to Activate" header to
"When to Use", move or retitle "ADR Format" into "How It Works" (keep the ADR
template content under it), and create an "Examples" section (populate with a
brief sample ADR or point to the ADR Index table). Update any internal
references (e.g., "Workflow" can remain but should be a subsection under "How It
Works" or "Examples") so automated parsing expects those exact header names.

## Decision Detection Signals

Watch for these patterns in conversation that indicate an architectural decision:

**Explicit signals**
- "Let's go with X"
- "We should use X instead of Y"
- "The trade-off is worth it because..."
- "Record this as an ADR"

**Implicit signals** (suggest recording an ADR — do not auto-create without user confirmation)
- Comparing two frameworks or libraries and reaching a conclusion
- Making a database schema design choice with stated rationale
- Choosing between architectural patterns (monolith vs microservices, REST vs GraphQL)
- Deciding on authentication/authorization strategy
- Selecting deployment infrastructure after evaluating alternatives

## What Makes a Good ADR

### Do
- **Be specific** — "Use Prisma ORM" not "use an ORM"
- **Record the why** — the rationale matters more than the what
- **Include rejected alternatives** — future developers need to know what was considered
- **State consequences honestly** — every decision has trade-offs
- **Keep it short** — an ADR should be readable in 2 minutes
- **Use present tense** — "We use X" not "We will use X"

### Don't
- Record trivial decisions — variable naming or formatting choices don't need ADRs
- Write essays — if the context section exceeds 10 lines, it's too long
- Omit alternatives — "we just picked it" is not a valid rationale
- Backfill without marking it — if recording a past decision, note the original date
- Let ADRs go stale — superseded decisions should reference their replacement

## ADR Lifecycle

```
proposed → accepted → [deprecated | superseded by ADR-NNNN]
```

- **proposed**: decision is under discussion, not yet committed
- **accepted**: decision is in effect and being followed
- **deprecated**: decision is no longer relevant (e.g., feature removed)
- **superseded**: a newer ADR replaces this one (always link the replacement)

## Categories of Decisions Worth Recording

| Category | Examples |
|----------|---------|
| **Technology choices** | Framework, language, database, cloud provider |
| **Architecture patterns** | Monolith vs microservices, event-driven, CQRS |
| **API design** | REST vs GraphQL, versioning strategy, auth mechanism |
| **Data modeling** | Schema design, normalization decisions, caching strategy |
| **Infrastructure** | Deployment model, CI/CD pipeline, monitoring stack |
| **Security** | Auth strategy, encryption approach, secret management |
| **Testing** | Test framework, coverage targets, E2E vs integration balance |
| **Process** | Branching strategy, review process, release cadence |

## Integration with Other Skills

- **Planner agent**: when the planner proposes architecture changes, suggest creating an ADR
- **Code reviewer agent**: flag PRs that introduce architectural changes without a corresponding ADR
Comment on lines +176 to +179
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for ADR-related logic in planner and code-reviewer agent files

echo "=== Searching planner.md for ADR references ==="
rg -n -C3 -i 'adr|architecture.decision' agents/planner.md || echo "No ADR references found in planner.md"

echo -e "\n=== Searching code-reviewer.md for ADR references ==="
rg -n -C3 -i 'adr|architecture.decision' agents/code-reviewer.md || echo "No ADR references found in code-reviewer.md"

echo -e "\n=== Checking if ADR skill is referenced in agent configs ==="
fd -e md -e yaml . agents/ --exec rg -l 'architecture-decision-records'

Repository: affaan-m/everything-claude-code

Length of output: 321


Remove or implement claimed ADR integrations with Planner and Code Reviewer agents.

Lines 176-179 claim the Planner agent should "suggest creating an ADR" and the Code Reviewer agent should "flag PRs that introduce architectural changes without a corresponding ADR." Neither integration exists in the actual agent implementations.

Either remove these claims and document them as planned enhancements, or update the agent files to implement the integrations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@skills/architecture-decision-records/SKILL.md` around lines 176 - 179, Update
the ADR doc claims about Planner and Code Reviewer agent integrations: either
remove the two bullet points under "Integration with Other Skills" that state
the Planner agent "suggests creating an ADR" and the Code Reviewer agent "flags
PRs without a corresponding ADR", or implement the integrations in the
respective agents; if removing, mark them as "planned enhancements" in SKILL.md
instead of asserting they exist; if implementing, add the actual logic in the
Planner agent (where proposals are generated, e.g., the function/module that
creates architecture suggestions) to call an ADR creation helper, and add a
check in the Code Reviewer agent (the PR linting/analysis routine) to detect
architectural changes and verify an ADR exists, then update SKILL.md to
accurately reflect the new behavior.