claude-blueprint 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.claude-plugin/plugin.json +26 -0
  2. package/LICENSE +21 -0
  3. package/README.md +387 -0
  4. package/agents/adr-architect-cartographer.md +179 -0
  5. package/agents/adr-bug-surface-mapper.md +154 -0
  6. package/agents/adr-compliance-auditor.md +146 -0
  7. package/agents/adr-consistency-auditor.md +131 -0
  8. package/agents/adr-conways-law-analyzer.md +170 -0
  9. package/agents/adr-devils-advocate.md +161 -0
  10. package/agents/adr-impact-analyzer.md +135 -0
  11. package/agents/adr-maintainability-assessor.md +162 -0
  12. package/agents/adr-researcher.md +134 -0
  13. package/agents/adr-retrospective.md +204 -0
  14. package/agents/adr-testing-strategy-evaluator.md +164 -0
  15. package/agents/persona.md +36 -0
  16. package/bin/cli.js +33 -0
  17. package/commands/architect.md +66 -0
  18. package/commands/audit.md +41 -0
  19. package/commands/blueprint.md +63 -0
  20. package/commands/debt.md +102 -0
  21. package/commands/digest.md +106 -0
  22. package/commands/drift.md +104 -0
  23. package/commands/eli5.md +149 -0
  24. package/commands/evaluate.md +61 -0
  25. package/commands/fitness.md +119 -0
  26. package/commands/guard.md +102 -0
  27. package/commands/health.md +139 -0
  28. package/commands/help.md +119 -0
  29. package/commands/hooks.md +131 -0
  30. package/commands/impact.md +38 -0
  31. package/commands/init.md +229 -0
  32. package/commands/list.md +51 -0
  33. package/commands/new.md +74 -0
  34. package/commands/rearchitect.md +45 -0
  35. package/commands/retro.md +50 -0
  36. package/commands/review.md +50 -0
  37. package/commands/search.md +28 -0
  38. package/commands/status.md +189 -0
  39. package/commands/timeline.md +113 -0
  40. package/commands/transition.md +83 -0
  41. package/config/lifecycle.toml +71 -0
  42. package/config/relationships.toml +22 -0
  43. package/config/state.toml +21 -0
  44. package/config/taxonomy.toml +118 -0
  45. package/package.json +27 -0
  46. package/src/claude-md.js +57 -0
  47. package/src/install.js +83 -0
  48. package/src/paths.js +25 -0
  49. package/src/verify.js +95 -0
