sdlc-framework 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.
- package/LICENSE +21 -0
- package/README.md +321 -0
- package/bin/install.js +193 -0
- package/package.json +39 -0
- package/src/commands/close.md +200 -0
- package/src/commands/debug.md +124 -0
- package/src/commands/fast.md +149 -0
- package/src/commands/fix.md +104 -0
- package/src/commands/help.md +144 -0
- package/src/commands/hotfix.md +99 -0
- package/src/commands/impl.md +142 -0
- package/src/commands/init.md +93 -0
- package/src/commands/milestone.md +136 -0
- package/src/commands/pause.md +115 -0
- package/src/commands/research.md +136 -0
- package/src/commands/resume.md +103 -0
- package/src/commands/review.md +195 -0
- package/src/commands/spec.md +164 -0
- package/src/commands/status.md +118 -0
- package/src/commands/verify.md +153 -0
- package/src/references/clarification-strategy.md +352 -0
- package/src/references/engineering-laws.md +374 -0
- package/src/references/loop-phases.md +331 -0
- package/src/references/playwright-testing.md +298 -0
- package/src/references/prompt-detection.md +264 -0
- package/src/references/sub-agent-strategy.md +260 -0
- package/src/rules/commands.md +180 -0
- package/src/rules/style.md +354 -0
- package/src/rules/templates.md +238 -0
- package/src/rules/workflows.md +314 -0
- package/src/templates/HANDOFF.md +121 -0
- package/src/templates/LAWS.md +521 -0
- package/src/templates/PROJECT.md +112 -0
- package/src/templates/REVIEW.md +145 -0
- package/src/templates/ROADMAP.md +101 -0
- package/src/templates/SPEC.md +231 -0
- package/src/templates/STATE.md +106 -0
- package/src/templates/SUMMARY.md +126 -0
- package/src/workflows/close-phase.md +189 -0
- package/src/workflows/debug-flow.md +302 -0
- package/src/workflows/fast-forward.md +340 -0
- package/src/workflows/fix-findings.md +235 -0
- package/src/workflows/hotfix-flow.md +190 -0
- package/src/workflows/impl-phase.md +229 -0
- package/src/workflows/init-project.md +249 -0
- package/src/workflows/milestone-management.md +169 -0
- package/src/workflows/pause-work.md +153 -0
- package/src/workflows/research.md +219 -0
- package/src/workflows/resume-project.md +159 -0
- package/src/workflows/review-phase.md +337 -0
- package/src/workflows/spec-phase.md +379 -0
- package/src/workflows/transition-phase.md +203 -0
- package/src/workflows/verify-phase.md +280 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc:pause
|
|
3
|
+
description: "Save context for session break"
|
|
4
|
+
argument-hint: "[reason]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Glob, Grep, AskUserQuestion]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Save complete session context so you can walk away and pick up exactly where you left off. Creates a HANDOFF.md that captures everything the next session needs.
|
|
10
|
+
|
|
11
|
+
**When to use:** You need to take a break, switch tasks, or end your session. Run this before closing your terminal.
|
|
12
|
+
|
|
13
|
+
**What it does:**
|
|
14
|
+
1. Detect current loop position from STATE.md.
|
|
15
|
+
2. Gather all context: work done, decisions made, blockers, in-progress tasks.
|
|
16
|
+
3. Create HANDOFF.md with everything needed to resume.
|
|
17
|
+
4. Optionally create a WIP git commit.
|
|
18
|
+
5. Tell you exactly how to resume.
|
|
19
|
+
|
|
20
|
+
**What happens next:** When you return, run /sdlc:resume.
|
|
21
|
+
</objective>
|
|
22
|
+
|
|
23
|
+
<execution_context>
|
|
24
|
+
@~/.claude/sdlc-framework/workflows/pause-resume.md
|
|
25
|
+
@.sdlc/STATE.md
|
|
26
|
+
</execution_context>
|
|
27
|
+
|
|
28
|
+
<context>
|
|
29
|
+
$ARGUMENTS — optional reason for pausing (e.g., "end of day", "switching to urgent task").
|
|
30
|
+
|
|
31
|
+
Read .sdlc/STATE.md to detect current loop position and active work.
|
|
32
|
+
</context>
|
|
33
|
+
|
|
34
|
+
<process>
|
|
35
|
+
Follow workflow: @~/.claude/sdlc-framework/workflows/pause-resume.md
|
|
36
|
+
|
|
37
|
+
Step-by-step:
|
|
38
|
+
|
|
39
|
+
1. **Read current state**
|
|
40
|
+
- Read .sdlc/STATE.md to get:
|
|
41
|
+
- Current loop_position (SPEC, IMPLEMENT, VERIFY, REVIEW, CLOSE, DEBUG, HOTFIX).
|
|
42
|
+
- Current milestone and phase.
|
|
43
|
+
- Current plan (if any).
|
|
44
|
+
- Any recorded blockers.
|
|
45
|
+
|
|
46
|
+
2. **Gather session context**
|
|
47
|
+
- Check git status for uncommitted changes (`git status --short`).
|
|
48
|
+
- Check git log for recent commits in this session (`git log --oneline -5`).
|
|
49
|
+
- Read any in-progress spec, plan, or task files referenced in STATE.md.
|
|
50
|
+
- Scan .sdlc/ for recently modified files (`find .sdlc -mmin -120 -type f`).
|
|
51
|
+
|
|
52
|
+
3. **Create HANDOFF.md**
|
|
53
|
+
- Save to .sdlc/handoffs/HANDOFF-{timestamp}.md with:
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
# Session Handoff — {timestamp}
|
|
57
|
+
|
|
58
|
+
## Loop Position
|
|
59
|
+
{current loop_position} in {milestone} / {phase}
|
|
60
|
+
|
|
61
|
+
## Work Completed This Session
|
|
62
|
+
- {list of completed tasks, commits, files changed}
|
|
63
|
+
|
|
64
|
+
## Work In Progress
|
|
65
|
+
- {what was being worked on when paused}
|
|
66
|
+
- {current state of that work}
|
|
67
|
+
|
|
68
|
+
## Decisions Made
|
|
69
|
+
- {any architectural or design decisions}
|
|
70
|
+
|
|
71
|
+
## Blockers
|
|
72
|
+
- {anything preventing progress}
|
|
73
|
+
|
|
74
|
+
## Uncommitted Changes
|
|
75
|
+
- {list of modified/untracked files from git status}
|
|
76
|
+
|
|
77
|
+
## Resume Instructions
|
|
78
|
+
Run /sdlc:resume to continue.
|
|
79
|
+
The framework will pick up at: {loop_position}
|
|
80
|
+
Next action will be: {determined next action}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
4. **Update STATE.md**
|
|
84
|
+
- Add session continuity section:
|
|
85
|
+
- `paused_at: {timestamp}`
|
|
86
|
+
- `pause_reason: {from $ARGUMENTS or "manual pause"}`
|
|
87
|
+
- `handoff_file: .sdlc/handoffs/HANDOFF-{timestamp}.md`
|
|
88
|
+
- Do NOT change loop_position — it stays where it was.
|
|
89
|
+
|
|
90
|
+
5. **Offer WIP commit**
|
|
91
|
+
- Check if there are uncommitted changes.
|
|
92
|
+
- If yes, ask the user via AskUserQuestion:
|
|
93
|
+
"You have uncommitted changes. Create a WIP commit? (yes/no)"
|
|
94
|
+
- If yes: stage all changes and commit with message "WIP: {current task} [sdlc:pause]".
|
|
95
|
+
- If no: note in HANDOFF.md that uncommitted changes exist.
|
|
96
|
+
|
|
97
|
+
6. **Output resume instructions**
|
|
98
|
+
- Print:
|
|
99
|
+
```
|
|
100
|
+
Session paused. Context saved to .sdlc/handoffs/HANDOFF-{timestamp}.md
|
|
101
|
+
|
|
102
|
+
When you return, run: /sdlc:resume
|
|
103
|
+
```
|
|
104
|
+
- Do not suggest any other actions. The only valid next step is /sdlc:resume.
|
|
105
|
+
</process>
|
|
106
|
+
|
|
107
|
+
<success_criteria>
|
|
108
|
+
- [ ] Current loop position detected from STATE.md
|
|
109
|
+
- [ ] All session context gathered (commits, changes, decisions, blockers)
|
|
110
|
+
- [ ] HANDOFF.md created in .sdlc/handoffs/ with complete context
|
|
111
|
+
- [ ] STATE.md updated with session continuity section
|
|
112
|
+
- [ ] WIP commit offered if uncommitted changes exist
|
|
113
|
+
- [ ] Output clearly states: "When you return, run /sdlc:resume"
|
|
114
|
+
- [ ] No ambiguity — exactly one path forward
|
|
115
|
+
</success_criteria>
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc:research
|
|
3
|
+
description: "Deploy research subagents for discovery"
|
|
4
|
+
argument-hint: "<topic>"
|
|
5
|
+
allowed-tools: [Read, Write, Glob, Grep, Agent, WebSearch, WebFetch]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Deploy research subagents to investigate a topic before writing code. This is the ONLY valid use of subagents outside of /sdlc:impl. Research never auto-integrates into code — findings are saved for human review.
|
|
10
|
+
|
|
11
|
+
**When to use:** Before writing a spec, you need to understand something: an API, a library, a codebase pattern, a competing approach, or a technical constraint.
|
|
12
|
+
|
|
13
|
+
**What it does:**
|
|
14
|
+
1. Classify the research type (codebase, web, or both).
|
|
15
|
+
2. Spawn focused subagent(s) with the Agent tool.
|
|
16
|
+
3. Save structured findings to .sdlc/research/{topic}.md.
|
|
17
|
+
4. Present findings for your review. Never auto-apply.
|
|
18
|
+
|
|
19
|
+
**What happens next:** /sdlc:spec to use the research findings in planning.
|
|
20
|
+
</objective>
|
|
21
|
+
|
|
22
|
+
<execution_context>
|
|
23
|
+
@~/.claude/sdlc-framework/workflows/research.md
|
|
24
|
+
@.sdlc/STATE.md
|
|
25
|
+
</execution_context>
|
|
26
|
+
|
|
27
|
+
<context>
|
|
28
|
+
$ARGUMENTS — the research topic. Required.
|
|
29
|
+
|
|
30
|
+
If $ARGUMENTS is empty, output: "Provide a research topic. Example: /sdlc:research authentication patterns" Then stop.
|
|
31
|
+
</context>
|
|
32
|
+
|
|
33
|
+
<process>
|
|
34
|
+
Follow workflow: @~/.claude/sdlc-framework/workflows/research.md
|
|
35
|
+
|
|
36
|
+
Step-by-step:
|
|
37
|
+
|
|
38
|
+
1. **Pre-flight check**
|
|
39
|
+
- Verify $ARGUMENTS is not empty.
|
|
40
|
+
- Read .sdlc/STATE.md to confirm framework is initialized.
|
|
41
|
+
- Create .sdlc/research/ directory if it does not exist.
|
|
42
|
+
|
|
43
|
+
2. **Classify research type**
|
|
44
|
+
- Analyze the topic to determine what kind of research is needed:
|
|
45
|
+
- **Codebase exploration:** Understanding existing patterns, finding usage examples, mapping dependencies. Keywords: "how does", "where is", "existing pattern", "current implementation".
|
|
46
|
+
- **Web research:** External APIs, libraries, best practices, security advisories. Keywords: "library", "API", "best practice", "alternative", "comparison".
|
|
47
|
+
- **Both:** Topics that require understanding current code AND external context. Keywords: "migrate to", "upgrade", "integrate with".
|
|
48
|
+
|
|
49
|
+
3. **Spawn research subagent(s)**
|
|
50
|
+
- For **codebase exploration**: spawn ONE Agent with instructions:
|
|
51
|
+
```
|
|
52
|
+
Research topic: {topic}
|
|
53
|
+
Search the codebase for:
|
|
54
|
+
- Existing implementations of {topic}
|
|
55
|
+
- Patterns used for similar functionality
|
|
56
|
+
- Dependencies and imports related to {topic}
|
|
57
|
+
- Test coverage of related code
|
|
58
|
+
Use Glob, Grep, and Read. Report findings in structured format:
|
|
59
|
+
- Files found
|
|
60
|
+
- Patterns identified
|
|
61
|
+
- Key code snippets (with file paths and line numbers)
|
|
62
|
+
- Gaps or inconsistencies
|
|
63
|
+
```
|
|
64
|
+
- For **web research**: spawn ONE Agent with instructions:
|
|
65
|
+
```
|
|
66
|
+
Research topic: {topic}
|
|
67
|
+
Use WebSearch and WebFetch to find:
|
|
68
|
+
- Official documentation
|
|
69
|
+
- Best practices and recommendations
|
|
70
|
+
- Common pitfalls and gotchas
|
|
71
|
+
- Security considerations
|
|
72
|
+
- Performance implications
|
|
73
|
+
Report findings in structured format with source URLs.
|
|
74
|
+
```
|
|
75
|
+
- For **both**: spawn TWO Agents (one codebase, one web) in parallel.
|
|
76
|
+
|
|
77
|
+
4. **Collect and structure findings**
|
|
78
|
+
- Wait for all agents to complete.
|
|
79
|
+
- Merge findings into a structured document.
|
|
80
|
+
|
|
81
|
+
5. **Save findings**
|
|
82
|
+
- Write to .sdlc/research/{sanitized-topic}.md:
|
|
83
|
+
```
|
|
84
|
+
# Research: {topic}
|
|
85
|
+
Date: {timestamp}
|
|
86
|
+
Type: {codebase | web | both}
|
|
87
|
+
|
|
88
|
+
## Summary
|
|
89
|
+
{2-3 sentence summary of key findings}
|
|
90
|
+
|
|
91
|
+
## Codebase Findings
|
|
92
|
+
{if applicable}
|
|
93
|
+
### Existing Patterns
|
|
94
|
+
- {pattern 1 with file references}
|
|
95
|
+
### Dependencies
|
|
96
|
+
- {dependency 1}
|
|
97
|
+
### Gaps
|
|
98
|
+
- {gap 1}
|
|
99
|
+
|
|
100
|
+
## Web Findings
|
|
101
|
+
{if applicable}
|
|
102
|
+
### Best Practices
|
|
103
|
+
- {practice 1} (source: {url})
|
|
104
|
+
### Pitfalls
|
|
105
|
+
- {pitfall 1}
|
|
106
|
+
### Security Considerations
|
|
107
|
+
- {consideration 1}
|
|
108
|
+
|
|
109
|
+
## Recommendations
|
|
110
|
+
- {recommendation 1}
|
|
111
|
+
- {recommendation 2}
|
|
112
|
+
|
|
113
|
+
## Open Questions
|
|
114
|
+
- {question that needs human input}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
6. **Present findings — do NOT auto-integrate**
|
|
118
|
+
- Display the summary and recommendations to the user.
|
|
119
|
+
- Explicitly state: "These findings are saved for reference. They have NOT been applied to code."
|
|
120
|
+
- Output: "NEXT ACTION REQUIRED: /sdlc:spec — use these findings to plan your implementation."
|
|
121
|
+
|
|
122
|
+
7. **Update STATE.md**
|
|
123
|
+
- Record that research was conducted on {topic}.
|
|
124
|
+
- Add reference to the findings file.
|
|
125
|
+
</process>
|
|
126
|
+
|
|
127
|
+
<success_criteria>
|
|
128
|
+
- [ ] Research topic provided (not empty)
|
|
129
|
+
- [ ] Research type classified correctly (codebase, web, or both)
|
|
130
|
+
- [ ] Appropriate subagent(s) spawned with clear instructions
|
|
131
|
+
- [ ] Findings saved to .sdlc/research/{topic}.md in structured format
|
|
132
|
+
- [ ] Findings presented to user but NOT auto-applied to code
|
|
133
|
+
- [ ] STATE.md updated with research reference
|
|
134
|
+
- [ ] Output ends with NEXT ACTION REQUIRED: /sdlc:spec
|
|
135
|
+
- [ ] No code changes made — research is read-only
|
|
136
|
+
</success_criteria>
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc:resume
|
|
3
|
+
description: "Restore context and continue with ONE next action"
|
|
4
|
+
argument-hint: "[handoff-path]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Glob, Grep]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Restore session context after a break and determine exactly ONE next action. No menus. No options. The framework decides what happens next.
|
|
10
|
+
|
|
11
|
+
**When to use:** After running /sdlc:pause and returning to work. The framework picks up exactly where you left off.
|
|
12
|
+
|
|
13
|
+
**What it does:**
|
|
14
|
+
1. Read STATE.md and the most recent HANDOFF.md.
|
|
15
|
+
2. Display: where you stopped, what was in progress, any blockers.
|
|
16
|
+
3. Determine and force exactly ONE next action.
|
|
17
|
+
4. Archive the consumed handoff.
|
|
18
|
+
|
|
19
|
+
**What happens next:** The determined action. You do not choose — the framework routes you.
|
|
20
|
+
</objective>
|
|
21
|
+
|
|
22
|
+
<execution_context>
|
|
23
|
+
@~/.claude/sdlc-framework/workflows/pause-resume.md
|
|
24
|
+
@.sdlc/STATE.md
|
|
25
|
+
</execution_context>
|
|
26
|
+
|
|
27
|
+
<context>
|
|
28
|
+
$ARGUMENTS — optional path to a specific handoff file. If not provided, use the most recent one.
|
|
29
|
+
|
|
30
|
+
Read .sdlc/STATE.md for loop position and session continuity data.
|
|
31
|
+
</context>
|
|
32
|
+
|
|
33
|
+
<process>
|
|
34
|
+
Follow workflow: @~/.claude/sdlc-framework/workflows/pause-resume.md
|
|
35
|
+
|
|
36
|
+
Step-by-step:
|
|
37
|
+
|
|
38
|
+
1. **Locate the handoff file**
|
|
39
|
+
- If $ARGUMENTS contains a path, use that file.
|
|
40
|
+
- Otherwise, read .sdlc/STATE.md for the `handoff_file` field.
|
|
41
|
+
- If no handoff_file in STATE.md, scan .sdlc/handoffs/ for the most recently modified file.
|
|
42
|
+
- If no handoff exists at all, output: "No handoff found. Check .sdlc/STATE.md for current position and run /sdlc:status." Then stop.
|
|
43
|
+
|
|
44
|
+
2. **Read and display context**
|
|
45
|
+
- Read the handoff file.
|
|
46
|
+
- Read .sdlc/STATE.md.
|
|
47
|
+
- Display to the user:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
## Session Restored
|
|
51
|
+
|
|
52
|
+
**Where you stopped:** {loop_position} in {milestone} / {phase}
|
|
53
|
+
**Paused at:** {timestamp}
|
|
54
|
+
**Reason:** {pause_reason}
|
|
55
|
+
|
|
56
|
+
### Work In Progress
|
|
57
|
+
{from handoff}
|
|
58
|
+
|
|
59
|
+
### Blockers
|
|
60
|
+
{from handoff, or "None"}
|
|
61
|
+
|
|
62
|
+
### Uncommitted Changes
|
|
63
|
+
{from handoff — verify against current git status}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
3. **Verify current state**
|
|
67
|
+
- Run `git status --short` to check if uncommitted changes match the handoff.
|
|
68
|
+
- If they do not match, warn: "Git state has changed since pause. Review before proceeding."
|
|
69
|
+
- Check if any WIP commit exists from the pause (`git log --oneline -3`).
|
|
70
|
+
|
|
71
|
+
4. **Determine the ONE next action**
|
|
72
|
+
- Use the loop_position from STATE.md to determine the next action:
|
|
73
|
+
- `SPEC` → "NEXT ACTION REQUIRED: /sdlc:spec"
|
|
74
|
+
- `IMPLEMENT` → "NEXT ACTION REQUIRED: /sdlc:impl"
|
|
75
|
+
- `VERIFY` → "NEXT ACTION REQUIRED: /sdlc:verify"
|
|
76
|
+
- `REVIEW` → "NEXT ACTION REQUIRED: /sdlc:review"
|
|
77
|
+
- `CLOSE` → "NEXT ACTION REQUIRED: /sdlc:close"
|
|
78
|
+
- `DEBUG` → "NEXT ACTION REQUIRED: /sdlc:debug"
|
|
79
|
+
- `HOTFIX` → "NEXT ACTION REQUIRED: /sdlc:hotfix"
|
|
80
|
+
- If blockers exist, prepend: "BLOCKER: {blocker}. Resolve before proceeding."
|
|
81
|
+
- Output exactly ONE action. No alternatives. No menus.
|
|
82
|
+
|
|
83
|
+
5. **Archive the consumed handoff**
|
|
84
|
+
- Move the handoff file to .sdlc/handoffs/archive/:
|
|
85
|
+
`mkdir -p .sdlc/handoffs/archive && mv {handoff_file} .sdlc/handoffs/archive/`
|
|
86
|
+
- Remove the `handoff_file` field from STATE.md session continuity section.
|
|
87
|
+
- Remove the `paused_at` and `pause_reason` fields.
|
|
88
|
+
|
|
89
|
+
6. **Force the next action**
|
|
90
|
+
- Output the determined next action as the final line.
|
|
91
|
+
- Do not offer choices. The loop position dictates the action.
|
|
92
|
+
</process>
|
|
93
|
+
|
|
94
|
+
<success_criteria>
|
|
95
|
+
- [ ] Handoff file located (from argument, STATE.md, or most recent)
|
|
96
|
+
- [ ] Context displayed: loop position, work in progress, blockers
|
|
97
|
+
- [ ] Git state verified against handoff (warn if mismatch)
|
|
98
|
+
- [ ] Exactly ONE next action determined from loop_position
|
|
99
|
+
- [ ] Handoff file archived to .sdlc/handoffs/archive/
|
|
100
|
+
- [ ] STATE.md session continuity fields cleaned up
|
|
101
|
+
- [ ] Output ends with NEXT ACTION REQUIRED: /sdlc:{action}
|
|
102
|
+
- [ ] No menus, no options, no choices — one path forward
|
|
103
|
+
</success_criteria>
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdlc:review
|
|
3
|
+
description: Engineering laws compliance review
|
|
4
|
+
argument-hint: "[spec-path]"
|
|
5
|
+
allowed-tools: [Read, Write, Bash, Glob, Grep, Edit, AskUserQuestion]
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<objective>
|
|
9
|
+
Review all code modified during implementation against the Engineering Laws defined in .sdlc/LAWS.md. Produce a REVIEW.md with findings categorized by severity: blocker, warning, or info.
|
|
10
|
+
|
|
11
|
+
**When to use:** After /sdlc:verify confirms all acceptance criteria pass. This is the REVIEW phase of the SDLC loop.
|
|
12
|
+
|
|
13
|
+
**What it does:**
|
|
14
|
+
1. Identify all files modified during implementation.
|
|
15
|
+
2. Read each file and check against every engineering law.
|
|
16
|
+
3. Detect violations: SOLID, DRY, YAGNI, Clean Code, Security, Test Coverage, Naming, Error Handling.
|
|
17
|
+
4. Generate REVIEW.md with findings, severity, file references, and remediation steps.
|
|
18
|
+
5. Blockers must be fixed before the loop can close.
|
|
19
|
+
|
|
20
|
+
**What happens next:**
|
|
21
|
+
- No blockers: Framework directs you to /sdlc:close.
|
|
22
|
+
- Blockers found: Fix all blockers, then re-run /sdlc:review.
|
|
23
|
+
|
|
24
|
+
**Critical rule:** This is an automated code review, not a rubber stamp. Every file gets read. Every law gets checked. Severity is assigned honestly — do not downgrade blockers to warnings to pass faster.
|
|
25
|
+
</objective>
|
|
26
|
+
|
|
27
|
+
<execution_context>
|
|
28
|
+
@~/.claude/sdlc-framework/workflows/run-review.md
|
|
29
|
+
@.sdlc/STATE.md
|
|
30
|
+
@.sdlc/LAWS.md
|
|
31
|
+
The SPEC.md and IMPL.md paths are read from STATE.md.
|
|
32
|
+
</execution_context>
|
|
33
|
+
|
|
34
|
+
<context>
|
|
35
|
+
$ARGUMENTS — optional path to SPEC.md. If not provided, read from .sdlc/STATE.md spec_path field.
|
|
36
|
+
|
|
37
|
+
Read these files:
|
|
38
|
+
- .sdlc/STATE.md — current plan, spec path, impl path.
|
|
39
|
+
- .sdlc/LAWS.md — engineering laws with severity configuration.
|
|
40
|
+
- .sdlc/specs/SPEC-<plan-id>.md — what was planned (boundaries, tasks).
|
|
41
|
+
- .sdlc/impl/IMPL-<plan-id>.md — files modified during implementation.
|
|
42
|
+
- .sdlc/verify/VERIFY-<plan-id>.md — verification results.
|
|
43
|
+
|
|
44
|
+
Use `git diff` to identify changed files if IMPL.md is unavailable.
|
|
45
|
+
</context>
|
|
46
|
+
|
|
47
|
+
<process>
|
|
48
|
+
Follow workflow: @~/.claude/sdlc-framework/workflows/run-review.md
|
|
49
|
+
|
|
50
|
+
Step-by-step:
|
|
51
|
+
|
|
52
|
+
1. **Load state and identify modified files**
|
|
53
|
+
- Read .sdlc/STATE.md. Confirm loop_position is VERIFY_COMPLETE. If not, warn: "Verification not complete. Run /sdlc:verify first."
|
|
54
|
+
- Read IMPL-<plan-id>.md for the list of files created and modified.
|
|
55
|
+
- If IMPL.md is unavailable, run `git diff --name-only HEAD~<n>` to find changed files.
|
|
56
|
+
- Read .sdlc/LAWS.md for the full set of engineering laws and their configured severity.
|
|
57
|
+
- Read SPEC.md for boundaries (what was in scope vs out of scope).
|
|
58
|
+
|
|
59
|
+
2. **Read all modified files**
|
|
60
|
+
- Read every file listed in the modified files list.
|
|
61
|
+
- For large files, read in chunks but cover the entire file.
|
|
62
|
+
- Note the file type, size, and purpose.
|
|
63
|
+
|
|
64
|
+
3. **Check: SOLID Principles**
|
|
65
|
+
- **Single Responsibility:** Does each class/module/function have one reason to change? Flag files that mix concerns (e.g., a service that also formats responses).
|
|
66
|
+
- **Open/Closed:** Are new behaviors added via extension (new classes, new handlers) rather than modifying existing code? Flag modifications to stable abstractions.
|
|
67
|
+
- **Liskov Substitution:** Do subtypes honor the contract of their parent type? Flag overrides that change behavior semantics.
|
|
68
|
+
- **Interface Segregation:** Are interfaces focused? Flag interfaces with 5+ methods that clients only partially use.
|
|
69
|
+
- **Dependency Inversion:** Do high-level modules depend on abstractions? Flag direct imports of concrete implementations where an interface should exist.
|
|
70
|
+
|
|
71
|
+
4. **Check: DRY (Don't Repeat Yourself)**
|
|
72
|
+
- Search for duplicate code blocks (3+ lines repeated across files).
|
|
73
|
+
- Use Grep to find similar patterns across the codebase.
|
|
74
|
+
- Flag: identical logic in multiple locations, copy-pasted error handling, repeated validation patterns.
|
|
75
|
+
- Recommend: extract to shared utility, base class, or helper function.
|
|
76
|
+
|
|
77
|
+
5. **Check: YAGNI (You Ain't Gonna Need It)**
|
|
78
|
+
- Compare modified files against SPEC.md boundaries.
|
|
79
|
+
- Flag any code that is NOT required by the acceptance criteria:
|
|
80
|
+
- Unused functions or methods with no callers.
|
|
81
|
+
- Configuration for features not in scope.
|
|
82
|
+
- Abstractions that only have one implementation (premature abstraction).
|
|
83
|
+
- Comments saying "for future use" or "TODO: extend later."
|
|
84
|
+
|
|
85
|
+
6. **Check: Clean Code**
|
|
86
|
+
- **Function length:** Flag functions exceeding 40 lines.
|
|
87
|
+
- **Parameter count:** Flag functions with more than 3 parameters.
|
|
88
|
+
- **Nesting depth:** Flag code with more than 3 levels of nesting.
|
|
89
|
+
- **Naming:** Flag single-letter variables (except loop counters), abbreviations, misleading names.
|
|
90
|
+
- **File size:** Flag files exceeding 500 lines.
|
|
91
|
+
- **Ternary chains:** Flag nested ternaries.
|
|
92
|
+
- **Magic numbers/strings:** Flag hardcoded values that should be constants.
|
|
93
|
+
|
|
94
|
+
7. **Check: Security**
|
|
95
|
+
- **Hardcoded secrets:** Grep for API keys, passwords, tokens, connection strings in source files.
|
|
96
|
+
- **SQL injection:** Search for string concatenation in SQL queries.
|
|
97
|
+
- **XSS:** Search for unsanitized user input rendered in HTML/templates.
|
|
98
|
+
- **Path traversal:** Search for file path operations using unsanitized input.
|
|
99
|
+
- **Dependency vulnerabilities:** Run `npm audit` or equivalent.
|
|
100
|
+
- **Input validation:** Verify all user-facing endpoints validate input at the boundary.
|
|
101
|
+
- **Error exposure:** Flag stack traces or internal details exposed in error responses.
|
|
102
|
+
|
|
103
|
+
8. **Check: Test Coverage**
|
|
104
|
+
- For each new function/method, verify a corresponding test exists.
|
|
105
|
+
- Check test quality: do tests cover happy path, error cases, and edge cases?
|
|
106
|
+
- Flag untested public methods.
|
|
107
|
+
- Run coverage tool if available (`npm run test -- --coverage`).
|
|
108
|
+
|
|
109
|
+
9. **Check: Error Handling**
|
|
110
|
+
- Flag empty catch blocks.
|
|
111
|
+
- Flag generic `throw new Error()` instead of domain-specific exceptions.
|
|
112
|
+
- Flag swallowed exceptions (catch without rethrow or logging).
|
|
113
|
+
- Flag missing error handling on async operations (unhandled promise rejections).
|
|
114
|
+
- Flag non-null assertions (`!`) in production code.
|
|
115
|
+
|
|
116
|
+
10. **Check: Naming Conventions**
|
|
117
|
+
- Verify consistency with existing codebase conventions.
|
|
118
|
+
- Flag naming that does not match the project's established patterns.
|
|
119
|
+
- Check: file names, class names, function names, variable names, constant names.
|
|
120
|
+
|
|
121
|
+
11. **Compile review report**
|
|
122
|
+
Create .sdlc/review/REVIEW-<plan-id>.md with:
|
|
123
|
+
```
|
|
124
|
+
# Code Review: <plan title>
|
|
125
|
+
|
|
126
|
+
## Summary
|
|
127
|
+
- Files reviewed: <count>
|
|
128
|
+
- Blockers: <count>
|
|
129
|
+
- Warnings: <count>
|
|
130
|
+
- Info: <count>
|
|
131
|
+
|
|
132
|
+
## Findings
|
|
133
|
+
|
|
134
|
+
### Blockers (MUST fix before /sdlc:close)
|
|
135
|
+
|
|
136
|
+
#### B-1: <title>
|
|
137
|
+
- **Law:** <which engineering law is violated>
|
|
138
|
+
- **Severity:** BLOCKER
|
|
139
|
+
- **File:** <file path>:<line number>
|
|
140
|
+
- **Description:** <what is wrong and why it matters>
|
|
141
|
+
- **Remediation:** <specific steps to fix it>
|
|
142
|
+
- **Code:**
|
|
143
|
+
```
|
|
144
|
+
<the offending code snippet>
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Warnings (SHOULD fix, recommend addressing)
|
|
148
|
+
|
|
149
|
+
#### W-1: <title>
|
|
150
|
+
...
|
|
151
|
+
|
|
152
|
+
### Info (CONSIDER fixing, low priority)
|
|
153
|
+
|
|
154
|
+
#### I-1: <title>
|
|
155
|
+
...
|
|
156
|
+
|
|
157
|
+
## Laws Compliance Matrix
|
|
158
|
+
| Law | Status | Findings |
|
|
159
|
+
|-----|--------|----------|
|
|
160
|
+
| Single Responsibility | PASS/FAIL | B-1, W-2 |
|
|
161
|
+
| DRY | PASS/FAIL | ... |
|
|
162
|
+
| YAGNI | PASS/FAIL | ... |
|
|
163
|
+
| Clean Code | PASS/FAIL | ... |
|
|
164
|
+
| Security | PASS/FAIL | ... |
|
|
165
|
+
| Test Coverage | PASS/FAIL | ... |
|
|
166
|
+
| Error Handling | PASS/FAIL | ... |
|
|
167
|
+
| Naming | PASS/FAIL | ... |
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
12. **Determine next action**
|
|
171
|
+
- If ZERO blockers:
|
|
172
|
+
- Update STATE.md: set `loop_position: REVIEW_COMPLETE`
|
|
173
|
+
- Set `review_path: .sdlc/review/REVIEW-<plan-id>.md`
|
|
174
|
+
- Output ends with: NEXT ACTION REQUIRED: /sdlc:close
|
|
175
|
+
- If ANY blockers:
|
|
176
|
+
- Update STATE.md: set `loop_position: REVIEW_FAILED`
|
|
177
|
+
- List each blocker with its remediation.
|
|
178
|
+
- Output ends with: "NEXT ACTION REQUIRED: /sdlc:fix — Run /sdlc:fix to systematically fix all blockers, then re-review automatically."
|
|
179
|
+
</process>
|
|
180
|
+
|
|
181
|
+
<success_criteria>
|
|
182
|
+
- [ ] Every modified file read and reviewed
|
|
183
|
+
- [ ] SOLID principles checked with specific file/line references for violations
|
|
184
|
+
- [ ] DRY check performed — duplicate code detected via pattern search
|
|
185
|
+
- [ ] YAGNI check performed — code compared against spec boundaries
|
|
186
|
+
- [ ] Clean Code metrics checked: function length, params, nesting, file size, naming
|
|
187
|
+
- [ ] Security scan performed: secrets, SQL injection, XSS, path traversal, input validation
|
|
188
|
+
- [ ] Test coverage verified: every new public method has tests
|
|
189
|
+
- [ ] Error handling checked: no empty catches, no swallowed exceptions, no generic errors
|
|
190
|
+
- [ ] REVIEW-<plan-id>.md created with all findings, severity, and remediation steps
|
|
191
|
+
- [ ] Laws compliance matrix included in review report
|
|
192
|
+
- [ ] Severity assigned honestly — blockers not downgraded to pass faster
|
|
193
|
+
- [ ] If no blockers: output ends with NEXT ACTION REQUIRED: /sdlc:close
|
|
194
|
+
- [ ] If blockers exist: output ends with NEXT ACTION REQUIRED: /sdlc:fix
|
|
195
|
+
</success_criteria>
|