claude-devkit-cli 1.2.5 → 1.3.1
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/README.md +122 -95
- package/package.json +1 -1
- package/templates/.claude/CLAUDE.md +10 -10
- package/templates/.claude/commands/mf-challenge.md +32 -12
- package/templates/.claude/commands/mf-fix.md +2 -2
- package/templates/.claude/commands/mf-plan.md +509 -82
- package/templates/.claude/commands/mf-review.md +7 -3
- package/templates/.claude/commands/mf-test.md +16 -6
- package/templates/docs/WORKFLOW.md +33 -34
|
@@ -7,7 +7,7 @@ Pre-merge code review — security, correctness, spec alignment.
|
|
|
7
7
|
BASE=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||') || BASE="main"
|
|
8
8
|
git log --oneline "$BASE"...HEAD
|
|
9
9
|
```
|
|
10
|
-
2. Check for spec in `docs/specs
|
|
10
|
+
2. Check for spec in `docs/specs/<feature>/<feature>.md` — review against INTENT.
|
|
11
11
|
3. Read the diff: `git diff "$BASE"...HEAD`
|
|
12
12
|
|
|
13
13
|
If `$ARGUMENTS` provided → scope to those files only.
|
|
@@ -50,11 +50,15 @@ Spend 60% of analysis on the primary focus. Cover all categories, but proportion
|
|
|
50
50
|
- **Null safety:** Optionals used without guards? `object!.property` without nil check?
|
|
51
51
|
|
|
52
52
|
### Spec-Test Alignment (Medium)
|
|
53
|
-
- Source changed but no spec update in `docs/specs
|
|
53
|
+
- Source changed but no spec update in `docs/specs/<feature>/`? → flag
|
|
54
54
|
- Source changed but no test update? → flag
|
|
55
|
-
- Spec changed but tests not updated? → flag
|
|
55
|
+
- Spec changed but acceptance scenarios or tests not updated? → flag
|
|
56
56
|
- Code removed but dead tests remain? → flag
|
|
57
57
|
- Spec contains vague requirements without metrics ("fast", "secure", "easy", "scalable")? → flag with suggestion to add SC-NNN with concrete numbers
|
|
58
|
+
- **AS-to-test name check:** Read the spec's `## Stories` section. For each AS-NNN, check if a test file contains a test named or described with that AS ID or its short description. Flag:
|
|
59
|
+
- AS in spec with no matching test → "AS-NNN: \<description\> has no corresponding test"
|
|
60
|
+
- Test referencing an AS-NNN that no longer exists in the spec → "Test references removed AS-NNN"
|
|
61
|
+
Keep this lightweight — match on AS-NNN identifiers and story name substrings, not semantic analysis.
|
|
58
62
|
|
|
59
63
|
### Code Quality (Medium)
|
|
60
64
|
- Dead code: removed functions still imported elsewhere?
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Write tests from
|
|
1
|
+
Write tests from spec acceptance scenarios, compile, run, fix until green.
|
|
2
2
|
|
|
3
3
|
## Phase 0: Build Context
|
|
4
4
|
|
|
@@ -10,8 +10,7 @@ Write tests from test plan, compile, run, fix until green.
|
|
|
10
10
|
If `$ARGUMENTS` provided → scope to that file or feature only.
|
|
11
11
|
If no changes → "No source changes found. Specify a file or feature."
|
|
12
12
|
|
|
13
|
-
2. **Read the
|
|
14
|
-
3. **Read the spec** in `docs/specs/` if it exists — understand the INTENT behind the code.
|
|
13
|
+
2. **Read the spec** at `docs/specs/<feature>/<feature>.md` — the `## Stories` section with acceptance scenarios is your roadmap. The `## Overview` and `## Constraints` sections tell you the INTENT behind the code.
|
|
15
14
|
4. **Read existing tests** for the changed files — find patterns, fixtures, naming conventions. Don't duplicate.
|
|
16
15
|
|
|
17
16
|
---
|
|
@@ -86,14 +85,25 @@ If tests fail:
|
|
|
86
85
|
|
|
87
86
|
```
|
|
88
87
|
Tests: X added, Y modified, Z unchanged
|
|
89
|
-
Result: All passing ✓
|
|
88
|
+
Result: All passing ✓ / N failing ✗
|
|
90
89
|
Coverage: [critical uncovered paths if any]
|
|
91
90
|
Files: [test files touched]
|
|
92
|
-
|
|
91
|
+
Stories: [AS-001 ✓, AS-002 ✓, AS-005 new]
|
|
93
92
|
```
|
|
94
93
|
|
|
95
|
-
If behavior changed: "Consider updating the spec in docs/specs
|
|
94
|
+
If behavior changed: "Consider updating the spec in docs/specs/<feature>/<feature>.md."
|
|
95
|
+
|
|
96
|
+
### Spec Gap Detection
|
|
97
|
+
|
|
98
|
+
If a test fails due to an edge case, error path, or boundary condition that is NOT covered by any existing AS in the spec:
|
|
99
|
+
|
|
100
|
+
1. State explicitly: **"This failure suggests a missing acceptance scenario."**
|
|
101
|
+
2. Describe the gap: what behavior was tested, which story it belongs to, why no AS covers it.
|
|
102
|
+
3. Prompt: **"Run `/mf-plan <spec-path> 'Add AS for <description>'` to add the missing scenario."**
|
|
103
|
+
|
|
104
|
+
Do not silently fix the test and move on. A test that has no corresponding AS means the spec is incomplete — the spec must be updated first.
|
|
96
105
|
|
|
97
106
|
## Rules
|
|
98
107
|
1. **Behavior over implementation.** Test what code DOES, not how.
|
|
99
108
|
2. **Independent tests.** Each test sets up its own state, cleans up after.
|
|
109
|
+
3. **Spec stays upstream.** If a test reveals a spec gap, update the spec before adding the test.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Development Workflow Reference
|
|
2
2
|
|
|
3
|
-
> Spec-first development: every change follows SPEC
|
|
3
|
+
> Spec-first development: every change follows SPEC (with acceptance scenarios) → CODE + TESTS → BUILD PASS.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -12,12 +12,11 @@ When: Building something that doesn't exist yet (no code, no spec).
|
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
Step 1 → /mf-plan "description of feature"
|
|
15
|
-
Generates: docs/specs/<feature>.md (spec)
|
|
16
|
-
docs/test-plans/<feature>.md (test plan)
|
|
15
|
+
Generates: docs/specs/<feature>/<feature>.md (spec with acceptance scenarios)
|
|
17
16
|
Answers validation questions about assumptions.
|
|
18
|
-
Review
|
|
17
|
+
Review before proceeding.
|
|
19
18
|
|
|
20
|
-
Step 2 → (Optional) /mf-challenge docs/
|
|
19
|
+
Step 2 → (Optional) /mf-challenge docs/specs/<feature>/<feature>.md
|
|
21
20
|
Adversarial review: spawns hostile reviewers to find flaws.
|
|
22
21
|
Recommended for complex features, auth, data pipelines.
|
|
23
22
|
Skip for simple CRUD or small features.
|
|
@@ -36,13 +35,12 @@ Step 5 → /mf-commit
|
|
|
36
35
|
When: Changing behavior, adding options, refactoring logic.
|
|
37
36
|
|
|
38
37
|
```
|
|
39
|
-
Step 1 →
|
|
40
|
-
|
|
38
|
+
Step 1 → /mf-plan docs/specs/<feature>/<feature>.md "description of changes"
|
|
39
|
+
Mode C handles everything: snapshot → classification → change report → apply.
|
|
40
|
+
Do NOT manually edit the spec before running /mf-plan — it creates the
|
|
41
|
+
snapshot first, then applies changes. Manual edits bypass snapshot protection.
|
|
41
42
|
|
|
42
|
-
Step 2 →
|
|
43
|
-
Updates the test plan with new/modified/removed test cases.
|
|
44
|
-
|
|
45
|
-
Step 3 → Implement code changes.
|
|
43
|
+
Step 2 → Implement code changes.
|
|
46
44
|
/mf-test
|
|
47
45
|
Fix until green.
|
|
48
46
|
|
|
@@ -67,8 +65,10 @@ Optional → If the bug reveals an undocumented edge case, update the spec.
|
|
|
67
65
|
When: Deleting a feature, removing deprecated code.
|
|
68
66
|
|
|
69
67
|
```
|
|
70
|
-
Step 1 →
|
|
71
|
-
|
|
68
|
+
Step 1 → /mf-plan docs/specs/<feature>/<feature>.md "remove stories S-XXX"
|
|
69
|
+
Mode C creates a snapshot (removing stories = M2 = Major),
|
|
70
|
+
then marks stories and AS as removed in the spec.
|
|
71
|
+
(Or if removing the entire feature: archive the directory.)
|
|
72
72
|
|
|
73
73
|
Step 2 → Delete production code and related test code.
|
|
74
74
|
|
|
@@ -96,7 +96,7 @@ Is this a brand new feature (no existing spec or code)?
|
|
|
96
96
|
│ └─ No
|
|
97
97
|
│ ├─ Are you removing/deprecating code?
|
|
98
98
|
│ │ ├─ Yes → Remove Feature workflow.
|
|
99
|
-
│ │ └─ No → Update Feature workflow. Start
|
|
99
|
+
│ │ └─ No → Update Feature workflow. Start with /mf-plan.
|
|
100
100
|
│ │
|
|
101
101
|
│ └─ Is the change very small (< 5 lines, behavior unchanged)?
|
|
102
102
|
│ └─ Yes → Skip spec update. Just /mf-test and /mf-commit.
|
|
@@ -115,8 +115,8 @@ I just implemented [brief description].
|
|
|
115
115
|
Files changed: [list files]
|
|
116
116
|
|
|
117
117
|
Based on:
|
|
118
|
-
- Spec: docs/specs/<feature>.md (section §X)
|
|
119
|
-
-
|
|
118
|
+
- Spec: docs/specs/<feature>/<feature>.md (section §X)
|
|
119
|
+
- Acceptance scenarios: docs/specs/<feature>/<feature>.md (section ## Stories)
|
|
120
120
|
|
|
121
121
|
Write tests for the part I just implemented.
|
|
122
122
|
Only tests related to this change — not the entire feature.
|
|
@@ -130,11 +130,11 @@ If the spec seems incomplete, note what's missing but don't change it.
|
|
|
130
130
|
I'm about to change [description of change].
|
|
131
131
|
Affected files: [list]
|
|
132
132
|
|
|
133
|
-
1.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
1. /mf-plan docs/specs/<feature>/<feature>.md "description of changes"
|
|
134
|
+
(handles snapshot + spec update + acceptance scenarios)
|
|
135
|
+
2. Implement the code change
|
|
136
|
+
3. Update tests to match
|
|
137
|
+
4. Build and run → fix until green
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
### Template C — Test-First Bug Fix
|
|
@@ -157,11 +157,11 @@ Actual: [broken behavior]
|
|
|
157
157
|
Removing: [feature name]
|
|
158
158
|
Files to delete: [list]
|
|
159
159
|
|
|
160
|
-
1.
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
1. /mf-plan docs/specs/<feature>/<feature>.md "remove stories S-XXX, S-YYY"
|
|
161
|
+
(handles snapshot + marks stories and AS as removed)
|
|
162
|
+
2. Delete production code
|
|
163
|
+
3. Delete test code
|
|
164
|
+
4. Run full test suite → fix cascading breaks
|
|
165
165
|
```
|
|
166
166
|
|
|
167
167
|
---
|
|
@@ -178,7 +178,7 @@ Files to delete: [list]
|
|
|
178
178
|
| `/mf-challenge` (adversarial) | 15–30k | After /mf-plan, for complex features |
|
|
179
179
|
| Full audit (manual) | 100k+ | Before release, quarterly |
|
|
180
180
|
|
|
181
|
-
**Rule of thumb:** Daily work uses templates + `/test` → low token cost.
|
|
181
|
+
**Rule of thumb:** Daily work uses templates + `/mf-test` → low token cost.
|
|
182
182
|
Save `/mf-plan` and full audits for significant milestones.
|
|
183
183
|
|
|
184
184
|
---
|
|
@@ -187,8 +187,8 @@ Save `/mf-plan` and full audits for significant milestones.
|
|
|
187
187
|
|
|
188
188
|
Use this as a PR review checklist (enforce manually or via CI):
|
|
189
189
|
|
|
190
|
-
- [ ] **Spec updated?** If production behavior changed, `docs/specs
|
|
191
|
-
- [ ] **
|
|
190
|
+
- [ ] **Spec updated?** If production behavior changed, `docs/specs/<feature>/` should have changes.
|
|
191
|
+
- [ ] **Acceptance scenarios updated?** If spec behavior changed, AS in spec should reflect it.
|
|
192
192
|
- [ ] **Tests pass?** `bash scripts/build-test.sh` exits 0.
|
|
193
193
|
- [ ] **No dead tests?** Removed production code → removed corresponding tests.
|
|
194
194
|
- [ ] **Coverage not decreased?** (Optional, per-team decision.)
|
|
@@ -201,16 +201,15 @@ Use this as a PR review checklist (enforce manually or via CI):
|
|
|
201
201
|
|
|
202
202
|
| Change | Must Also Update |
|
|
203
203
|
|--------|-----------------|
|
|
204
|
-
| Production code behavior changed | Spec
|
|
205
|
-
| Spec updated |
|
|
206
|
-
|
|
|
207
|
-
| Code removed | Remove related tests. Mark spec as removed. |
|
|
204
|
+
| Production code behavior changed | Spec (including acceptance scenarios) + tests |
|
|
205
|
+
| Spec updated | Acceptance scenarios + tests (if behavior changed) |
|
|
206
|
+
| Code removed | Remove related tests. Mark spec and AS as removed. |
|
|
208
207
|
| Bug fix | Add test. Update spec if edge case was undocumented. |
|
|
209
208
|
|
|
210
209
|
**Never acceptable:**
|
|
211
210
|
- Code changed, spec not updated (spec drift)
|
|
212
211
|
- Code changed, tests not updated (untested code)
|
|
213
|
-
- Spec changed, tests not updated (
|
|
212
|
+
- Spec changed, acceptance scenarios or tests not updated (AS drift)
|
|
214
213
|
- Code removed, dead tests remain (orphaned tests)
|
|
215
214
|
|
|
216
215
|
**Acceptable shortcut** for changes under 5 lines with no behavior change:
|