Skip to content

Commit 29ae4e2

Browse files
raifdmuellerclaude
andcommitted
feat: add ADR generation to risk-assess and risk-mitigate skills
- /risk-assess: Generate ADR nach Nygard at Tier 3+ (optional, user confirms) - Detects next ADR number in docs/adr/ - Creates ADR with Context (dimension scores), Decision (tier), Consequences - Integrates with arc42 chapter 9 if present - References ADR in CLAUDE.md assessment header - /risk-mitigate: Update existing ADR with mitigation implementation status - Adds "Implementation Status" section with mitigation table - Updates ADR status to Accepted when mitigations complete - Updates arc42 reference if present Implements tier-proportional documentation: ADR only for Tier 3+, CLAUDE.md remains single source of truth, ADR is additive human-readable documentation. Closes #14 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 19af45b commit 29ae4e2

File tree

2 files changed

+175
-71
lines changed

2 files changed

+175
-71
lines changed

.claude/skills/risk-assess/SKILL.md

Lines changed: 64 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ Detect the modules (independently assessable units) in this repository.
2424

2525
Look for these files in the repo root and parse the relevant field:
2626

27-
| Config File | Field to Parse |
28-
|-------------|---------------|
29-
| `pnpm-workspace.yaml` | `packages:` array |
30-
| `package.json` (root) | `"workspaces"` field |
31-
| `lerna.json` | `"packages"` array |
32-
| `Cargo.toml` (root) | `[workspace] members` |
33-
| `settings.gradle` / `settings.gradle.kts` | `include(...)` calls |
34-
| `pom.xml` (root) | `<modules>` elements |
35-
| `go.work` | `use (...)` directives |
27+
| Config File | Field to Parse |
28+
| ----------------------------------------- | ---------------------- |
29+
| `pnpm-workspace.yaml` | `packages:` array |
30+
| `package.json` (root) | `"workspaces"` field |
31+
| `lerna.json` | `"packages"` array |
32+
| `Cargo.toml` (root) | `[workspace] members` |
33+
| `settings.gradle` / `settings.gradle.kts` | `include(...)` calls |
34+
| `pom.xml` (root) | `<modules>` elements |
35+
| `go.work` | `use (...)` directives |
3636

3737
Resolve any glob patterns to actual directories.
3838

@@ -81,6 +81,7 @@ score across all detected languages (weighted by file count — if only 1-2 file
8181
of a high-score language exist among hundreds of low-score files, note this).
8282

8383
Report:
84+
8485
```
8586
Language scan for {module}:
8687
.ts/.tsx: 42 files (score 1)
@@ -94,6 +95,7 @@ Search for patterns in the shared risk model, starting from the highest score (4
9495
and working down. Stop at the first match level that has significant hits.
9596

9697
Report each match with the file and line:
98+
9799
```
98100
Code Type scan for {module}:
99101
Auth/Security patterns (score 4):
@@ -110,6 +112,7 @@ Search for data sensitivity patterns from the shared risk model, starting from
110112
score 4 (PHI/PCI) down to score 2 (General PII).
111113

112114
Report matches with evidence:
115+
113116
```
114117
Data Sensitivity scan for {module}:
115118
PHI/PCI patterns (score 4): no matches
@@ -124,6 +127,7 @@ Data Sensitivity scan for {module}:
124127

125128
Search for deployment/regulatory patterns from the shared risk model.
126129
Also check for:
130+
127131
- `Dockerfile`, `docker-compose.yml` — containerized deployment
128132
- `.github/workflows/`, `Jenkinsfile`, `.gitlab-ci.yml` — CI/CD presence
129133
- `kubernetes/`, `k8s/`, `helm/` — orchestrated deployment
@@ -134,6 +138,7 @@ Note findings but flag that user confirmation is required.
134138
### 2e. Blast Radius Hints
135139

136140
Blast radius is nearly impossible to auto-detect. Note any hints:
141+
137142
- Number of downstream dependents (if library)
138143
- Presence of health/safety keywords
139144
- Scale indicators (load balancer configs, horizontal scaling)
@@ -210,6 +215,7 @@ Mapping: max <= 1 → Tier 1, max <= 2 → Tier 2, max <= 3 → Tier 3, max = 4
210215
```
211216

212217
Present the result:
218+
213219
```
214220
{module} Risk Assessment:
215221
Code Type: 3 (API / DB Queries)
@@ -229,16 +235,63 @@ Check for config files and CI workflow steps that indicate existing mitigations.
229235
### 4c. Check for Existing Assessment
230236

231237
Before writing to CLAUDE.md:
238+
232239
- Check if CLAUDE.md already contains a `## Risk Radar Assessment` section
233240
- If it does, ask the user: "CLAUDE.md already contains a risk assessment. Overwrite it?"
234241
- If the user declines, skip writing
235242

236-
### 4d. Write to CLAUDE.md
243+
### 4d. ADR Generation (Tier 3+ only)
244+
245+
If **any module** was assessed as **Tier 3 or higher**, offer to generate an Architecture Decision Record:
246+
247+
```
248+
Tier 3 detected. Generate an Architecture Decision Record (ADR nach Nygard)?
249+
[Y/n] — Recommended for Tier 3+ to document the risk classification decision.
250+
```
251+
252+
If the user accepts:
253+
254+
1. **Detect next ADR number**:
255+
- Check if `docs/adr/` exists; if not, create it
256+
- Find the highest existing ADR number (`docs/adr/NNN-*.md`)
257+
- Use next number (zero-padded to 3 digits)
258+
259+
2. **Write ADR nach Nygard** to `docs/adr/NNN-risk-classification-{project}.md`:
260+
- **Title**: `# {NNN}. Risk Classification — {project/module}`
261+
- **Date**: Current date (YYYY-MM-DD)
262+
- **Status**: Proposed
263+
- **Context**: Summary of dimension scores with reasoning for each module
264+
- **Decision**: Tier classification result, determining dimension
265+
- **Consequences**: Positive (security baseline), Negative (CI overhead, workflow changes)
266+
267+
Use "ADR nach Nygard" as the semantic anchor — no need for a custom template.
268+
The LLM knows the format: Title, Status, Context, Decision, Consequences.
269+
270+
3. **Arc42 integration** (if applicable):
271+
- Check if `docs/arc42/` exists
272+
- If yes, check if `docs/arc42/chapters/09_architecture_decisions.adoc` exists
273+
- If yes, append a reference to the ADR:
274+
275+
```asciidoc
276+
=== ADR-NNN: Risk Classification — {project}
277+
278+
See link:../../adr/NNN-risk-classification-{project}.md[ADR-NNN] for vibe-coding risk assessment.
279+
280+
**Status:** Proposed | **Date:** YYYY-MM-DD | **Tier:** {N}
281+
```
282+
283+
4. **Reference in CLAUDE.md**:
284+
- Add a line to the Risk Radar Assessment header:
285+
```markdown
286+
_Architecture Decision: See [ADR-NNN](docs/adr/NNN-risk-classification-{project}.md)_
287+
```
288+
289+
### 4e. Write to CLAUDE.md
237290

238291
Use the exact output format from `.claude/skills/shared/risk-model.md` under
239292
"CLAUDE.md Output Format". Write:
240293

241-
1. The assessment header with timestamp
294+
1. The assessment header with timestamp (and ADR reference if generated)
242295
2. Per-module dimension table with scores, levels, and evidence
243296
3. Tier result with determining dimension
244297
4. Per-module mitigation status table

0 commit comments

Comments
 (0)