@gordon.gan/specflow 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 +31 -0
- package/README.md +442 -0
- package/bin/specflow.js +2 -0
- package/dist/cli/commands/change-archive.d.ts +26 -0
- package/dist/cli/commands/change-archive.js +50 -0
- package/dist/cli/commands/change-new.d.ts +18 -0
- package/dist/cli/commands/change-new.js +53 -0
- package/dist/cli/commands/change-phase.d.ts +33 -0
- package/dist/cli/commands/change-phase.js +66 -0
- package/dist/cli/commands/change-status.d.ts +35 -0
- package/dist/cli/commands/change-status.js +95 -0
- package/dist/cli/commands/doctor.d.ts +9 -0
- package/dist/cli/commands/doctor.js +48 -0
- package/dist/cli/commands/init.d.ts +16 -0
- package/dist/cli/commands/init.js +122 -0
- package/dist/cli/commands/instructions.d.ts +21 -0
- package/dist/cli/commands/instructions.js +75 -0
- package/dist/cli/commands/parity-report.d.ts +10 -0
- package/dist/cli/commands/parity-report.js +67 -0
- package/dist/cli/commands/sync.d.ts +4 -0
- package/dist/cli/commands/sync.js +40 -0
- package/dist/cli/commands/validate.d.ts +21 -0
- package/dist/cli/commands/validate.js +46 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +52 -0
- package/dist/core/archive.d.ts +39 -0
- package/dist/core/archive.js +154 -0
- package/dist/core/artifact-graph/graph.d.ts +60 -0
- package/dist/core/artifact-graph/graph.js +141 -0
- package/dist/core/artifact-graph/index.d.ts +10 -0
- package/dist/core/artifact-graph/index.js +7 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +45 -0
- package/dist/core/artifact-graph/instruction-loader.js +37 -0
- package/dist/core/artifact-graph/outputs.d.ts +35 -0
- package/dist/core/artifact-graph/outputs.js +48 -0
- package/dist/core/artifact-graph/resolver.d.ts +54 -0
- package/dist/core/artifact-graph/resolver.js +139 -0
- package/dist/core/artifact-graph/schema.d.ts +23 -0
- package/dist/core/artifact-graph/schema.js +115 -0
- package/dist/core/artifact-graph/state.d.ts +9 -0
- package/dist/core/artifact-graph/state.js +93 -0
- package/dist/core/artifact-graph/types.d.ts +123 -0
- package/dist/core/artifact-graph/types.js +29 -0
- package/dist/core/parsers/change-parser.d.ts +20 -0
- package/dist/core/parsers/change-parser.js +22 -0
- package/dist/core/parsers/index.d.ts +7 -0
- package/dist/core/parsers/index.js +4 -0
- package/dist/core/parsers/markdown-parser.d.ts +35 -0
- package/dist/core/parsers/markdown-parser.js +193 -0
- package/dist/core/parsers/requirement-blocks.d.ts +21 -0
- package/dist/core/parsers/requirement-blocks.js +57 -0
- package/dist/core/parsers/spec-structure.d.ts +22 -0
- package/dist/core/parsers/spec-structure.js +105 -0
- package/dist/core/specs-apply.d.ts +22 -0
- package/dist/core/specs-apply.js +165 -0
- package/dist/core/templates/index.d.ts +31 -0
- package/dist/core/templates/index.js +80 -0
- package/dist/core/templates/types.d.ts +4 -0
- package/dist/core/templates/types.js +1 -0
- package/dist/core/validation/constants.d.ts +14 -0
- package/dist/core/validation/constants.js +14 -0
- package/dist/core/validation/types.d.ts +13 -0
- package/dist/core/validation/types.js +6 -0
- package/dist/core/validation/validator.d.ts +24 -0
- package/dist/core/validation/validator.js +250 -0
- package/dist/integrations/claude/adapter.d.ts +2 -0
- package/dist/integrations/claude/adapter.js +106 -0
- package/dist/integrations/codex/adapter.d.ts +2 -0
- package/dist/integrations/codex/adapter.js +141 -0
- package/dist/integrations/cursor/adapter.d.ts +2 -0
- package/dist/integrations/cursor/adapter.js +126 -0
- package/dist/integrations/shared/adapter-registry.d.ts +4 -0
- package/dist/integrations/shared/adapter-registry.js +27 -0
- package/dist/integrations/shared/asset-copy.d.ts +2 -0
- package/dist/integrations/shared/asset-copy.js +44 -0
- package/dist/integrations/shared/asset-hash.d.ts +4 -0
- package/dist/integrations/shared/asset-hash.js +54 -0
- package/dist/integrations/shared/capability-evidence.d.ts +1 -0
- package/dist/integrations/shared/capability-evidence.js +42 -0
- package/dist/integrations/shared/command-catalog.d.ts +6 -0
- package/dist/integrations/shared/command-catalog.js +13 -0
- package/dist/integrations/shared/managed-assets.d.ts +2 -0
- package/dist/integrations/shared/managed-assets.js +21 -0
- package/dist/integrations/shared/marker-write.d.ts +3 -0
- package/dist/integrations/shared/marker-write.js +48 -0
- package/dist/integrations/shared/migration-state.d.ts +2 -0
- package/dist/integrations/shared/migration-state.js +67 -0
- package/dist/integrations/shared/parity-comparator.d.ts +6 -0
- package/dist/integrations/shared/parity-comparator.js +97 -0
- package/dist/integrations/shared/parity-manifest.d.ts +13 -0
- package/dist/integrations/shared/parity-manifest.js +58 -0
- package/dist/integrations/shared/runtime-assets.d.ts +2 -0
- package/dist/integrations/shared/runtime-assets.js +21 -0
- package/dist/integrations/shared/skill-renderer.d.ts +5 -0
- package/dist/integrations/shared/skill-renderer.js +77 -0
- package/dist/integrations/shared/types.d.ts +35 -0
- package/dist/integrations/shared/types.js +1 -0
- package/dist/utils/change-metadata.d.ts +38 -0
- package/dist/utils/change-metadata.js +82 -0
- package/dist/utils/change-utils.d.ts +53 -0
- package/dist/utils/change-utils.js +97 -0
- package/dist/utils/file-system.d.ts +35 -0
- package/dist/utils/file-system.js +67 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/project-root.d.ts +22 -0
- package/dist/utils/project-root.js +44 -0
- package/dist/utils/task-progress.d.ts +39 -0
- package/dist/utils/task-progress.js +62 -0
- package/package.json +72 -0
- package/prompts/build/ecc-go-reviewer.md +80 -0
- package/prompts/build/ecc-java-reviewer.md +185 -0
- package/prompts/build/ecc-kotlin-reviewer.md +163 -0
- package/prompts/build/ecc-python-reviewer.md +102 -0
- package/prompts/build/ecc-rust-reviewer.md +98 -0
- package/prompts/build/ecc-typescript-reviewer.md +116 -0
- package/prompts/build/language-router.md +22 -0
- package/prompts/build/phase-a-plan.md +288 -0
- package/prompts/build/phase-b-execute.md +276 -0
- package/prompts/build/phase-b-review.md +119 -0
- package/prompts/build/phase-b-worktree.md +215 -0
- package/prompts/build/plan-document-reviewer.md +51 -0
- package/prompts/build/tdd.md +184 -0
- package/prompts/done/branch-finish.md +204 -0
- package/prompts/fix/debug.md +249 -0
- package/prompts/plan/design-draft.md +123 -0
- package/prompts/plan/proposal.md +85 -0
- package/prompts/plan/specs.md +114 -0
- package/prompts/plan/tasks-draft.md +123 -0
- package/prompts/reference/openspec/apply-instruction.md +2 -0
- package/prompts/reference/openspec/design-instruction.md +20 -0
- package/prompts/reference/openspec/proposal-instruction.md +18 -0
- package/prompts/reference/openspec/specs-instruction.md +47 -0
- package/prompts/reference/openspec/tasks-instruction.md +26 -0
- package/prompts/reference/specflow/example-design.md +284 -0
- package/prompts/reference/superpowers/anthropic-best-practices.md +1150 -0
- package/prompts/reference/superpowers/codex-tools.md +29 -0
- package/prompts/reference/superpowers/condition-based-waiting-example.ts +158 -0
- package/prompts/reference/superpowers/condition-based-waiting.md +115 -0
- package/prompts/reference/superpowers/defense-in-depth.md +122 -0
- package/prompts/reference/superpowers/find-polluter.sh +63 -0
- package/prompts/reference/superpowers/graphviz-conventions.dot +172 -0
- package/prompts/reference/superpowers/persuasion-principles.md +187 -0
- package/prompts/reference/superpowers/root-cause-tracing.md +169 -0
- package/prompts/reference/superpowers/testing-anti-patterns.md +299 -0
- package/prompts/reference/superpowers/testing-skills-with-subagents.md +384 -0
- package/prompts/reference/superpowers/using-superpowers.md +117 -0
- package/prompts/reference/superpowers/writing-skills.md +655 -0
- package/prompts/refine/brainstorm.md +241 -0
- package/prompts/refine/design-output.md +126 -0
- package/prompts/refine/spec-document-reviewer.md +51 -0
- package/prompts/refine/update-artifacts.md +185 -0
- package/prompts/review/code-review.md +223 -0
- package/prompts/shared/code-reviewer-prompt.md +98 -0
- package/prompts/shared/dispatching-parallel-agents.md +143 -0
- package/prompts/shared/executing-plans.md +67 -0
- package/prompts/shared/implementer-prompt.md +115 -0
- package/prompts/shared/receiving-code-review.md +174 -0
- package/prompts/shared/spec-reviewer-prompt.md +63 -0
- package/prompts/test/tdd.md +236 -0
- package/prompts/test/verification.md +129 -0
- package/prompts/verify/ecc-security-reviewer.md +112 -0
- package/prompts/verify/verification.md +196 -0
- package/schemas/specflow/schema.yaml +48 -0
- package/skills/specflow-build/SKILL.md +129 -0
- package/skills/specflow-done/SKILL.md +68 -0
- package/skills/specflow-fix/SKILL.md +74 -0
- package/skills/specflow-plan/SKILL.md +82 -0
- package/skills/specflow-refine/SKILL.md +128 -0
- package/skills/specflow-review/SKILL.md +40 -0
- package/skills/specflow-scan/SKILL.md +48 -0
- package/skills/specflow-snap/SKILL.md +46 -0
- package/skills/specflow-test/SKILL.md +48 -0
- package/skills/specflow-verify/SKILL.md +77 -0
- package/templates/design.md +19 -0
- package/templates/proposal.md +23 -0
- package/templates/spec.md +42 -0
- package/templates/tasks.md +9 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
<!-- SOURCE: skills/receiving-code-review/SKILL.md -->
|
|
2
|
+
|
|
3
|
+
# Receiving Code Review
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Code review requires technical evaluation, not emotional performance.
|
|
8
|
+
|
|
9
|
+
**Core principle:** Verify before implementing. Ask before assuming. Technical correctness over social comfort.
|
|
10
|
+
|
|
11
|
+
## The Response Pattern
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
WHEN receiving code review feedback:
|
|
15
|
+
|
|
16
|
+
1. READ: Complete feedback without reacting
|
|
17
|
+
2. UNDERSTAND: Restate requirement in own words (or ask)
|
|
18
|
+
3. VERIFY: Check against codebase reality
|
|
19
|
+
4. EVALUATE: Technically sound for THIS codebase?
|
|
20
|
+
5. RESPOND: Technical acknowledgment or reasoned pushback
|
|
21
|
+
6. IMPLEMENT: One item at a time, test each
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Forbidden Responses
|
|
25
|
+
|
|
26
|
+
**NEVER:**
|
|
27
|
+
- "You're absolutely right!"
|
|
28
|
+
- "Great point!" / "Excellent feedback!"
|
|
29
|
+
- "Let me implement that now" (before verification)
|
|
30
|
+
|
|
31
|
+
**INSTEAD:**
|
|
32
|
+
- Restate the technical requirement
|
|
33
|
+
- Ask clarifying questions
|
|
34
|
+
- Push back with technical reasoning if wrong
|
|
35
|
+
- Just start working (actions > words)
|
|
36
|
+
|
|
37
|
+
## Handling Unclear Feedback
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
IF any item is unclear:
|
|
41
|
+
STOP - do not implement anything yet
|
|
42
|
+
ASK for clarification on unclear items
|
|
43
|
+
|
|
44
|
+
WHY: Items may be related. Partial understanding = wrong implementation.
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Example:**
|
|
48
|
+
```
|
|
49
|
+
Partner: "Fix 1-6"
|
|
50
|
+
You understand 1,2,3,6. Unclear on 4,5.
|
|
51
|
+
|
|
52
|
+
WRONG: Implement 1,2,3,6 now, ask about 4,5 later
|
|
53
|
+
RIGHT: "I understand items 1,2,3,6. Need clarification on 4 and 5 before proceeding."
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Source-Specific Handling
|
|
57
|
+
|
|
58
|
+
### From Your Human Partner
|
|
59
|
+
- **Trusted** - implement after understanding
|
|
60
|
+
- **Still ask** if scope unclear
|
|
61
|
+
- **No performative agreement**
|
|
62
|
+
- **Skip to action** or technical acknowledgment
|
|
63
|
+
|
|
64
|
+
### From External Reviewers
|
|
65
|
+
```
|
|
66
|
+
BEFORE implementing:
|
|
67
|
+
1. Check: Technically correct for THIS codebase?
|
|
68
|
+
2. Check: Breaks existing functionality?
|
|
69
|
+
3. Check: Reason for current implementation?
|
|
70
|
+
4. Check: Works on all platforms/versions?
|
|
71
|
+
5. Check: Does reviewer understand full context?
|
|
72
|
+
|
|
73
|
+
IF suggestion seems wrong:
|
|
74
|
+
Push back with technical reasoning
|
|
75
|
+
|
|
76
|
+
IF can't easily verify:
|
|
77
|
+
Say so: "I can't verify this without [X]. Should I [investigate/ask/proceed]?"
|
|
78
|
+
|
|
79
|
+
IF conflicts with partner's prior decisions:
|
|
80
|
+
Stop and discuss with partner first
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## YAGNI Check for "Professional" Features
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
IF reviewer suggests "implementing properly":
|
|
87
|
+
grep codebase for actual usage
|
|
88
|
+
|
|
89
|
+
IF unused: "This endpoint isn't called. Remove it (YAGNI)?"
|
|
90
|
+
IF used: Then implement properly
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Implementation Order
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
FOR multi-item feedback:
|
|
97
|
+
1. Clarify anything unclear FIRST
|
|
98
|
+
2. Then implement in this order:
|
|
99
|
+
- Blocking issues (breaks, security)
|
|
100
|
+
- Simple fixes (typos, imports)
|
|
101
|
+
- Complex fixes (refactoring, logic)
|
|
102
|
+
3. Test each fix individually
|
|
103
|
+
4. Verify no regressions
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## When To Push Back
|
|
107
|
+
|
|
108
|
+
Push back when:
|
|
109
|
+
- Suggestion breaks existing functionality
|
|
110
|
+
- Reviewer lacks full context
|
|
111
|
+
- Violates YAGNI (unused feature)
|
|
112
|
+
- Technically incorrect for this stack
|
|
113
|
+
- Legacy/compatibility reasons exist
|
|
114
|
+
- Conflicts with partner's architectural decisions
|
|
115
|
+
|
|
116
|
+
**How to push back:**
|
|
117
|
+
- Use technical reasoning, not defensiveness
|
|
118
|
+
- Ask specific questions
|
|
119
|
+
- Reference working tests/code
|
|
120
|
+
- Involve partner if architectural
|
|
121
|
+
|
|
122
|
+
## Acknowledging Correct Feedback
|
|
123
|
+
|
|
124
|
+
When feedback IS correct:
|
|
125
|
+
```
|
|
126
|
+
CORRECT: "Fixed. [Brief description of what changed]"
|
|
127
|
+
CORRECT: "Good catch - [specific issue]. Fixed in [location]."
|
|
128
|
+
CORRECT: [Just fix it and show in the code]
|
|
129
|
+
|
|
130
|
+
WRONG: "You're absolutely right!"
|
|
131
|
+
WRONG: "Great point!"
|
|
132
|
+
WRONG: "Thanks for catching that!"
|
|
133
|
+
WRONG: ANY gratitude expression
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Why no thanks:** Actions speak. Just fix it. The code itself shows you heard the feedback.
|
|
137
|
+
|
|
138
|
+
## Gracefully Correcting Your Pushback
|
|
139
|
+
|
|
140
|
+
If you pushed back and were wrong:
|
|
141
|
+
```
|
|
142
|
+
CORRECT: "You were right - I checked [X] and it does [Y]. Implementing now."
|
|
143
|
+
CORRECT: "Verified this and you're correct. My initial understanding was wrong because [reason]. Fixing."
|
|
144
|
+
|
|
145
|
+
WRONG: Long apology
|
|
146
|
+
WRONG: Defending why you pushed back
|
|
147
|
+
WRONG: Over-explaining
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
State the correction factually and move on.
|
|
151
|
+
|
|
152
|
+
## Common Mistakes
|
|
153
|
+
|
|
154
|
+
| Mistake | Fix |
|
|
155
|
+
|---------|-----|
|
|
156
|
+
| Performative agreement | State requirement or just act |
|
|
157
|
+
| Blind implementation | Verify against codebase first |
|
|
158
|
+
| Batch without testing | One at a time, test each |
|
|
159
|
+
| Assuming reviewer is right | Check if breaks things |
|
|
160
|
+
| Avoiding pushback | Technical correctness > comfort |
|
|
161
|
+
| Partial implementation | Clarify all items first |
|
|
162
|
+
| Can't verify, proceed anyway | State limitation, ask for direction |
|
|
163
|
+
|
|
164
|
+
## GitHub Thread Replies
|
|
165
|
+
|
|
166
|
+
When replying to inline review comments on GitHub, reply in the comment thread (`gh api repos/{owner}/{repo}/pulls/{pr}/comments/{id}/replies`), not as a top-level PR comment.
|
|
167
|
+
|
|
168
|
+
## The Bottom Line
|
|
169
|
+
|
|
170
|
+
**External feedback = suggestions to evaluate, not orders to follow.**
|
|
171
|
+
|
|
172
|
+
Verify. Question. Then implement.
|
|
173
|
+
|
|
174
|
+
No performative agreement. Technical rigor always.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<!-- SOURCE: skills/subagent-driven-development/spec-reviewer-prompt.md -->
|
|
2
|
+
|
|
3
|
+
# Spec Compliance Reviewer Prompt Template
|
|
4
|
+
|
|
5
|
+
Use this template when dispatching a spec compliance reviewer subagent.
|
|
6
|
+
|
|
7
|
+
**Purpose:** Verify implementer built what was requested (nothing more, nothing less)
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
Task tool (general-purpose):
|
|
11
|
+
description: "Review spec compliance for Task N"
|
|
12
|
+
prompt: |
|
|
13
|
+
You are reviewing whether an implementation matches its specification.
|
|
14
|
+
|
|
15
|
+
## What Was Requested
|
|
16
|
+
|
|
17
|
+
[FULL TEXT of task requirements]
|
|
18
|
+
|
|
19
|
+
## What Implementer Claims They Built
|
|
20
|
+
|
|
21
|
+
[From implementer's report]
|
|
22
|
+
|
|
23
|
+
## CRITICAL: Do Not Trust the Report
|
|
24
|
+
|
|
25
|
+
The implementer finished suspiciously quickly. Their report may be incomplete,
|
|
26
|
+
inaccurate, or optimistic. You MUST verify everything independently.
|
|
27
|
+
|
|
28
|
+
**DO NOT:**
|
|
29
|
+
- Take their word for what they implemented
|
|
30
|
+
- Trust their claims about completeness
|
|
31
|
+
- Accept their interpretation of requirements
|
|
32
|
+
|
|
33
|
+
**DO:**
|
|
34
|
+
- Read the actual code they wrote
|
|
35
|
+
- Compare actual implementation to requirements line by line
|
|
36
|
+
- Check for missing pieces they claimed to implement
|
|
37
|
+
- Look for extra features they didn't mention
|
|
38
|
+
|
|
39
|
+
## Your Job
|
|
40
|
+
|
|
41
|
+
Read the implementation code and verify:
|
|
42
|
+
|
|
43
|
+
**Missing requirements:**
|
|
44
|
+
- Did they implement everything that was requested?
|
|
45
|
+
- Are there requirements they skipped or missed?
|
|
46
|
+
- Did they claim something works but didn't actually implement it?
|
|
47
|
+
|
|
48
|
+
**Extra/unneeded work:**
|
|
49
|
+
- Did they build things that weren't requested?
|
|
50
|
+
- Did they over-engineer or add unnecessary features?
|
|
51
|
+
- Did they add "nice to haves" that weren't in spec?
|
|
52
|
+
|
|
53
|
+
**Misunderstandings:**
|
|
54
|
+
- Did they interpret requirements differently than intended?
|
|
55
|
+
- Did they solve the wrong problem?
|
|
56
|
+
- Did they implement the right feature but wrong way?
|
|
57
|
+
|
|
58
|
+
**Verify by reading code, not by trusting report.**
|
|
59
|
+
|
|
60
|
+
Report:
|
|
61
|
+
- Spec compliant (if everything matches after code inspection)
|
|
62
|
+
- OR: Issues found: [list specifically what's missing or extra, with file:line references]
|
|
63
|
+
```
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
> **HARD GATE**: Test must FAIL before writing implementation. If you write production code before seeing a failing test, delete it and start over. No exceptions.
|
|
2
|
+
|
|
3
|
+
<!-- SOURCE: skills/test-driven-development/SKILL.md -->
|
|
4
|
+
|
|
5
|
+
# Test-Driven Development (Standalone Test Suite Variant)
|
|
6
|
+
|
|
7
|
+
Full-suite multi-level testing: unit, integration, E2E, and regression. Use this for comprehensive test coverage across an entire codebase or feature area.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Write the test first. Watch it fail. Write minimal code to pass.
|
|
12
|
+
|
|
13
|
+
**Core principle:** If you didn't watch the test fail, you don't know if it tests the right thing.
|
|
14
|
+
|
|
15
|
+
**Violating the letter of the rules is violating the spirit of the rules.**
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
**Standalone testing scenarios:**
|
|
20
|
+
- Building out a complete test suite for new or existing code
|
|
21
|
+
- Adding multi-level test coverage (unit + integration + E2E)
|
|
22
|
+
- Regression testing after bug fixes
|
|
23
|
+
- Pre-release verification testing
|
|
24
|
+
- Migrating or upgrading with test safety nets
|
|
25
|
+
|
|
26
|
+
## The Iron Law
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Write code before the test? Delete it. Start over.
|
|
33
|
+
|
|
34
|
+
## Red-Green-Refactor
|
|
35
|
+
|
|
36
|
+
```dot
|
|
37
|
+
digraph tdd_cycle {
|
|
38
|
+
rankdir=LR;
|
|
39
|
+
red [label="RED\nWrite failing test", shape=box, style=filled, fillcolor="#ffcccc"];
|
|
40
|
+
verify_red [label="Verify fails\ncorrectly", shape=diamond];
|
|
41
|
+
green [label="GREEN\nMinimal code", shape=box, style=filled, fillcolor="#ccffcc"];
|
|
42
|
+
verify_green [label="Verify passes\nAll green", shape=diamond];
|
|
43
|
+
refactor [label="REFACTOR\nClean up", shape=box, style=filled, fillcolor="#ccccff"];
|
|
44
|
+
next [label="Next", shape=ellipse];
|
|
45
|
+
|
|
46
|
+
red -> verify_red;
|
|
47
|
+
verify_red -> green [label="yes"];
|
|
48
|
+
verify_red -> red [label="wrong\nfailure"];
|
|
49
|
+
green -> verify_green;
|
|
50
|
+
verify_green -> refactor [label="yes"];
|
|
51
|
+
verify_green -> green [label="no"];
|
|
52
|
+
refactor -> verify_green [label="stay\ngreen"];
|
|
53
|
+
verify_green -> next;
|
|
54
|
+
next -> red;
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### RED - Write Failing Test
|
|
59
|
+
|
|
60
|
+
Write one minimal test showing what should happen.
|
|
61
|
+
|
|
62
|
+
**Requirements:**
|
|
63
|
+
- One behavior per test
|
|
64
|
+
- Clear, descriptive name
|
|
65
|
+
- Real code (no mocks unless unavoidable)
|
|
66
|
+
|
|
67
|
+
### Verify RED - Watch It Fail
|
|
68
|
+
|
|
69
|
+
**MANDATORY. Never skip.**
|
|
70
|
+
|
|
71
|
+
Confirm:
|
|
72
|
+
- Test fails (not errors)
|
|
73
|
+
- Failure message is expected
|
|
74
|
+
- Fails because feature missing (not typos)
|
|
75
|
+
|
|
76
|
+
### GREEN - Minimal Code
|
|
77
|
+
|
|
78
|
+
Write simplest code to pass the test. Don't over-engineer.
|
|
79
|
+
|
|
80
|
+
### Verify GREEN - Watch It Pass
|
|
81
|
+
|
|
82
|
+
**MANDATORY.**
|
|
83
|
+
|
|
84
|
+
Confirm:
|
|
85
|
+
- Test passes
|
|
86
|
+
- Other tests still pass
|
|
87
|
+
- Output pristine
|
|
88
|
+
|
|
89
|
+
### REFACTOR - Clean Up
|
|
90
|
+
|
|
91
|
+
After green only. Keep tests green. Don't add behavior.
|
|
92
|
+
|
|
93
|
+
## Multi-Level Testing Strategy
|
|
94
|
+
|
|
95
|
+
### Level 1: Unit Tests
|
|
96
|
+
|
|
97
|
+
Test individual functions, utilities, and components in isolation.
|
|
98
|
+
|
|
99
|
+
- One behavior per test
|
|
100
|
+
- No external dependencies (mock at boundaries only)
|
|
101
|
+
- Fast execution (milliseconds per test)
|
|
102
|
+
- Cover: happy path, edge cases, error conditions, boundary values
|
|
103
|
+
|
|
104
|
+
### Level 2: Integration Tests
|
|
105
|
+
|
|
106
|
+
Test how components interact with each other and external systems.
|
|
107
|
+
|
|
108
|
+
- Test real interactions (database, API, file system)
|
|
109
|
+
- Use test fixtures / test databases where possible
|
|
110
|
+
- Cover: data flow between components, API contracts, database operations
|
|
111
|
+
- Slower execution acceptable (seconds per test)
|
|
112
|
+
|
|
113
|
+
### Level 3: E2E Tests
|
|
114
|
+
|
|
115
|
+
Test critical user flows end-to-end.
|
|
116
|
+
|
|
117
|
+
- Simulate real user actions
|
|
118
|
+
- Test the full stack
|
|
119
|
+
- Cover: critical business flows, user journeys, cross-cutting concerns
|
|
120
|
+
- Slowest execution (seconds to minutes per test)
|
|
121
|
+
|
|
122
|
+
### Level 4: Regression Tests
|
|
123
|
+
|
|
124
|
+
Test that fixed bugs stay fixed.
|
|
125
|
+
|
|
126
|
+
- Write a failing test that reproduces the exact bug
|
|
127
|
+
- Verify the test fails before the fix (RED)
|
|
128
|
+
- Apply the fix, verify it passes (GREEN)
|
|
129
|
+
- These tests are permanent -- they never get deleted
|
|
130
|
+
|
|
131
|
+
**Regression test pattern:**
|
|
132
|
+
```
|
|
133
|
+
1. Reproduce bug as a failing test
|
|
134
|
+
2. Run test -> verify it FAILS (proves test catches the bug)
|
|
135
|
+
3. Apply fix
|
|
136
|
+
4. Run test -> verify it PASSES (proves fix works)
|
|
137
|
+
5. Revert fix temporarily -> verify test FAILS again (proves test is specific)
|
|
138
|
+
6. Re-apply fix -> commit both test and fix together
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Coverage Strategy
|
|
142
|
+
|
|
143
|
+
Target 80%+ overall coverage with this distribution:
|
|
144
|
+
|
|
145
|
+
| Level | Coverage Target | Focus |
|
|
146
|
+
|-------|----------------|-------|
|
|
147
|
+
| Unit | 90%+ of business logic | Functions, utilities, pure logic |
|
|
148
|
+
| Integration | Key interaction paths | API endpoints, DB operations |
|
|
149
|
+
| E2E | Critical user flows | Login, checkout, core features |
|
|
150
|
+
| Regression | Every fixed bug | Bug-specific reproduction |
|
|
151
|
+
|
|
152
|
+
## Good Tests
|
|
153
|
+
|
|
154
|
+
| Quality | Good | Bad |
|
|
155
|
+
|---------|------|-----|
|
|
156
|
+
| **Minimal** | One thing. "and" in name? Split it. | `test('validates email and domain and whitespace')` |
|
|
157
|
+
| **Clear** | Name describes behavior | `test('test1')` |
|
|
158
|
+
| **Shows intent** | Demonstrates desired API | Obscures what code should do |
|
|
159
|
+
| **Independent** | Each test runs alone | Tests depend on run order |
|
|
160
|
+
|
|
161
|
+
## Why Order Matters
|
|
162
|
+
|
|
163
|
+
**"I'll write tests after to verify it works"**
|
|
164
|
+
|
|
165
|
+
Tests written after code pass immediately. Passing immediately proves nothing:
|
|
166
|
+
- Might test wrong thing
|
|
167
|
+
- Might test implementation, not behavior
|
|
168
|
+
- Might miss edge cases you forgot
|
|
169
|
+
- You never saw it catch the bug
|
|
170
|
+
|
|
171
|
+
Test-first forces you to see the test fail, proving it actually tests something.
|
|
172
|
+
|
|
173
|
+
## Common Rationalizations
|
|
174
|
+
|
|
175
|
+
| Excuse | Reality |
|
|
176
|
+
|--------|---------|
|
|
177
|
+
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
|
|
178
|
+
| "I'll test after" | Tests passing immediately prove nothing. |
|
|
179
|
+
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
|
|
180
|
+
| "Already manually tested" | Ad-hoc is not systematic. No record, can't re-run. |
|
|
181
|
+
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is debt. |
|
|
182
|
+
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
|
|
183
|
+
| "TDD will slow me down" | TDD faster than debugging. Pragmatic = test-first. |
|
|
184
|
+
|
|
185
|
+
## Red Flags - STOP and Start Over
|
|
186
|
+
|
|
187
|
+
- Code before test
|
|
188
|
+
- Test after implementation
|
|
189
|
+
- Test passes immediately
|
|
190
|
+
- Can't explain why test failed
|
|
191
|
+
- Tests added "later"
|
|
192
|
+
- Rationalizing "just this once"
|
|
193
|
+
|
|
194
|
+
**All of these mean: Delete code. Start over with TDD.**
|
|
195
|
+
|
|
196
|
+
## Verification Checklist
|
|
197
|
+
|
|
198
|
+
Before marking test suite complete:
|
|
199
|
+
|
|
200
|
+
- [ ] Every new function/method has a test
|
|
201
|
+
- [ ] Watched each test fail before implementing
|
|
202
|
+
- [ ] Each test failed for expected reason
|
|
203
|
+
- [ ] Wrote minimal code to pass each test
|
|
204
|
+
- [ ] All tests pass
|
|
205
|
+
- [ ] Output pristine (no errors, warnings)
|
|
206
|
+
- [ ] Tests use real code (mocks only if unavoidable)
|
|
207
|
+
- [ ] Edge cases and errors covered
|
|
208
|
+
- [ ] Unit tests cover business logic (90%+)
|
|
209
|
+
- [ ] Integration tests cover key interaction paths
|
|
210
|
+
- [ ] E2E tests cover critical user flows
|
|
211
|
+
- [ ] Regression tests cover all fixed bugs
|
|
212
|
+
- [ ] Overall coverage 80%+
|
|
213
|
+
|
|
214
|
+
## When Stuck
|
|
215
|
+
|
|
216
|
+
| Problem | Solution |
|
|
217
|
+
|---------|----------|
|
|
218
|
+
| Don't know how to test | Write wished-for API. Write assertion first. Ask your human partner. |
|
|
219
|
+
| Test too complicated | Design too complicated. Simplify interface. |
|
|
220
|
+
| Must mock everything | Code too coupled. Use dependency injection. |
|
|
221
|
+
| Test setup huge | Extract helpers. Still complex? Simplify design. |
|
|
222
|
+
|
|
223
|
+
## Debugging Integration
|
|
224
|
+
|
|
225
|
+
Bug found? Write failing test reproducing it. Follow TDD cycle. Test proves fix and prevents regression.
|
|
226
|
+
|
|
227
|
+
Never fix bugs without a test.
|
|
228
|
+
|
|
229
|
+
## Final Rule
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
Production code -> test exists and failed first
|
|
233
|
+
Otherwise -> not TDD
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
No exceptions without your human partner's permission.
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
> **HARD GATE**: No completion claims without fresh verification evidence. If you haven't run the verification command in this message, you cannot claim it passes.
|
|
2
|
+
|
|
3
|
+
<!-- SOURCE: skills/verification-before-completion/SKILL.md -->
|
|
4
|
+
|
|
5
|
+
# Verification Before Completion (Test Variant)
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
Claiming work is complete without verification is dishonesty, not efficiency.
|
|
10
|
+
|
|
11
|
+
**Core principle:** Evidence before claims, always.
|
|
12
|
+
|
|
13
|
+
**Violating the letter of this rule is violating the spirit of this rule.**
|
|
14
|
+
|
|
15
|
+
## The Iron Law
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If you haven't run the verification command in this message, you cannot claim it passes.
|
|
22
|
+
|
|
23
|
+
## The Gate Function
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
BEFORE claiming any status or expressing satisfaction:
|
|
27
|
+
|
|
28
|
+
1. IDENTIFY: What command proves this claim?
|
|
29
|
+
2. RUN: Execute the FULL command (fresh, complete)
|
|
30
|
+
3. READ: Full output, check exit code, count failures
|
|
31
|
+
4. VERIFY: Does output confirm the claim?
|
|
32
|
+
- If NO: State actual status with evidence
|
|
33
|
+
- If YES: State claim WITH evidence
|
|
34
|
+
5. ONLY THEN: Make the claim
|
|
35
|
+
|
|
36
|
+
Skip any step = lying, not verifying
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Common Failures
|
|
40
|
+
|
|
41
|
+
| Claim | Requires | Not Sufficient |
|
|
42
|
+
|-------|----------|----------------|
|
|
43
|
+
| Tests pass | Test command output: 0 failures | Previous run, "should pass" |
|
|
44
|
+
| Linter clean | Linter output: 0 errors | Partial check, extrapolation |
|
|
45
|
+
| Build succeeds | Build command: exit 0 | Linter passing, logs look good |
|
|
46
|
+
| Bug fixed | Test original symptom: passes | Code changed, assumed fixed |
|
|
47
|
+
| Regression test works | Red-green cycle verified | Test passes once |
|
|
48
|
+
| Agent completed | VCS diff shows changes | Agent reports "success" |
|
|
49
|
+
| Requirements met | Line-by-line checklist | Tests passing |
|
|
50
|
+
|
|
51
|
+
## Red Flags - STOP
|
|
52
|
+
|
|
53
|
+
- Using "should", "probably", "seems to"
|
|
54
|
+
- Expressing satisfaction before verification ("Great!", "Perfect!", "Done!", etc.)
|
|
55
|
+
- About to commit/push/PR without verification
|
|
56
|
+
- Trusting agent success reports
|
|
57
|
+
- Relying on partial verification
|
|
58
|
+
- Thinking "just this once"
|
|
59
|
+
- Tired and wanting work over
|
|
60
|
+
- **ANY wording implying success without having run verification**
|
|
61
|
+
|
|
62
|
+
## Rationalization Prevention
|
|
63
|
+
|
|
64
|
+
| Excuse | Reality |
|
|
65
|
+
|--------|---------|
|
|
66
|
+
| "Should work now" | RUN the verification |
|
|
67
|
+
| "I'm confident" | Confidence does not equal evidence |
|
|
68
|
+
| "Just this once" | No exceptions |
|
|
69
|
+
| "Linter passed" | Linter is not compiler |
|
|
70
|
+
| "Agent said success" | Verify independently |
|
|
71
|
+
| "I'm tired" | Exhaustion is not an excuse |
|
|
72
|
+
| "Partial check is enough" | Partial proves nothing |
|
|
73
|
+
| "Different words so rule doesn't apply" | Spirit over letter |
|
|
74
|
+
|
|
75
|
+
## Key Patterns
|
|
76
|
+
|
|
77
|
+
**Tests:**
|
|
78
|
+
```
|
|
79
|
+
CORRECT: [Run test command] [See: 34/34 pass] "All tests pass"
|
|
80
|
+
WRONG: "Should pass now" / "Looks correct"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Regression tests (TDD Red-Green):**
|
|
84
|
+
```
|
|
85
|
+
CORRECT: Write -> Run (pass) -> Revert fix -> Run (MUST FAIL) -> Restore -> Run (pass)
|
|
86
|
+
WRONG: "I've written a regression test" (without red-green verification)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Build:**
|
|
90
|
+
```
|
|
91
|
+
CORRECT: [Run build] [See: exit 0] "Build passes"
|
|
92
|
+
WRONG: "Linter passed" (linter doesn't check compilation)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Requirements:**
|
|
96
|
+
```
|
|
97
|
+
CORRECT: Re-read plan -> Create checklist -> Verify each -> Report gaps or completion
|
|
98
|
+
WRONG: "Tests pass, phase complete"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Agent delegation:**
|
|
102
|
+
```
|
|
103
|
+
CORRECT: Agent reports success -> Check VCS diff -> Verify changes -> Report actual state
|
|
104
|
+
WRONG: Trust agent report
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## When To Apply
|
|
108
|
+
|
|
109
|
+
**ALWAYS before:**
|
|
110
|
+
- ANY variation of success/completion claims
|
|
111
|
+
- ANY expression of satisfaction
|
|
112
|
+
- ANY positive statement about work state
|
|
113
|
+
- Committing, PR creation, task completion
|
|
114
|
+
- Moving to next task
|
|
115
|
+
- Delegating to agents
|
|
116
|
+
|
|
117
|
+
**Rule applies to:**
|
|
118
|
+
- Exact phrases
|
|
119
|
+
- Paraphrases and synonyms
|
|
120
|
+
- Implications of success
|
|
121
|
+
- ANY communication suggesting completion/correctness
|
|
122
|
+
|
|
123
|
+
## The Bottom Line
|
|
124
|
+
|
|
125
|
+
**No shortcuts for verification.**
|
|
126
|
+
|
|
127
|
+
Run the command. Read the output. THEN claim the result.
|
|
128
|
+
|
|
129
|
+
This is non-negotiable.
|