ADR Write Command
Write ADR documents based on discovered candidates from adr-candidates.md.
You MUST consider the user input before proceeding.
Overview
Generate complete ADR documents by researching GitHub commits/PRs and applying the ADR template.
Multi-Agent Collaboration Pipeline:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ADR Writing Pipeline โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Phase 1: specvital-specialist โ
โ โ Search related commits/PRs via GitHub API โ
โ โ Extract decision context and rationale โ
โ โ Identify options that were considered โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Phase 2: product-strategist โ
โ โ Analyze decision trade-offs โ
โ โ Evaluate consequences (positive/negative) โ
โ โ Structure options comparison โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Phase 3: Write ADR Documents โ
โ โ Generate English version (docs/en/adr/) โ
โ โ Generate Korean version (docs/ko/adr/) โ
โ โ Update all required index files โ
โ โ Update sidebar configuration โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Numeric Reference
Reference candidates by number from adr-candidates.md:
bash
1/adr-write 1 # Platform Level candidate #1
2/adr-write core/1 # Core repository candidate #1
3/adr-write worker/1 # Worker repository candidate #1
Natural Language
Describe what ADR to write:
bash
1/adr-write billing and quota system
2/adr-write write the AI spec document generation ADR
3/adr-write domain hints extraction for core repository
Parsing Logic
- Numeric only (e.g.,
1, 2): Match Platform Level candidate by number
- Prefixed numeric (e.g.,
core/1, web/2): Match repository-level candidate
- Natural language: Search candidate titles and descriptions for best match
Execution Flow
Read adr-candidates.md and identify the target ADR:
1. Parse user input to identify candidate
2. Extract from adr-candidates.md:
- Title
- Target location (e.g., /en/adr/13-xxx.md)
- Related repositories
- Complexity and priority
3. Determine ADR number and file paths
File Path Determination:
| Candidate Type | English Path | Korean Path |
|---|
| Platform Level | docs/en/adr/{num}-{slug}.md | docs/ko/adr/{num}-{slug}.md |
| Core | docs/en/adr/core/{num}-{slug}.md | docs/ko/adr/core/{num}-{slug}.md |
| Worker | docs/en/adr/worker/{num}-{slug}.md | docs/ko/adr/worker/{num}-{slug}.md |
| Web | docs/en/adr/web/{num}-{slug}.md | docs/ko/adr/web/{num}-{slug}.md |
Phase 1: Context Research (specvital-specialist)
Task tool invocation:
Task(subagent_type="specvital-specialist", prompt="""
Research GitHub context for ADR: {candidate_title}
**Target Repositories**: {related_repos}
**Research Tasks**:
1. **Search Related Commits**
- Use gh CLI or GitHub MCP to search commits
- Keywords: {extracted_keywords}
- Timeframe: Last 90 days
- Command: `gh search commits "{keyword}" --repo specvital/{repo} --limit 20`
2. **Search Related PRs**
- Find PRs that introduced or modified this feature
- Command: `gh pr list --repo specvital/{repo} --search "{keyword}" --state all --limit 10`
3. **Extract Decision Context**
For each relevant commit/PR:
- What problem was being solved?
- What approach was taken?
- Any alternatives mentioned in discussions?
4. **Output Format**
Relevant Commits
- {commit_sha}: {message} - {date}
Relevant PRs
- #{pr_number}: {title} - {state}
Context Summary
- Problem: ...
- Decision: ...
- Alternatives mentioned: ...
""")
Phase 2: Decision Analysis (product-strategist)
Task tool invocation:
Task(subagent_type="product-strategist", prompt="""
Analyze the architectural decision for ADR: {candidate_title}
**Input**: Context from Phase 1
**Analysis Tasks**:
1. **Structure the Context**
- What was the problem/need?
- Why was a decision required?
- What constraints existed?
2. **Identify Options**
Based on commits/PRs and common patterns:
- Option A (selected): What was chosen and why
- Option B: What alternatives existed
- Option C: Any other approaches considered
3. **Evaluate Consequences**
For the selected option:
- Positive outcomes (benefits, improvements)
- Negative outcomes (trade-offs, limitations)
- Technical implications
4. **Output Format**
Structured content ready for ADR template sections:
- Context section content
- Decision section content
- Options Considered section content
- Consequences section content
""")
Phase 3: Write ADR Documents
Generate both English and Korean versions following the template.
ADR Template Structure:
markdown
1---
2title: { Title }
3description: ADR for {brief description}
4---
5
6# ADR-{num}: {Title}
7
8> [Korean Version](/ko/adr/{path}) OR ๐ฐ๐ท [ํ๊ตญ์ด ๋ฒ์ ](/ko/adr/{path})
9
1011| ---------- | --------- | ---------------- |
12| YYYY-MM-DD | @{author} | {repo1}, {repo2} |
13
14## Context
15
16{Problem situation and why a decision was needed}
17
18## Decision
19
20{The decision made and its rationale}
21
22## Options Considered
23
24### Option A: {Name} (Selected)
25
26{Description, pros, cons}
27
28### Option B: {Name}
29
30{Description, pros, cons}
31
32## Consequences
33
34**Positive:**
35
36- {Benefit 1}
37- {Benefit 2}
38
39**Negative:**
40
41- {Trade-off 1}
42- {Trade-off 2}
43
44## References
45
46- [Related ADR](/en/adr/XX-related.md)
47- [Related PR](https://github.com/specvital/{repo}/pull/{num})
Post-Write Updates (CRITICAL)
After writing ADR documents, you MUST update all required files per CLAUDE.md rules.
Update 6 files:
โ docs/en/index.md โ Homepage ADR links section
โ docs/ko/index.md โ Homepage ADR links section
โ docs/en/adr/index.md โ ADR overview
โ docs/ko/adr/index.md โ ADR overview
โ docs/.vitepress/config.mts โ Sidebar navigation
For Repository Level ADR (e.g., adr/core/16-xxx.md)
Update 6 files:
โ docs/en/index.md โ Homepage ADR links section
โ docs/ko/index.md โ Homepage ADR links section
โ docs/en/adr/index.md โ ADR overview (repository section)
โ docs/ko/adr/index.md โ ADR overview (repository section)
โ docs/en/adr/{category}/index.md โ Category index
โ docs/ko/adr/{category}/index.md โ Category index
โ docs/.vitepress/config.mts โ Sidebar navigation
Language Rules
English Version (/en/)
- Write entirely in English
- Use technical terminology appropriately
- Clear, concise prose
Korean Version (/ko/)
- Write entirely in Korean
- MUST use noun-ending style (๋ช
์ฌํ ์ข
๊ฒฐ)
- NEVER use verb-ending style (๋์ฌ ์ข
๊ฒฐ์ด๋ฏธ ๊ธ์ง)
Korean Style Examples:
| โ
Correct | โ Incorrect |
|---|
| ๋ฐ์ดํฐ ๋ฌด๊ฒฐ์ฑ ๊ฒ์ฆ | ๋ฐ์ดํฐ ๋ฌด๊ฒฐ์ฑ์ ๊ฒ์ฆํฉ๋๋ค |
| API ํธ์ถ ์ต์ํ | API ํธ์ถ์ด ์ต์ํ๋ฉ๋๋ค |
| ์ ์ ๋ถ์ ๊ธฐ๋ฐ ํ
์คํธ ์นด์ดํธ | ์ ์ ๋ถ์์ ํตํด ํ
์คํธ๋ฅผ ์นด์ดํธํ๋ค |
Key Rules
Must Do
- Load candidate info from
adr-candidates.md
- Research actual GitHub commits/PRs for context
- Follow ADR template structure exactly
- Generate both English and Korean versions
- Update ALL required index files (check CLAUDE.md for complete list)
- Update sidebar in
config.mts
- Use noun-ending style for Korean
Must Not Do
- Skip GitHub research (must base on actual commits)
- Write only one language version
- Forget to update index files
- Use verb endings in Korean documents
- Guess content without evidence from commits/PRs
Output Summary
After completion, report:
## ADR Written
| Item | Value |
|------|-------|
| Title | {ADR Title} |
| Number | ADR-{num} |
| English | docs/en/adr/{path} |
| Korean | docs/ko/adr/{path} |
## Files Updated
- [x] docs/en/adr/{path} (created)
- [x] docs/ko/adr/{path} (created)
- [x] docs/en/index.md
- [x] docs/ko/index.md
- [x] docs/en/adr/index.md
- [x] docs/ko/adr/index.md
- [x] docs/.vitepress/config.mts
## Source References
- {commit_sha}: {message}
- PR #{num}: {title}
Usage Examples
bash
1# Write Platform Level candidate #1 (Billing and Quota)
2/adr-write 1
3
4# Write Core repository candidate #1
5/adr-write core/1
6
7# Natural language - matches "AI-Based Spec Document Generation Pipeline"
8/adr-write AI spec generation
9
10# Natural language with context
11/adr-write write the billing ADR, focus on quota tracking aspects
/adr-discover: Discover ADR candidates
/document-business-rule: Business rule documentation
/commit: Commit message generation
specvital-specialist: GitHub context research
product-strategist: Decision analysis and trade-offs
prompt-engineer: Document quality optimization
claude-code-specialist: Command and workflow optimization
Execution
Now execute the workflow:
- Parse $ARGUMENTS: Identify target candidate from
adr-candidates.md
- Phase 1: Invoke Task(specvital-specialist) for GitHub research
- Phase 2: Invoke Task(product-strategist) for decision analysis
- Phase 3: Write ADR documents (English + Korean)
- Update Index Files: Per CLAUDE.md requirements
- Report: Summary of created/updated files