@@ -0,0 +1,102 @@
1
+ ---
2
+ name: blueprint:debt
3
+ description: >
4
+ Track decision debt — deferred ADRs with trigger conditions that may have been met.
5
+ Surfaces decisions that are due for revisiting. Use when: "check decision debt",
6
+ "any deferred decisions due?", "decision debt", "what decisions are overdue?",
7
+ "deferred adrs", or periodically to prevent forgotten deferrals.
8
+ ---
9
+
10
+ # Decision Debt Tracker
11
+
12
+ Deferred ADRs are invisible liabilities. Each has a trigger condition — "revisit when X" —
13
+ but nobody monitors whether X has happened. This skill does.
14
+
15
+ > Decision debt compounds faster than technical debt. A deferred technology choice
16
+ > becomes a deferred architecture choice becomes a deferred rewrite.
17
+
18
+ ## Shared Context
19
+
20
+ Read from parent `blueprint/` skill directory:
21
+ - `config/state.toml` — ADR directory
22
+ - `config/taxonomy.toml` — severity levels
23
+
24
+ ## Process
25
+
26
+ ### Step 1: Find All Deferred Decisions
27
+
28
+ Read all ADR files. Filter to status `Deferred`. For each, extract:
29
+ - The trigger condition (from metadata or Consequences section)
30
+ - When it was deferred (date)
31
+ - The severity of the decision (from taxonomy)
32
+ - What depends on this decision (from relationships.toml)
33
+
34
+ Also scan for quasi-deferred decisions in Accepted ADRs:
35
+ - Consequences that say "revisit when...", "defer until...", "reconsider if..."
36
+ - TODO items in the decision or consequences sections
37
+ - v2/future references that imply deferred scope
38
+
39
+ ### Step 2: Evaluate Trigger Conditions
40
+
41
+ For each deferred decision, check if the trigger condition has been met:
42
+
43
+ **Codebase triggers:**
44
+ - "Revisit when we have >N files" → count source files
45
+ - "Defer until auth is implemented" → grep for auth code
46
+ - "Revisit when we add a second database" → grep for new DB imports
47
+ - "Defer until performance matters" → check for performance-related code/config
48
+
49
+ **Time triggers:**
50
+ - "Revisit in 6 months" → compare defer date to today
51
+ - "Reconsider at v2" → check version in package.json
52
+
53
+ **External triggers:**
54
+ - "Defer until data is available" → flag as "check manually"
55
+ - "Revisit when team grows" → flag as "check manually"
56
+
57
+ ### Step 3: Calculate Decision Debt Score
58
+
59
+ ```
60
+ Decision Debt = Σ (severity × age_months × dependency_count)
61
+ ```
62
+
63
+ Higher score = more urgent. A high-severity decision deferred 8 months ago with
64
+ 3 other decisions depending on it is more urgent than a low-severity decision
65
+ deferred last week.
66
+
67
+ ### Step 4: Report
68
+
69
+ ```
70
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
71
+ BLUEPRINT ► DECISION DEBT
72
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
73
+
74
+ Total deferred: [N] explicit + [M] implicit
75
+ Triggers met: [K] — action needed
76
+ Decision debt score: [score]
77
+
78
+ ## Overdue Decisions (triggers met)
79
+
80
+ | ADR | Decision | Trigger | Deferred | Age |
81
+ |-----|----------|---------|----------|-----|
82
+ | ... | ... | [trigger — MET] | [date] | [N] months |
83
+
84
+ ## Upcoming Decisions (triggers approaching)
85
+
86
+ | ADR | Decision | Trigger | Status |
87
+ |-----|----------|---------|--------|
88
+ | ... | ... | [trigger — approaching] | [evidence] |
89
+
90
+ ## Implicit Deferrals (in accepted ADRs)
91
+
92
+ | ADR | Deferred Item | Trigger |
93
+ |-----|--------------|---------|
94
+ | ... | "revisit when..." from consequences | [condition] |
95
+
96
+ ## Recommendations
97
+ 1. [Most urgent — trigger met, high severity, many dependents]
98
+ 2. [Next priority]
99
+ ```
100
+
101
+ For triggered decisions, suggest `/blueprint:new --research` to make the deferred
102
+ decision with fresh evidence.
@@ -0,0 +1,106 @@
1
+ ---
2
+ name: blueprint:digest
3
+ description: >
4
+ Generate a non-technical stakeholder digest of architectural decisions. For PMs, executives,
5
+ and non-technical stakeholders who need the what/why/cost/risk without the code. Use when:
6
+ "stakeholder summary", "executive digest", "architecture digest", "non-technical summary",
7
+ "explain decisions to management", "board summary", or before architecture review meetings.
8
+ ---
9
+
10
+ # Stakeholder Architecture Digest
11
+
12
+ One-page summary for people who allocate budget and set priorities. No code, no jargon,
13
+ no implementation details. What was decided, why, what it costs, and what risks it carries.
14
+
15
+ > Different audience than eli5. ELI5 is for developers who need to understand the system.
16
+ > Digest is for people who need to understand the *decisions* — and their business implications.
17
+
18
+ ## Shared Context
19
+
20
+ Read from parent `blueprint/` skill directory:
21
+ - `config/state.toml` — ADR directory
22
+ - `config/relationships.toml` — decision dependencies
23
+ - `config/taxonomy.toml` — severity levels
24
+
25
+ ## Process
26
+
27
+ ### Step 1: Read All Decisions
28
+
29
+ Read all ADR files. Categorize by:
30
+ - Status (Accepted, Proposed, Deferred, Rejected, Deprecated, Superseded)
31
+ - Category from taxonomy (Technology, Architecture, Data, Deployment, Security, etc.)
32
+ - Severity (High, Medium, Low)
33
+ - Date
34
+
35
+ ### Step 2: Generate Digest
36
+
37
+ ```
38
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
39
+ ARCHITECTURE DIGEST — [Project Name]
40
+ Generated: [date]
41
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
42
+
43
+ ## Summary
44
+
45
+ [2-3 sentences: what the system is, how many architectural decisions
46
+ have been made, overall health/maturity assessment]
47
+
48
+ Decisions: [N] accepted | [M] proposed | [K] deferred
49
+
50
+ ## Key Decisions
51
+
52
+ [Top 5-7 highest-severity accepted decisions. For each:]
53
+
54
+ ### [Decision title — no technical terms]
55
+
56
+ **What:** [One sentence — what was decided, in business language]
57
+ **Why:** [One sentence — what problem this solves or risk it mitigates]
58
+ **Trade-off:** [One sentence — what was given up]
59
+ **Status:** Accepted [date]
60
+
61
+ [Group by theme if possible: "Data & Storage", "Security", "Performance"]
62
+
63
+ ## Pending Decisions ([N])
64
+
65
+ [Proposed ADRs awaiting review — these need attention:]
66
+
67
+ - **[Title]** — [Why it matters to the business. What's blocked until decided.]
68
+
69
+ ## Deferred Decisions ([N])
70
+
71
+ [Decisions explicitly postponed — these are conscious risks:]
72
+
73
+ - **[Title]** — Deferred because [reason]. Trigger: [when to revisit].
74
+ **Risk if ignored:** [business impact of never deciding]
75
+
76
+ ## Risk Register
77
+
78
+ | Risk | Severity | Source | Mitigation |
79
+ |------|----------|--------|------------|
80
+ | [business-language risk] | High/Med/Low | ADR-NNNN | [what's being done] |
81
+
82
+ [Derive from ADR consequences sections — translate technical risks
83
+ to business risks: "Data loss" not "Missing ACID guarantees"]
84
+
85
+ ## Decision Timeline
86
+
87
+ [Chronological narrative — 3-5 sentences:]
88
+ "In [month], the team decided to [first major decision]. This was followed
89
+ by [second decision] in [month], which [enabled/constrained] [what].
90
+ Currently, [N] decisions are pending review."
91
+
92
+ ## What Needs Attention
93
+
94
+ [Actionable items for stakeholders — at most 3:]
95
+ 1. [Most urgent — what decision needs to be made and by when]
96
+ 2. [Second priority]
97
+ 3. [Upcoming trigger that will require a decision]
98
+ ```
99
+
100
+ ### Step 3: Tone
101
+
102
+ - No technical terms. "Database" is ok. "ORM" is not.
103
+ - Focus on business impact. "This saves $X/month" not "this reduces query latency"
104
+ - Risks in terms stakeholders understand: "data loss", "security breach", "launch delay"
105
+ - Short. If it's longer than one printed page, it's too long.
106
+ - No code snippets, file paths, or architecture diagrams. This is prose.
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: blueprint:drift
3
+ description: >
4
+ Detect gradual architectural drift by comparing codebase evolution against ADR expectations
5
+ over time. Not a point-in-time audit but a trajectory analysis. Use when: "check for drift",
6
+ "is the architecture eroding?", "drift analysis", "architecture trajectory", "are we
7
+ drifting from our decisions?", or periodically as a health check.
8
+ ---
9
+
10
+ # Architecture Drift Detection
11
+
12
+ Detects gradual architectural erosion — the kind where every individual commit is fine
13
+ but the aggregate trajectory moves away from the architecture. The building inspector
14
+ who compares photographs six months apart.
15
+
16
+ ## Shared Context
17
+
18
+ Read from parent `blueprint/` skill directory:
19
+ - `config/state.toml` — ADR directory, last operations
20
+ - `config/relationships.toml` — ADR dependency graph
21
+ - `agents/persona.md` — personality
22
+
23
+ ## Process
24
+
25
+ ### Step 1: Establish the Baseline
26
+
27
+ Read all accepted ADRs and extract what the architecture *should* look like:
28
+ - Module boundaries and their responsibilities
29
+ - Dependency direction rules
30
+ - Technology constraints
31
+ - Pattern expectations
32
+
33
+ Read `docs/ARCHITECTURE.md` if it exists for the canonical map.
34
+
35
+ ### Step 2: Analyze Git History for Trajectory
36
+
37
+ Examine recent git history (configurable, default: last 3 months):
38
+
39
+ ```bash
40
+ # File churn — which areas change most?
41
+ git log --since="3 months ago" --name-only --pretty=format: | sort | uniq -c | sort -rn | head -30
42
+
43
+ # Cross-boundary commits — changes that touch multiple modules simultaneously
44
+ git log --since="3 months ago" --name-only --pretty=format:"---COMMIT---" | ...
45
+
46
+ # New files — where is the codebase growing?
47
+ git log --since="3 months ago" --diff-filter=A --name-only --pretty=format: | sort | uniq -c | sort -rn
48
+
49
+ # Deleted files — where is it shrinking?
50
+ git log --since="3 months ago" --diff-filter=D --name-only --pretty=format:
51
+ ```
52
+
53
+ ### Step 3: Detect Drift Patterns
54
+
55
+ For each accepted ADR, check if recent changes are moving toward or away from it:
56
+
57
+ **Boundary erosion:** Module A was self-contained 3 months ago. Now it imports from
58
+ 3 new modules. The boundary is dissolving.
59
+
60
+ **Responsibility creep:** A module that ADR-NNNN defines as "handles X" now also
61
+ does Y and Z. Functions and files are accumulating outside the original scope.
62
+
63
+ **Technology sprawl:** ADR says "use PostgreSQL." New code includes SQLite imports,
64
+ a Redis client, and a JSON file database. The single-technology decision is fragmenting.
65
+
66
+ **Pattern divergence:** ADR says "two-stage pipeline." Recent commits add a shortcut
67
+ path that bypasses stage 1. The pattern is being undermined.
68
+
69
+ **Dependency inversion:** ADR says "services depend on repositories, not vice versa."
70
+ Recent imports show repositories importing from services.
71
+
72
+ ### Step 4: Quantify Drift
73
+
74
+ For each detected drift:
75
+
76
+ - **Direction:** Drifting TOWARD or AWAY from the ADR's intent
77
+ - **Velocity:** How fast — number of drift-contributing commits per month
78
+ - **Severity:** LOW (cosmetic), MEDIUM (architectural tension), HIGH (invariant violated)
79
+ - **Reversibility:** Easy (rename/move), Moderate (refactor), Hard (rewrite)
80
+
81
+ ### Step 5: Report
82
+
83
+ ```
84
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
+ BLUEPRINT ► DRIFT ANALYSIS
86
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
87
+
88
+ Period: [start] — [end]
89
+ Overall trajectory: STABLE / DRIFTING / ERODING
90
+
91
+ | ADR | Decision | Drift | Velocity | Severity |
92
+ |-----|----------|-------|----------|----------|
93
+ | ... | ... | TOWARD/AWAY/STABLE | N commits/mo | H/M/L |
94
+
95
+ ## Drift Details
96
+ [Per-ADR analysis with evidence]
97
+
98
+ ## Recommendations
99
+ - [Highest-impact corrective actions]
100
+ - [ADRs that may need revision to match reality]
101
+ ```
102
+
103
+ Suggest `/blueprint:rearchitect` for ADRs where reality has legitimately diverged
104
+ from the decision — sometimes the drift is correct and the ADR is wrong.
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: blueprint:eli5
3
+ description: >
4
+ Explain an ADR or the entire architectural landscape in plain English. No jargon, no
5
+ acronyms left unexpanded, concrete analogies. Use when: "explain adr N", "eli5 adr N",
6
+ "what does adr 3 mean?", "explain architecture", "eli5 the whole thing", "summarise
7
+ our decisions", "what have we decided so far?", "give me the big picture", or when
8
+ onboarding someone who hasn't read the ADRs.
9
+ ---
10
+
11
+ # ELI5 — Explain Like I'm 5 (but an intelligent 5)
12
+
13
+ Two modes depending on whether a number is provided:
14
+
15
+ - **`/blueprint:eli5 N`** — Explain a single ADR in plain English
16
+ - **`/blueprint:eli5`** (no number) — Explain the entire architectural landscape
17
+
18
+ No jargon survives this skill. Every technical term gets an analogy. Every decision gets
19
+ a "so what?" The goal is that someone who has never read an ADR can understand what was
20
+ decided and why it matters after reading the output.
21
+
22
+ ## Shared Context
23
+
24
+ Read from parent `blueprint/` skill directory:
25
+ - `config/state.toml` — ADR directory location
26
+ - `config/relationships.toml` — how ADRs relate to each other
27
+
28
+ ## Mode 1: Single ADR (`/blueprint:eli5 N`)
29
+
30
+ Read the specified ADR file. Produce a plain-English explanation with this structure:
31
+
32
+ ```
33
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
34
+ BLUEPRINT ► ELI5: ADR-NNNN
35
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
36
+
37
+ ## The Problem
38
+
39
+ [1-2 sentences: what situation made this decision necessary.
40
+ Use a real-world analogy. Not "we needed a database" but "we needed
41
+ somewhere to store patient records that wouldn't lose data if the
42
+ power went out."]
43
+
44
+ ## What We Decided
45
+
46
+ [1-2 sentences: the decision in plain English. No acronyms.
47
+ "We chose PostgreSQL" becomes "We chose a traditional relational
48
+ database (PostgreSQL) — think of it as a very organized filing
49
+ cabinet where every drawer has a label and everything is
50
+ cross-referenced."]
51
+
52
+ ## What We Considered
53
+
54
+ [For each option that was evaluated, one sentence:]
55
+ - **[Option]**: [Plain English description + why we didn't pick it]
56
+
57
+ ## Why This One
58
+
59
+ [2-3 sentences: the actual rationale in non-technical terms.
60
+ What made this option better than the others for our situation?]
61
+
62
+ ## What This Means for You
63
+
64
+ [1-3 bullets: practical consequences a developer would care about.
65
+ "So what?" answers:]
66
+ - If you need to X, do it this way because of this decision
67
+ - Don't do Y — this decision rules it out
68
+ - This connects to ADR-NNNN which decided [related thing]
69
+
70
+ ## The Trade-Off
71
+
72
+ [1 sentence: what we gave up by making this choice.
73
+ Every decision has a cost. Name it plainly.]
74
+ ```
75
+
76
+ **Rules:**
77
+ - Every acronym gets expanded AND explained on first use
78
+ - Technical terms get a concrete analogy (not "asynchronous processing" but "like a restaurant where you order at the counter and they call your number when it's ready")
79
+ - No hedging — state things directly
80
+ - Keep total length under 30 lines
81
+ - If the ADR references other ADRs, briefly note the connection
82
+
83
+ ## Mode 2: Full Landscape (`/blueprint:eli5`, no number)
84
+
85
+ Read ALL ADR files and `docs/ARCHITECTURE.md` if it exists. Produce a narrative summary
86
+ of the entire architectural landscape:
87
+
88
+ ```
89
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
90
+ BLUEPRINT ► ELI5: THE BIG PICTURE
91
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
92
+
93
+ ## What We're Building
94
+
95
+ [2-3 sentences from ARCHITECTURE.md or inferred from ADRs.
96
+ Plain English, no jargon.]
97
+
98
+ ## The Key Decisions (in order of importance)
99
+
100
+ [Group related ADRs into themes. For each theme:]
101
+
102
+ ### [Theme: e.g., "How We Store Data"]
103
+
104
+ We decided to [plain English summary]. This means [practical
105
+ consequence]. (ADR-NNNN, ADR-MMMM)
106
+
107
+ ### [Theme: e.g., "How the AI Works"]
108
+
109
+ ...
110
+
111
+ [Continue for each theme. 3-6 themes typical.]
112
+
113
+ ## The Rules
114
+
115
+ [From ARCHITECTURE.md invariants or inferred from ADRs.
116
+ Plain English list of things you must not do:]
117
+
118
+ 1. Never [rule] — because [one-sentence reason]
119
+ 2. Always [rule] — because [one-sentence reason]
120
+
121
+ ## What We Deliberately Don't Do
122
+
123
+ [From out-of-scope decisions and rejected ADRs.
124
+ These are just as important as what we do:]
125
+
126
+ - We don't [thing] — because [reason]
127
+
128
+ ## The 30-Second Version
129
+
130
+ [One paragraph. If someone reads nothing else, they read this.
131
+ What is it, what are the 3 most important decisions, what are
132
+ the 2 most important rules.]
133
+ ```
134
+
135
+ **Rules for full landscape:**
136
+ - Group by theme, not by ADR number — humans think in topics, not sequence numbers
137
+ - Read `config/relationships.toml` to identify clusters of related ADRs
138
+ - Lead with the most impactful decisions, not the first ones chronologically
139
+ - The 30-second version at the end is the most important part — write it last
140
+ - Keep total length under 80 lines
141
+ - If there are more than 15 ADRs, focus on the top 10 by impact and mention the rest as "also decided: [list]"
142
+
143
+ ## Tone
144
+
145
+ This is the ONE skill where the cranky senior engineer persona softens slightly. The
146
+ persona still applies — direct, no hedging, no fluff — but the goal is comprehension,
147
+ not challenge. Think of it as the senior engineer explaining the system to a smart new
148
+ hire on their first day. Patient about the concepts, impatient about unnecessary
149
+ complexity in the explanation itself.
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: blueprint:evaluate
3
+ description: >
4
+ Run the architecture evaluation team — 5 specialized agents analyzing consistency, bug surface,
5
+ maintainability, testing strategy, and Conway's Law alignment. Use when: "evaluate architecture",
6
+ "arch eval", "architecture review", "system evaluation", "evaluate codebase". Run individual
7
+ dimensions with: "/blueprint:evaluate consistency", "/blueprint:evaluate testing", etc. Produces a
8
+ comprehensive report with proposed ADRs for critical findings.
9
+ ---
10
+
11
+ # Architecture Evaluation Team
12
+
13
+ Spawns a team of 5 specialized agents in parallel to produce a comprehensive architecture
14
+ evaluation. Each agent focuses on one dimension. Results are synthesized into a unified
15
+ report with proposed ADRs for the most critical findings.
16
+
17
+ ## Shared Context
18
+
19
+ Read from parent `adr/` skill directory:
20
+ - `config/taxonomy.toml` — evaluation dimensions with agent mappings
21
+ - `config/state.toml` — last evaluation date, ADR directory
22
+ - `agents/persona.md` — shared personality
23
+
24
+ ## Dimensions
25
+
26
+ Read `config/taxonomy.toml` `evaluation_dimensions` for the canonical list. Currently:
27
+
28
+ | Dimension | Agent | Aspect Focus |
29
+ |-----------|-------|-------------|
30
+ | consistency | adr-consistency-auditor | naming, layering, dependency direction, error handling |
31
+ | bugs | adr-bug-surface-mapper | complexity, coupling, boundaries, state, implicit contracts |
32
+ | maintainability | adr-maintainability-assessor | dependencies, abstractions, change amplification, debt |
33
+ | testing | adr-testing-strategy-evaluator | pyramid, risk coverage, anti-pattern tests, quality |
34
+ | conways | adr-conways-law-analyzer | ownership, friction points, bottlenecks, scaling |
35
+
36
+ ## Process
37
+
38
+ ### Full Evaluation (`/blueprint:evaluate`)
39
+
40
+ 1. Read all 5 agent files + `agents/persona.md` from parent skill directory
41
+ 2. Spawn all 5 agents in parallel (single message, 5 Agent tool calls) with:
42
+ - Full agent instructions + persona
43
+ - Project root path, ADR directory path
44
+ - List of existing ADR filenames
45
+ 3. As agents complete, collect their reports
46
+ 4. **Synthesize unified report:**
47
+ - Overall health score: STRONG / ADEQUATE / CONCERNING / CRITICAL
48
+ - Top 3 risks across all dimensions
49
+ - Top 3 strengths across all dimensions
50
+ 5. **Collect proposed ADRs** from all agent reports, deduplicate, prioritize
51
+ 6. Ask user which to create:
52
+ - "Create all proposed ADRs"
53
+ - "Let me pick" — present list for selection
54
+ - "Report only" — skip ADR creation
55
+ 7. Draft selected ADRs via the `/blueprint:new` flow
56
+ 8. Update `config/state.toml` — set `last_evaluation` to today, append to evaluation_history
57
+
58
+ ### Individual Evaluation (`/blueprint:evaluate [dimension]`)
59
+
60
+ Spawn only the specified dimension's agent. Same process but single agent, no synthesis step.
61
+ Valid dimensions: `consistency`, `bugs`, `maintainability`, `testing`, `conways`.
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: blueprint:fitness
3
+ description: >
4
+ Generate executable architecture fitness functions from accepted ADRs. Produces test files
5
+ that enforce architectural invariants as CI-runnable checks. Use when: "generate fitness
6
+ functions", "architecture tests", "enforce invariants", "create architecture guards",
7
+ "fitness functions from adrs", or after accepting ADRs with structural constraints.
8
+ ---
9
+
10
+ # Architecture Fitness Functions
11
+
12
+ Translates accepted ADR invariants into executable test files. Fitness functions are
13
+ unit tests for architecture — they run in CI and fail when architectural constraints
14
+ are violated.
15
+
16
+ > "An architecture that isn't tested will drift. An architecture with fitness functions
17
+ > drifts and gets caught."
18
+
19
+ ## Shared Context
20
+
21
+ Read from parent `blueprint/` skill directory:
22
+ - `config/state.toml` — ADR directory location
23
+ - `config/taxonomy.toml` — severity levels
24
+ - `agents/persona.md` — personality
25
+
26
+ ## Process
27
+
28
+ ### Step 1: Extract Testable Invariants
29
+
30
+ Read all accepted ADRs. For each, determine if the decision produces a testable
31
+ invariant:
32
+
33
+ **Testable invariants (generate fitness functions):**
34
+ - Dependency direction rules: "Module A must not import from module B"
35
+ - Technology constraints: "All database access must go through the ORM"
36
+ - Pattern enforcement: "All API endpoints must have input validation"
37
+ - Boundary rules: "No direct database queries outside the repository layer"
38
+ - Constraint rules: "All code suggestions must come from the validated database"
39
+ - File structure rules: "Every service must have a corresponding test file"
40
+
41
+ **Non-testable (skip):**
42
+ - Process decisions: "Use ADRs for decisions"
43
+ - Deployment decisions: "Deploy as standalone web app"
44
+ - Deferred decisions: "Defer auth to v2"
45
+
46
+ ### Step 2: Generate Test Files
47
+
48
+ For each testable invariant, generate an executable test:
49
+
50
+ **Detect the project's test framework:**
51
+ - Python: pytest (check for pytest.ini, conftest.py, pyproject.toml [tool.pytest])
52
+ - JavaScript/TypeScript: vitest or jest (check package.json)
53
+ - Go: go test (check go.mod)
54
+ - If unclear, ask the user
55
+
56
+ **Test file naming:** `tests/architecture/test_adr_NNNN.py` (or equivalent)
57
+
58
+ **Each test includes:**
59
+ ```python
60
+ """
61
+ Architecture Fitness Function: ADR-NNNN — [Title]
62
+
63
+ This test enforces the architectural invariant from ADR-NNNN.
64
+ If this test fails, either fix the code to comply with the ADR,
65
+ or create a new ADR to formally change the decision.
66
+
67
+ DO NOT skip or delete this test without updating the ADR.
68
+ """
69
+ ```
70
+
71
+ **Test patterns by invariant type:**
72
+
73
+ Dependency direction:
74
+ ```python
75
+ def test_adr_NNNN_no_service_imports_from_api():
76
+ """Services must not import from the API layer (ADR-NNNN)."""
77
+ violations = find_imports(source_dir="src/services", forbidden_pattern="from src.api")
78
+ assert not violations, f"Dependency violation: {violations}"
79
+ ```
80
+
81
+ Technology constraint:
82
+ ```python
83
+ def test_adr_NNNN_no_raw_sql():
84
+ """All database access must use the ORM (ADR-NNNN)."""
85
+ violations = grep_source(pattern=r"cursor\.execute|\.raw\(", exclude_dirs=["migrations"])
86
+ assert not violations, f"Raw SQL found: {violations}"
87
+ ```
88
+
89
+ Pattern enforcement:
90
+ ```python
91
+ def test_adr_NNNN_all_endpoints_validated():
92
+ """Every API endpoint must have Pydantic input validation (ADR-NNNN)."""
93
+ endpoints = find_route_handlers("src/api")
94
+ unvalidated = [e for e in endpoints if not has_pydantic_param(e)]
95
+ assert not unvalidated, f"Unvalidated endpoints: {unvalidated}"
96
+ ```
97
+
98
+ ### Step 3: Generate Helper Module
99
+
100
+ Create `tests/architecture/conftest.py` (or equivalent) with shared utilities:
101
+ - `find_imports(source_dir, forbidden_pattern)` — grep for import violations
102
+ - `grep_source(pattern, include_dirs, exclude_dirs)` — regex search across source
103
+ - `find_files(pattern, directory)` — glob for structural checks
104
+ - `assert_no_violations(violations, adr_id, message)` — standard assertion
105
+
106
+ ### Step 4: Present and Commit
107
+
108
+ Show the user:
109
+ - How many ADRs produced fitness functions
110
+ - List of generated test files
111
+ - How to run them: `pytest tests/architecture/` or equivalent
112
+
113
+ Commit: `test(architecture): generate fitness functions from [N] ADRs`
114
+
115
+ ## Updating Fitness Functions
116
+
117
+ When an ADR is superseded or deprecated, the corresponding fitness function should
118
+ be updated or removed. Suggest running `/blueprint:fitness` after any ADR lifecycle
119
+ transition that changes invariants.