@abdullah-alnahas/claude-sdd 0.6.0 → 0.8.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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +23 -1
- package/agents/planner.md +78 -0
- package/commands/sdd-autopilot.md +19 -7
- package/commands/sdd-execute.md +18 -0
- package/commands/sdd-mode.md +42 -0
- package/commands/sdd-orchestrate.md +103 -0
- package/commands/sdd-phase.md +1 -1
- package/commands/sdd-review.md +52 -18
- package/commands/sdd-verify.md +87 -0
- package/contexts/dev.md +25 -0
- package/contexts/research.md +26 -0
- package/contexts/review.md +25 -0
- package/hooks/hooks.json +14 -3
- package/hooks/scripts/compaction-counter.sh +31 -0
- package/hooks/scripts/post-edit-review.sh +11 -4
- package/hooks/scripts/session-init.sh +44 -3
- package/package.json +1 -1
- package/scripts/verify-commands.sh +2 -2
- package/scripts/verify-hooks.sh +30 -8
- package/scripts/verify-skills.sh +1 -1
- package/skills/architecture-aware/SKILL.md +4 -5
- package/skills/guardrails/SKILL.md +51 -5
- package/skills/guardrails/references/failure-patterns.md +5 -0
- package/skills/iterative-execution/SKILL.md +21 -6
- package/skills/iterative-execution/references/retrieval-pattern.md +65 -0
- package/skills/iterative-execution/references/review-prompts.md +69 -0
- package/skills/performance-optimization/SKILL.md +5 -4
- package/skills/spec-first/SKILL.md +4 -4
- package/skills/tdd-discipline/SKILL.md +23 -6
- package/skills/using-sdd/SKILL.md +82 -0
- package/skills/using-sdd/references/skill-creation-process.md +54 -0
package/README.md
CHANGED
|
@@ -51,7 +51,10 @@ Profile-first discipline for performance work. Defends against convenience bias
|
|
|
51
51
|
| `/sdd-guardrails` | Show/toggle guardrail status |
|
|
52
52
|
| `/sdd-yolo` | Disable all guardrails (auto-clears next session) |
|
|
53
53
|
| `/sdd-phase` | Show/set development phase |
|
|
54
|
-
| `/sdd-
|
|
54
|
+
| `/sdd-mode` | Switch context mode (dev/review/research) |
|
|
55
|
+
| `/sdd-review` | Two-stage review — spec compliance then code quality |
|
|
56
|
+
| `/sdd-verify` | Automated checks — build, types, lint, tests, security scans |
|
|
57
|
+
| `/sdd-orchestrate` | Agent pipelines — feature, bugfix, refactor, security, or custom |
|
|
55
58
|
| `/sdd-adopt` | Adopt an existing project into SDD |
|
|
56
59
|
| `/sdd-execute` | Start iterative execution loop against a spec |
|
|
57
60
|
| `/sdd-autopilot` | Full autonomous lifecycle: specify → design → implement → verify → review |
|
|
@@ -65,6 +68,23 @@ Profile-first discipline for performance work. Defends against convenience bias
|
|
|
65
68
|
| **spec-compliance** | Spec adherence checker — verifies traceability (spec → test → code) |
|
|
66
69
|
| **security-reviewer** | Security analysis — OWASP Top 10, input validation, auth review |
|
|
67
70
|
| **performance-reviewer** | Performance optimization reviewer — validates patches for bottleneck targeting, convenience bias, measured improvement |
|
|
71
|
+
| **planner** | Implementation planner — reads specs/architecture and produces ordered steps |
|
|
72
|
+
|
|
73
|
+
## Context Modes
|
|
74
|
+
|
|
75
|
+
SDD supports three context modes that adjust which guardrails are active:
|
|
76
|
+
|
|
77
|
+
| Mode | Focus | Pre-Implementation | Completion Review | Scope Guard |
|
|
78
|
+
|------|-------|-------------------|-------------------|-------------|
|
|
79
|
+
| **dev** (default) | Build correctly | Active | Active | Strict |
|
|
80
|
+
| **review** | Verify and critique | Skipped | Active | Normal |
|
|
81
|
+
| **research** | Explore freely | Skipped | Skipped | Relaxed |
|
|
82
|
+
|
|
83
|
+
Set mode with `/sdd-mode <mode>` or set a default in `.sdd.yaml`:
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
mode: dev # dev | review | research
|
|
87
|
+
```
|
|
68
88
|
|
|
69
89
|
## Configuration
|
|
70
90
|
|
|
@@ -73,6 +93,8 @@ Create `.sdd.yaml` in your project root:
|
|
|
73
93
|
```yaml
|
|
74
94
|
verbosity: standard # minimal | standard | verbose
|
|
75
95
|
enabled: true
|
|
96
|
+
mode: dev # dev | review | research
|
|
97
|
+
compaction_threshold: 50 # tool invocations before suggesting /compact
|
|
76
98
|
|
|
77
99
|
guardrails:
|
|
78
100
|
pre-implementation:
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: planner
|
|
3
|
+
model: sonnet
|
|
4
|
+
color: blue
|
|
5
|
+
description: >
|
|
6
|
+
Reads specs, architecture docs, and codebase structure to produce ordered implementation steps.
|
|
7
|
+
Use when starting a feature, breaking down a task, or needing an implementation roadmap.
|
|
8
|
+
|
|
9
|
+
<example>
|
|
10
|
+
Context: User has a spec and wants to know what to implement first.
|
|
11
|
+
user: "Break down this feature into implementation steps"
|
|
12
|
+
assistant: "I'll use the planner agent to analyze the spec and produce an ordered implementation plan."
|
|
13
|
+
</example>
|
|
14
|
+
|
|
15
|
+
<example>
|
|
16
|
+
Context: User is starting a new feature from a behavior spec.
|
|
17
|
+
user: "Plan the implementation for this spec"
|
|
18
|
+
assistant: "Let me launch the planner agent to create an implementation roadmap."
|
|
19
|
+
</example>
|
|
20
|
+
|
|
21
|
+
<example>
|
|
22
|
+
Context: User needs to understand implementation order and dependencies.
|
|
23
|
+
user: "What should I build first?"
|
|
24
|
+
assistant: "I'll use the planner agent to analyze dependencies and suggest an implementation order."
|
|
25
|
+
</example>
|
|
26
|
+
allowed-tools:
|
|
27
|
+
- Read
|
|
28
|
+
- Glob
|
|
29
|
+
- Grep
|
|
30
|
+
- Bash
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
# Planner Agent
|
|
34
|
+
|
|
35
|
+
You analyze specs, architecture, and codebase structure to produce ordered implementation steps. You plan — you do not implement.
|
|
36
|
+
|
|
37
|
+
## Planning Process
|
|
38
|
+
|
|
39
|
+
1. **Read the spec** — understand what needs to be built (behavior spec, acceptance criteria)
|
|
40
|
+
2. **Read architecture docs** — understand the system structure (if available)
|
|
41
|
+
3. **Scan the codebase** — identify existing patterns, conventions, relevant files
|
|
42
|
+
4. **Identify dependencies** — what must exist before other things can be built
|
|
43
|
+
5. **Produce ordered steps** — a sequence that respects dependencies and enables incremental testing
|
|
44
|
+
|
|
45
|
+
## Output Format
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
## Implementation Plan
|
|
49
|
+
|
|
50
|
+
### Prerequisites
|
|
51
|
+
[What must be true before starting — dependencies, setup, existing code to understand]
|
|
52
|
+
|
|
53
|
+
### Steps
|
|
54
|
+
|
|
55
|
+
1. **Step title** — Brief description
|
|
56
|
+
- Files: `path/to/file.ts` (create | modify)
|
|
57
|
+
- Depends on: (none | step N)
|
|
58
|
+
- Test: How to verify this step works
|
|
59
|
+
|
|
60
|
+
2. **Step title** — Brief description
|
|
61
|
+
- Files: `path/to/file.ts` (create | modify)
|
|
62
|
+
- Depends on: Step 1
|
|
63
|
+
- Test: How to verify this step works
|
|
64
|
+
|
|
65
|
+
### Risks
|
|
66
|
+
[Potential issues, ambiguities in the spec, architectural concerns]
|
|
67
|
+
|
|
68
|
+
### Suggested Order
|
|
69
|
+
[If steps can be parallelized, note which can run concurrently]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Planning Standards
|
|
73
|
+
|
|
74
|
+
- **Respect existing patterns** — don't suggest new conventions when the codebase has established ones
|
|
75
|
+
- **Small steps** — each step should be independently testable
|
|
76
|
+
- **Dependencies are explicit** — never assume step order is obvious
|
|
77
|
+
- **Tests at every step** — every step includes how to verify it
|
|
78
|
+
- **Be honest about unknowns** — flag ambiguities, don't paper over them
|
|
@@ -54,29 +54,41 @@ When invoked, execute the following phases in order. Announce each phase transit
|
|
|
54
54
|
|
|
55
55
|
**Input**: Behavior spec + roadmap from previous phases.
|
|
56
56
|
**Actions**:
|
|
57
|
-
1. Work through roadmap items in priority order
|
|
57
|
+
1. Work through roadmap items in priority order, in **batches of 3**
|
|
58
58
|
2. For each item, use TDD:
|
|
59
59
|
- Write failing test(s) that cover the relevant acceptance criteria
|
|
60
60
|
- Write minimal code to pass
|
|
61
61
|
- Refactor
|
|
62
|
-
3. After each
|
|
62
|
+
3. After each batch of 3 items:
|
|
63
|
+
- Run available verification (test suite, linters, type checks)
|
|
64
|
+
- Report progress with verification evidence (actual test output)
|
|
65
|
+
- Pause for user feedback before continuing
|
|
63
66
|
4. If tests fail, fix using TDD (understand failure → write targeted fix → verify)
|
|
64
67
|
5. Continue until all roadmap items complete
|
|
65
68
|
|
|
66
69
|
Use the iterative execution outer loop: implement → verify → fix gaps → repeat (max 10 iterations per roadmap item).
|
|
67
70
|
|
|
68
|
-
**Transition
|
|
71
|
+
**Transition** (only when all items are complete): "Implement phase complete — all M roadmap items done. Entering Verify phase."
|
|
69
72
|
|
|
70
73
|
### Phase 4: Verify
|
|
71
74
|
|
|
72
75
|
**Input**: Implementation from Phase 3.
|
|
73
76
|
**Actions**:
|
|
77
|
+
Use the two-stage review process (see `/sdd-review`):
|
|
78
|
+
|
|
79
|
+
**Stage 1 — Spec Compliance:**
|
|
74
80
|
1. Run full test suite
|
|
75
81
|
2. Invoke **spec-compliance agent** — compare implementation against behavior-spec.md
|
|
76
|
-
3.
|
|
77
|
-
4.
|
|
78
|
-
5.
|
|
79
|
-
|
|
82
|
+
3. DO NOT trust the implementation report. Read actual code and test output independently.
|
|
83
|
+
4. For each acceptance criterion: PASS / FAIL / PARTIAL with evidence
|
|
84
|
+
5. Stage 1 must pass before proceeding to Stage 2
|
|
85
|
+
|
|
86
|
+
**Stage 2 — Code Quality:**
|
|
87
|
+
6. Invoke **critic agent** — find logical errors, assumption issues
|
|
88
|
+
7. Invoke **simplifier agent** — find unnecessary complexity
|
|
89
|
+
8. Invoke **security-reviewer agent** — check for vulnerabilities
|
|
90
|
+
9. If performance optimization was part of the spec, invoke **performance-reviewer agent**
|
|
91
|
+
10. Collect all findings
|
|
80
92
|
|
|
81
93
|
**Transition**: "Verify phase complete — N findings (X critical, Y high, Z medium). Entering Review phase."
|
|
82
94
|
|
package/commands/sdd-execute.md
CHANGED
|
@@ -73,9 +73,27 @@ No critical issues from critic agent.
|
|
|
73
73
|
Completion is genuine — verified against spec.
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
+
## Batch Execution
|
|
77
|
+
|
|
78
|
+
When working on multiple criteria or tasks, group them into batches of 3:
|
|
79
|
+
|
|
80
|
+
1. Implement batch (3 criteria/tasks) using TDD
|
|
81
|
+
2. Verify the batch — run tests, check spec compliance
|
|
82
|
+
3. Report progress with verification evidence (test output, not claims)
|
|
83
|
+
4. Pause for user feedback before continuing to the next batch
|
|
84
|
+
|
|
85
|
+
This prevents long unverified runs and gives the user control over direction.
|
|
86
|
+
|
|
87
|
+
## Verification
|
|
88
|
+
|
|
89
|
+
After each batch, use the two-stage review process:
|
|
90
|
+
- **Stage 1**: Spec compliance — verify each criterion with evidence (see `/sdd-review`)
|
|
91
|
+
- **Stage 2**: Code quality — only after Stage 1 passes
|
|
92
|
+
|
|
76
93
|
## Principles
|
|
77
94
|
|
|
78
95
|
- TDD is the inner discipline: every piece of new code starts with a failing test
|
|
79
96
|
- The outer loop verifies against the spec, not just test results
|
|
80
97
|
- Honest reporting: never claim done when criteria are unsatisfied
|
|
81
98
|
- Bounded: max iterations prevent infinite loops
|
|
99
|
+
- Batch execution: groups of 3 with checkpoint reports
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdd-mode
|
|
3
|
+
description: Switch SDD context mode (dev/review/research). Controls which guardrails are active.
|
|
4
|
+
argument-hint: "[dev|review|research]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# /sdd-mode
|
|
11
|
+
|
|
12
|
+
Switch the active SDD context mode. Each mode adjusts which guardrails, hooks, and checks are active.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
- `/sdd-mode` — Show current mode
|
|
17
|
+
- `/sdd-mode dev` — Full guardrails (default)
|
|
18
|
+
- `/sdd-mode review` — Review/verification focus
|
|
19
|
+
- `/sdd-mode research` — Exploration focus, relaxed guardrails
|
|
20
|
+
|
|
21
|
+
## Modes
|
|
22
|
+
|
|
23
|
+
| Mode | Pre-Implementation Checkpoint | Completion Review | Scope Guard | Focus |
|
|
24
|
+
|------|------------------------------|-------------------|-------------|-------|
|
|
25
|
+
| **dev** | Active | Active | Strict | Build correctly — TDD, spec compliance, full discipline |
|
|
26
|
+
| **review** | Skipped | Active | Normal | Verify and critique — find issues, check quality |
|
|
27
|
+
| **research** | Skipped | Skipped | Relaxed | Explore and understand — read code, trace flows, prototype |
|
|
28
|
+
|
|
29
|
+
## Behavior
|
|
30
|
+
|
|
31
|
+
When invoked with an argument:
|
|
32
|
+
1. Write `SDD_MODE=<mode>` to `$CLAUDE_ENV_FILE`
|
|
33
|
+
2. Read the corresponding context file from `contexts/<mode>.md`
|
|
34
|
+
3. Report the mode switch and what changed
|
|
35
|
+
|
|
36
|
+
When invoked without an argument:
|
|
37
|
+
1. Read `$SDD_MODE` (default: `dev`)
|
|
38
|
+
2. Report current mode and its settings
|
|
39
|
+
|
|
40
|
+
## Context Files
|
|
41
|
+
|
|
42
|
+
Each mode has a context file at `contexts/<mode>.md` that is loaded by the session init hook. These define the behavioral adjustments for that mode. See `.sdd.yaml` to set a default mode per project.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdd-orchestrate
|
|
3
|
+
description: Run named agent pipelines with structured handoffs — feature, bugfix, refactor, security, or custom.
|
|
4
|
+
argument-hint: "<pipeline> [agent1,agent2,...]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Read
|
|
7
|
+
- Write
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Bash
|
|
12
|
+
- Task
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# /sdd-orchestrate
|
|
16
|
+
|
|
17
|
+
Run a named pipeline of agents with structured handoffs. Each agent receives the previous agent's findings and builds on them.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
- `/sdd-orchestrate feature` — Full feature review pipeline
|
|
22
|
+
- `/sdd-orchestrate bugfix` — Bug-focused pipeline
|
|
23
|
+
- `/sdd-orchestrate refactor` — Refactoring review pipeline
|
|
24
|
+
- `/sdd-orchestrate security` — Security-focused pipeline
|
|
25
|
+
- `/sdd-orchestrate custom agent1,agent2,...` — User-specified agent sequence
|
|
26
|
+
|
|
27
|
+
## Named Pipelines
|
|
28
|
+
|
|
29
|
+
| Pipeline | Agent Sequence | Focus |
|
|
30
|
+
|----------|---------------|-------|
|
|
31
|
+
| **feature** | spec-compliance → planner → critic → security-reviewer | Complete feature validation |
|
|
32
|
+
| **bugfix** | critic → spec-compliance → simplifier | Find root cause, check spec, simplify fix |
|
|
33
|
+
| **refactor** | simplifier → critic → spec-compliance | Simplify, verify correctness, check spec |
|
|
34
|
+
| **security** | security-reviewer → critic → simplifier | Security first, then correctness, then cleanup |
|
|
35
|
+
|
|
36
|
+
### custom
|
|
37
|
+
|
|
38
|
+
Specify agents as a comma-separated list:
|
|
39
|
+
```
|
|
40
|
+
/sdd-orchestrate custom critic,simplifier,performance-reviewer
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Available agents: `critic`, `simplifier`, `spec-compliance`, `security-reviewer`, `performance-reviewer`, `planner`
|
|
44
|
+
|
|
45
|
+
## Handoff Format
|
|
46
|
+
|
|
47
|
+
Each agent produces a structured handoff:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
## Agent: <name>
|
|
51
|
+
|
|
52
|
+
### Findings
|
|
53
|
+
[Structured findings from this agent]
|
|
54
|
+
|
|
55
|
+
### Handoff
|
|
56
|
+
[Key information the next agent needs]
|
|
57
|
+
|
|
58
|
+
### Status: PASS | FAIL | NEEDS-ATTENTION
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Pipeline Behavior
|
|
62
|
+
|
|
63
|
+
1. Run each agent in sequence
|
|
64
|
+
2. Pass previous agent's findings as context to the next agent
|
|
65
|
+
3. **On FAIL**: Pause the pipeline and ask the user:
|
|
66
|
+
- Fix issues and re-run from the failed agent
|
|
67
|
+
- Continue to the next agent anyway
|
|
68
|
+
- Abort the pipeline
|
|
69
|
+
4. After all agents complete, produce a summary
|
|
70
|
+
|
|
71
|
+
## Summary Output
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
SDD Orchestrate — feature pipeline
|
|
75
|
+
────────────────────────────────────
|
|
76
|
+
|
|
77
|
+
✓ spec-compliance ............... PASS
|
|
78
|
+
✓ planner ....................... PASS (spec-compliance findings applied)
|
|
79
|
+
✗ critic ........................ FAIL (2 critical issues)
|
|
80
|
+
⊘ security-reviewer ............ SKIPPED (pipeline paused)
|
|
81
|
+
|
|
82
|
+
Pipeline: PAUSED at critic — 2 critical issues found
|
|
83
|
+
Action required: Fix issues before continuing
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Agent Prompt Template
|
|
87
|
+
|
|
88
|
+
When launching each agent, include:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
You are running as part of an SDD orchestration pipeline.
|
|
92
|
+
Pipeline: <pipeline-name>
|
|
93
|
+
Your position: Agent <N> of <total>
|
|
94
|
+
Previous findings:
|
|
95
|
+
<handoff from previous agent, or "First agent — no prior findings">
|
|
96
|
+
|
|
97
|
+
Your task: <agent's standard task>
|
|
98
|
+
Output your findings in the structured handoff format.
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## References
|
|
102
|
+
|
|
103
|
+
See agent definitions in `agents/` for each agent's review standards and output format.
|
package/commands/sdd-phase.md
CHANGED
|
@@ -63,5 +63,5 @@ Phase-specific agent recommendations:
|
|
|
63
63
|
- **specify**: spec-compliance (verify spec completeness)
|
|
64
64
|
- **design**: critic (architectural review), simplifier
|
|
65
65
|
- **implement**: spec-compliance (traceability), critic (logic review)
|
|
66
|
-
- **verify**: security-reviewer, performance-reviewer, spec-compliance
|
|
66
|
+
- **verify**: critic, security-reviewer, performance-reviewer, spec-compliance
|
|
67
67
|
- **review**: all agents
|
package/commands/sdd-review.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: sdd-review
|
|
3
|
-
description:
|
|
3
|
+
description: Two-stage review — spec compliance first, then code quality. Only proceeds to Stage 2 after Stage 1 passes.
|
|
4
4
|
argument-hint: "[--max-iterations <n>]"
|
|
5
5
|
allowed-tools:
|
|
6
6
|
- Read
|
|
@@ -14,41 +14,70 @@ allowed-tools:
|
|
|
14
14
|
|
|
15
15
|
# /sdd-review
|
|
16
16
|
|
|
17
|
-
Trigger
|
|
17
|
+
Trigger a two-stage review of recent work. Stage 1 verifies spec compliance. Stage 2 reviews code quality. Stage 2 only runs after Stage 1 passes.
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
20
20
|
|
|
21
21
|
- `/sdd-review` — Review recent changes
|
|
22
22
|
- `/sdd-review --max-iterations <n>` — Set max review-fix cycles (default: 3)
|
|
23
23
|
|
|
24
|
-
##
|
|
24
|
+
## Stage 1: Spec Compliance
|
|
25
|
+
|
|
26
|
+
**Goal**: Verify the implementation satisfies the behavior spec.
|
|
25
27
|
|
|
26
28
|
1. Identify what was recently changed (git diff or session context)
|
|
27
|
-
2.
|
|
28
|
-
3. Run the **
|
|
29
|
-
4.
|
|
30
|
-
5.
|
|
31
|
-
6.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
2. Find the relevant behavior spec and acceptance criteria
|
|
30
|
+
3. Run the **spec-compliance agent** with the Stage 1 prompt from `iterative-execution/references/review-prompts.md`
|
|
31
|
+
4. **DO NOT trust the implementation report.** Read the actual code and test output independently.
|
|
32
|
+
5. For each acceptance criterion: PASS / FAIL / PARTIAL with evidence
|
|
33
|
+
6. If any criterion fails:
|
|
34
|
+
- Present findings
|
|
35
|
+
- Offer to fix (using TDD — write a test for the fix first)
|
|
36
|
+
- After fixing, re-run Stage 1
|
|
37
|
+
- Repeat until all criteria pass or max iterations reached
|
|
38
|
+
|
|
39
|
+
**Stage 1 must pass before proceeding to Stage 2.**
|
|
40
|
+
|
|
41
|
+
## Stage 2: Code Quality
|
|
42
|
+
|
|
43
|
+
**Goal**: Find unnecessary complexity, dead code, scope creep.
|
|
44
|
+
|
|
45
|
+
1. Run the **critic agent** — find logical errors, assumption issues
|
|
46
|
+
2. Run the **simplifier agent** — find unnecessary complexity
|
|
47
|
+
3. If the changes involve performance optimization, run the **performance-reviewer agent**
|
|
48
|
+
4. Present findings with severity levels:
|
|
49
|
+
- [Critical] — must fix
|
|
50
|
+
- [Simplification] — should fix
|
|
51
|
+
- [Observation] — consider fixing
|
|
52
|
+
5. Offer to auto-fix critical and simplification issues
|
|
53
|
+
6. If fixes are made (using TDD), re-run Stage 2
|
|
54
|
+
7. Repeat until no critical issues remain or max iterations reached
|
|
35
55
|
|
|
36
56
|
## Output Format
|
|
37
57
|
|
|
38
58
|
```
|
|
39
|
-
SDD Review —
|
|
40
|
-
|
|
59
|
+
SDD Review — Stage 1: Spec Compliance
|
|
60
|
+
──────────────────────────────────────
|
|
61
|
+
|
|
62
|
+
Spec: specs/behavior-spec.md (5 criteria)
|
|
63
|
+
|
|
64
|
+
✓ Criterion 1: User can log in — PASS (test_login passes)
|
|
65
|
+
✓ Criterion 2: Invalid credentials show error — PASS (test_invalid_login passes)
|
|
66
|
+
✗ Criterion 3: Session persists — FAIL (no test found for this criterion)
|
|
67
|
+
|
|
68
|
+
Stage 1: 2/3 FAIL — must fix before proceeding to Stage 2.
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
SDD Review — Stage 2: Code Quality
|
|
73
|
+
───────────────────────────────────
|
|
41
74
|
|
|
42
75
|
Critic Findings:
|
|
43
76
|
[Critical] ...
|
|
44
|
-
[Warning] ...
|
|
45
77
|
|
|
46
78
|
Simplifier Findings:
|
|
47
79
|
[Simplification] ...
|
|
48
80
|
|
|
49
|
-
Spec Compliance:
|
|
50
|
-
[X of Y criteria satisfied]
|
|
51
|
-
|
|
52
81
|
Actions:
|
|
53
82
|
- Fix critical issues? (y/n)
|
|
54
83
|
- Apply simplifications? (y/n)
|
|
@@ -56,7 +85,12 @@ Actions:
|
|
|
56
85
|
|
|
57
86
|
## Principles
|
|
58
87
|
|
|
88
|
+
- Stage 1 is the gate. No code quality review on non-compliant code.
|
|
59
89
|
- Reviews are honest — findings are reported as-is, not softened
|
|
90
|
+
- DO NOT trust the implementer's report. Verify independently.
|
|
60
91
|
- Fixes follow TDD: if the fix changes behavior, write a test first
|
|
61
92
|
- Max iterations prevent infinite loops
|
|
62
|
-
|
|
93
|
+
|
|
94
|
+
## References
|
|
95
|
+
|
|
96
|
+
See: `iterative-execution/references/review-prompts.md` — Subagent prompt templates
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdd-verify
|
|
3
|
+
description: Run automated verification checks — build, types, lint, tests, security scans. Distinct from /sdd-review (agent-based).
|
|
4
|
+
argument-hint: "[quick|full|pre-commit|pre-pr]"
|
|
5
|
+
allowed-tools:
|
|
6
|
+
- Bash
|
|
7
|
+
- Read
|
|
8
|
+
- Glob
|
|
9
|
+
- Grep
|
|
10
|
+
- Task
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# /sdd-verify
|
|
14
|
+
|
|
15
|
+
Run automated verification checks against the codebase. This is the **automated checks** complement to `/sdd-review` (which uses agent-based analysis).
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
- `/sdd-verify` — Run full verification (default)
|
|
20
|
+
- `/sdd-verify quick` — Build + type check only
|
|
21
|
+
- `/sdd-verify full` — Build + types + lint + test suite + coverage
|
|
22
|
+
- `/sdd-verify pre-commit` — Quick + lint + debug statement scan + git status check
|
|
23
|
+
- `/sdd-verify pre-pr` — Full + security-reviewer agent + diff review + TODO/secrets scan
|
|
24
|
+
|
|
25
|
+
## Modes
|
|
26
|
+
|
|
27
|
+
### quick
|
|
28
|
+
Fast feedback loop during development.
|
|
29
|
+
1. Build / compile check
|
|
30
|
+
2. Type check (tsc, mypy, etc.)
|
|
31
|
+
|
|
32
|
+
### full (default)
|
|
33
|
+
Comprehensive automated verification.
|
|
34
|
+
1. Build / compile check
|
|
35
|
+
2. Type check
|
|
36
|
+
3. Lint (eslint, ruff, etc.)
|
|
37
|
+
4. Full test suite
|
|
38
|
+
5. Coverage report (if configured)
|
|
39
|
+
|
|
40
|
+
### pre-commit
|
|
41
|
+
Everything needed before committing.
|
|
42
|
+
1. All `quick` checks
|
|
43
|
+
2. Lint
|
|
44
|
+
3. Debug statement scan (`console.log`, `debugger`, `print(`, `TODO`, `FIXME`, `HACK`)
|
|
45
|
+
4. Git status — ensure no unintended files staged
|
|
46
|
+
|
|
47
|
+
### pre-pr
|
|
48
|
+
Everything needed before opening a PR.
|
|
49
|
+
1. All `full` checks
|
|
50
|
+
2. Launch **security-reviewer** agent on changed files
|
|
51
|
+
3. Diff review — scan for TODO, FIXME, secrets patterns, hardcoded values
|
|
52
|
+
4. Generate summary
|
|
53
|
+
|
|
54
|
+
## Output Format
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
SDD Verify — [mode]
|
|
58
|
+
───────────────────
|
|
59
|
+
|
|
60
|
+
✓ Build .......................... PASS
|
|
61
|
+
✓ Type check .................... PASS
|
|
62
|
+
✗ Lint .......................... FAIL (3 errors)
|
|
63
|
+
✓ Tests ......................... PASS (42/42)
|
|
64
|
+
✓ Coverage ...................... 87%
|
|
65
|
+
✗ Debug statements .............. FAIL (2 found)
|
|
66
|
+
✓ Secrets scan .................. PASS
|
|
67
|
+
|
|
68
|
+
──────────────────────────────────
|
|
69
|
+
Summary: 5/7 passed, 2 failed
|
|
70
|
+
Ready for PR: NO
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## How to Detect Project Tools
|
|
74
|
+
|
|
75
|
+
1. Check `package.json` for scripts (build, test, lint, typecheck)
|
|
76
|
+
2. Check for `Makefile`, `pyproject.toml`, `Cargo.toml`, `go.mod`
|
|
77
|
+
3. Check for config files (`.eslintrc`, `tsconfig.json`, `ruff.toml`, `mypy.ini`)
|
|
78
|
+
4. If no tools detected, report what's missing and skip those checks
|
|
79
|
+
|
|
80
|
+
## Difference from /sdd-review
|
|
81
|
+
|
|
82
|
+
| | /sdd-verify | /sdd-review |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| **Type** | Automated checks | Agent-based analysis |
|
|
85
|
+
| **Speed** | Fast (runs tools) | Slower (launches agents) |
|
|
86
|
+
| **Finds** | Build errors, type errors, lint issues, test failures | Logic errors, spec drift, unnecessary complexity |
|
|
87
|
+
| **When** | During development, before commit/PR | After implementation, before merge |
|
package/contexts/dev.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SDD Context: Dev Mode
|
|
2
|
+
|
|
3
|
+
Full guardrails active. This is the default mode for implementation work.
|
|
4
|
+
|
|
5
|
+
## Active Guardrails
|
|
6
|
+
|
|
7
|
+
- **Pre-implementation checkpoint**: ON — enumerate assumptions, flag ambiguity, surface alternatives, push back on bad ideas, define scope, check for spec, plan TDD approach
|
|
8
|
+
- **Completion review**: ON — spec adherence, test coverage, complexity audit, dead code check, scope creep check
|
|
9
|
+
- **Scope guard**: STRICT — reject changes outside defined scope without explicit approval
|
|
10
|
+
- **TDD enforcement**: ON — tests before implementation
|
|
11
|
+
- **Post-edit review**: ON — review after each write/edit
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- Implementing features from specs
|
|
16
|
+
- Fixing bugs
|
|
17
|
+
- Refactoring code
|
|
18
|
+
- Any task where correctness and discipline matter
|
|
19
|
+
|
|
20
|
+
## Principles
|
|
21
|
+
|
|
22
|
+
- Every change starts with understanding the spec
|
|
23
|
+
- Every implementation starts with a test
|
|
24
|
+
- Every completion is verified against criteria
|
|
25
|
+
- Scope is defended — no drive-by improvements
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# SDD Context: Research Mode
|
|
2
|
+
|
|
3
|
+
Exploration focus. Guardrails are relaxed to allow free investigation without implementation ceremony.
|
|
4
|
+
|
|
5
|
+
## Active Guardrails
|
|
6
|
+
|
|
7
|
+
- **Pre-implementation checkpoint**: OFF — you're exploring, not committing to implementation
|
|
8
|
+
- **Completion review**: OFF — research doesn't have a "done" in the spec-compliance sense
|
|
9
|
+
- **Scope guard**: RELAXED — follow the investigation wherever it leads
|
|
10
|
+
- **TDD enforcement**: OFF for prototypes — but ON if research produces code intended for production
|
|
11
|
+
- **Post-edit review**: OFF — prototypes and experiments don't need review
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- Understanding unfamiliar codebases
|
|
16
|
+
- Investigating bugs (root cause analysis)
|
|
17
|
+
- Prototyping and experimentation
|
|
18
|
+
- Architecture exploration and spike work
|
|
19
|
+
- Reading documentation and tracing flows
|
|
20
|
+
|
|
21
|
+
## Principles
|
|
22
|
+
|
|
23
|
+
- Follow curiosity — explore freely
|
|
24
|
+
- Take notes — capture findings for later
|
|
25
|
+
- Don't ship research code — if it becomes production code, switch to dev mode
|
|
26
|
+
- Time-box — set a goal for what you want to learn
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SDD Context: Review Mode
|
|
2
|
+
|
|
3
|
+
Critic and verification focus. Pre-implementation checkpoint is skipped since you're reviewing, not building.
|
|
4
|
+
|
|
5
|
+
## Active Guardrails
|
|
6
|
+
|
|
7
|
+
- **Pre-implementation checkpoint**: OFF — you're reviewing existing code, not starting new work
|
|
8
|
+
- **Completion review**: ON — ensure review findings are complete and actionable
|
|
9
|
+
- **Scope guard**: NORMAL — stay focused on what you're reviewing
|
|
10
|
+
- **TDD enforcement**: ON for any fixes — if review leads to fixes, tests come first
|
|
11
|
+
- **Post-edit review**: ON — verify any fixes made during review
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- Code review (PRs, post-implementation)
|
|
16
|
+
- Auditing existing code for quality
|
|
17
|
+
- Security reviews
|
|
18
|
+
- Running `/sdd-review` or agent-based reviews
|
|
19
|
+
|
|
20
|
+
## Principles
|
|
21
|
+
|
|
22
|
+
- Find what's wrong, not confirm what's right
|
|
23
|
+
- Be specific and evidence-based
|
|
24
|
+
- Report findings honestly — don't soften
|
|
25
|
+
- If fixing, follow TDD discipline
|