cc-devflow 1.0.3 → 2.4.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/CLAUDE.md +123 -4
- package/.claude/agents/code-quality-reviewer.md +205 -0
- package/.claude/agents/spec-reviewer.md +221 -0
- package/.claude/commands/cancel-ralph.md +59 -0
- package/.claude/commands/flow-dev.md +202 -21
- package/.claude/commands/flow-epic.md +33 -0
- package/.claude/commands/flow-fix.md +138 -20
- package/.claude/commands/flow-init.md +104 -15
- package/.claude/commands/flow-new.md +84 -35
- package/.claude/commands/flow-prd.md +16 -3
- package/.claude/commands/flow-release.md +33 -0
- package/.claude/commands/flow-review.md +257 -0
- package/.claude/docs/templates/ATTEMPT_TEMPLATE.md +156 -0
- package/.claude/docs/templates/BRAINSTORM_TEMPLATE.md +148 -0
- package/.claude/docs/templates/ERROR_LOG_TEMPLATE.md +80 -0
- package/.claude/docs/templates/INIT_FLOW_TEMPLATE.md +22 -14
- package/.claude/guides/workflow-guides/flow-orchestrator.md +2 -2
- package/.claude/hooks/hooks.json +15 -0
- package/.claude/hooks/ralph-stop-hook.sh +190 -0
- package/.claude/rules/devflow-conventions.md +3 -1
- package/.claude/rules/project-constitution.md +256 -2
- package/.claude/rules/rationalization-library.md +282 -0
- package/.claude/scripts/create-requirement.sh +19 -6
- package/.claude/scripts/setup-ralph-loop.sh +155 -0
- package/.claude/scripts/verify-gate.sh +269 -0
- package/.claude/skills/cc-devflow-orchestrator/SKILL.md +70 -20
- package/.claude/skills/file-header-guardian/SKILL.md +56 -0
- package/.claude/skills/flow-attention-refresh/SKILL.md +170 -0
- package/.claude/skills/flow-brainstorming/SKILL.md +161 -0
- package/.claude/skills/flow-debugging/SKILL.md +221 -0
- package/.claude/skills/flow-finishing-branch/SKILL.md +189 -0
- package/.claude/skills/flow-receiving-review/SKILL.md +153 -0
- package/.claude/skills/flow-tdd/SKILL.md +218 -0
- package/.claude/skills/fractal-docs-generator/SKILL.md +45 -0
- package/.claude/skills/skill-rules.json +75 -0
- package/.claude/skills/verification-before-completion/SKILL.md +158 -0
- package/README.md +104 -19
- package/README.zh-CN.md +79 -1
- package/docs/commands/flow-init.md +3 -1
- package/docs/commands/flow-init.zh-CN.md +3 -1
- package/package.json +1 -1
- package/.claude/tsc-cache/777aa1de-497e-411b-a40f-13b74efcec58/affected-repos.txt +0 -1
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: flow-tdd
|
|
3
|
+
description: "Enforces TDD Iron Law in flow-dev. NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Flow TDD - Test-Driven Development Enforcement
|
|
7
|
+
|
|
8
|
+
## The Iron Law
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
NO PRODUCTION CODE WITHOUT A FAILING TEST FIRST
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This is NON-NEGOTIABLE. No exceptions. No "just this once."
|
|
15
|
+
|
|
16
|
+
## The TDD Cycle
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
RED: Write a failing test
|
|
20
|
+
→ Run it
|
|
21
|
+
→ Confirm it FAILS
|
|
22
|
+
→ If it passes immediately → ERROR (invalid test)
|
|
23
|
+
|
|
24
|
+
GREEN: Write minimal code to pass
|
|
25
|
+
→ Only enough to make the test pass
|
|
26
|
+
→ No extra features
|
|
27
|
+
→ No "while I'm here" additions
|
|
28
|
+
|
|
29
|
+
REFACTOR: Clean up
|
|
30
|
+
→ Keep tests green
|
|
31
|
+
→ Improve structure
|
|
32
|
+
→ Remove duplication
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Enforcement in flow-dev
|
|
36
|
+
|
|
37
|
+
### Phase 2: Tests First
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
TASKS.md Phase 2 (Tests):
|
|
41
|
+
- Write contract tests
|
|
42
|
+
- Write integration tests
|
|
43
|
+
- Write unit tests
|
|
44
|
+
- Run all tests → ALL MUST FAIL
|
|
45
|
+
|
|
46
|
+
⚠️ TEST VERIFICATION CHECKPOINT:
|
|
47
|
+
→ Run: npm test (or equivalent)
|
|
48
|
+
→ Expected: All new tests FAIL
|
|
49
|
+
→ If any test passes immediately → STOP
|
|
50
|
+
→ Passing test = invalid test or code already exists
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Phase 3: Implementation
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
TASKS.md Phase 3 (Implementation):
|
|
57
|
+
- Implement to make tests pass
|
|
58
|
+
- One test at a time
|
|
59
|
+
- Minimal code only
|
|
60
|
+
|
|
61
|
+
After each implementation:
|
|
62
|
+
→ Run tests
|
|
63
|
+
→ Verify previously failing test now passes
|
|
64
|
+
→ Verify no regressions
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## What If Code Already Exists?
|
|
68
|
+
|
|
69
|
+
If you've written code before tests:
|
|
70
|
+
|
|
71
|
+
```yaml
|
|
72
|
+
Option A: DELETE AND RESTART (Recommended)
|
|
73
|
+
1. Delete the implementation code
|
|
74
|
+
2. Keep only the interface/contract
|
|
75
|
+
3. Write failing tests
|
|
76
|
+
4. Re-implement with TDD
|
|
77
|
+
|
|
78
|
+
Option B: WRITE TESTS THAT FAIL FIRST
|
|
79
|
+
1. Comment out the implementation
|
|
80
|
+
2. Write tests
|
|
81
|
+
3. Run tests → verify they fail
|
|
82
|
+
4. Uncomment implementation
|
|
83
|
+
5. Run tests → verify they pass
|
|
84
|
+
|
|
85
|
+
NEVER: Keep code and write passing tests
|
|
86
|
+
→ This is "testing after" disguised as TDD
|
|
87
|
+
→ Tests that pass immediately prove nothing
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Rationalization Prevention
|
|
91
|
+
|
|
92
|
+
| Excuse | Reality |
|
|
93
|
+
|--------|---------|
|
|
94
|
+
| "Too simple to test" | Simple code breaks. Test takes 30 seconds. |
|
|
95
|
+
| "I'll test after" | Tests passing immediately prove nothing. |
|
|
96
|
+
| "Tests after achieve same goals" | Tests-after = "what does this do?" Tests-first = "what should this do?" |
|
|
97
|
+
| "Already manually tested" | Ad-hoc ≠ systematic. No record, can't re-run. |
|
|
98
|
+
| "Deleting X hours is wasteful" | Sunk cost fallacy. Keeping unverified code is technical debt. |
|
|
99
|
+
| "Keep as reference, write tests first" | You'll adapt it. That's testing after. Delete means delete. |
|
|
100
|
+
| "Need to explore first" | Fine. Throw away exploration, start with TDD. |
|
|
101
|
+
| "Test hard = design unclear" | Listen to test. Hard to test = hard to use. |
|
|
102
|
+
| "TDD slows me down" | TDD faster than debugging. Pragmatic = test-first. |
|
|
103
|
+
| "This is different because..." | No. This is rationalization. Follow the law. |
|
|
104
|
+
| "Spirit not letter" | Violating letter IS violating spirit. No loopholes. |
|
|
105
|
+
| "I'm being pragmatic, not dogmatic" | TDD IS pragmatic. Shortcuts = debugging in production = slower. |
|
|
106
|
+
| "Just this once" | No exceptions. Rules exist for this exact moment. |
|
|
107
|
+
|
|
108
|
+
## Red Flags - STOP
|
|
109
|
+
|
|
110
|
+
If you find yourself:
|
|
111
|
+
- Writing code before tests
|
|
112
|
+
- Tests passing immediately
|
|
113
|
+
- Saying "just this once"
|
|
114
|
+
- Keeping "exploration" code
|
|
115
|
+
- Writing tests that describe existing code
|
|
116
|
+
|
|
117
|
+
**STOP. Delete the code. Write the test first.**
|
|
118
|
+
|
|
119
|
+
## Test Quality Requirements
|
|
120
|
+
|
|
121
|
+
```yaml
|
|
122
|
+
Good Tests:
|
|
123
|
+
✅ Test behavior, not implementation
|
|
124
|
+
✅ Use realistic data
|
|
125
|
+
✅ Cover edge cases
|
|
126
|
+
✅ Independent (no shared state)
|
|
127
|
+
✅ Fast (< 1 second each)
|
|
128
|
+
✅ Descriptive names
|
|
129
|
+
|
|
130
|
+
Bad Tests (Cheater Tests):
|
|
131
|
+
❌ assert True
|
|
132
|
+
❌ assert result is not None
|
|
133
|
+
❌ Mock everything, test nothing
|
|
134
|
+
❌ Test implementation details
|
|
135
|
+
❌ Depend on execution order
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Error Recording Protocol
|
|
139
|
+
|
|
140
|
+
当测试失败或构建错误发生时,必须立即记录到 ERROR_LOG.md:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
Error Recording Workflow:
|
|
144
|
+
1. Capture Error Context:
|
|
145
|
+
- Phase (flow-dev / T###)
|
|
146
|
+
- Error Type (Test Failure | Build Error | Runtime Error)
|
|
147
|
+
- Full error message
|
|
148
|
+
- Timestamp
|
|
149
|
+
|
|
150
|
+
2. Create ERROR_LOG.md if not exists:
|
|
151
|
+
→ Use .claude/docs/templates/ERROR_LOG_TEMPLATE.md
|
|
152
|
+
→ Location: devflow/requirements/${REQ_ID}/ERROR_LOG.md
|
|
153
|
+
|
|
154
|
+
3. Append Error Record:
|
|
155
|
+
## [TIMESTAMP] E###: TITLE
|
|
156
|
+
**Phase**: flow-dev / T###
|
|
157
|
+
**Error Type**: Test Failure
|
|
158
|
+
**Error Message**:
|
|
159
|
+
```
|
|
160
|
+
[完整错误信息]
|
|
161
|
+
```
|
|
162
|
+
**Root Cause**: [分析后填写]
|
|
163
|
+
**Resolution**: [解决后填写]
|
|
164
|
+
**Prevention**: [可选]
|
|
165
|
+
|
|
166
|
+
4. Debug with Error Context:
|
|
167
|
+
→ Read ERROR_LOG.md for similar past errors
|
|
168
|
+
→ Apply attention refresh (Protocol 4)
|
|
169
|
+
→ Fix the root cause, not symptoms
|
|
170
|
+
|
|
171
|
+
5. Update Record After Fix:
|
|
172
|
+
→ Fill Root Cause
|
|
173
|
+
→ Fill Resolution
|
|
174
|
+
→ Add Prevention if applicable
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Error Recording Example
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
## [2026-01-08T14:30:00] E001: Test Failure - User Login Validation
|
|
181
|
+
|
|
182
|
+
**Phase**: flow-dev / T005
|
|
183
|
+
**Error Type**: Test Failure
|
|
184
|
+
**Error Message**:
|
|
185
|
+
\`\`\`
|
|
186
|
+
FAIL src/auth/login.test.ts
|
|
187
|
+
× should reject invalid email format
|
|
188
|
+
Expected: false
|
|
189
|
+
Received: true
|
|
190
|
+
\`\`\`
|
|
191
|
+
|
|
192
|
+
**Root Cause**: 正则表达式 `/^.+@.+$/` 过于宽松,接受了 `user@` 这样的无效邮箱
|
|
193
|
+
**Resolution**: 更新正则为 `/^[^\s@]+@[^\s@]+\.[^\s@]+$/` 要求至少有域名和顶级域
|
|
194
|
+
**Prevention**: 扩充测试用例,添加边界情况(无域名、无顶级域、特殊字符等)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Integration with Constitution
|
|
198
|
+
|
|
199
|
+
- **Article I**: Complete implementation includes tests
|
|
200
|
+
- **Article VI**: TDD Mandate (this skill)
|
|
201
|
+
- **Article IX**: Integration-first testing
|
|
202
|
+
|
|
203
|
+
## Integration with Attention Refresh
|
|
204
|
+
|
|
205
|
+
- **Protocol 4**: Error Recovery 时读取 ERROR_LOG.md
|
|
206
|
+
- 避免重复犯相同错误
|
|
207
|
+
- 从历史错误中学习
|
|
208
|
+
|
|
209
|
+
## Cross-Reference
|
|
210
|
+
|
|
211
|
+
- [flow-attention-refresh](../flow-attention-refresh/SKILL.md) - Protocol 4
|
|
212
|
+
- [ERROR_LOG_TEMPLATE.md](../../docs/templates/ERROR_LOG_TEMPLATE.md)
|
|
213
|
+
- [rationalization-library.md](../../rules/rationalization-library.md#article-vi-test-first-development---rationalization-table)
|
|
214
|
+
- [project-constitution.md](../../rules/project-constitution.md#article-vi-test-first-development-测试优先开发)
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
**[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fractal-docs-generator
|
|
3
|
+
description: 目录级 CLAUDE.md 生成。触发:mkdir、create directory、目录结构变更。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 分形文档生成器
|
|
7
|
+
|
|
8
|
+
触发:创建/移动/重命名目录,目录内文件变化。
|
|
9
|
+
|
|
10
|
+
## 模板
|
|
11
|
+
|
|
12
|
+
```markdown
|
|
13
|
+
<!-- 若此目录变更,立即更新本文件 -->
|
|
14
|
+
# {目录名} - {一句话定位}
|
|
15
|
+
|
|
16
|
+
| 文件 | 地位 | 职责 |
|
|
17
|
+
|------|------|------|
|
|
18
|
+
| foo.ts | 入口 | 对外唯一接口 |
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 地位
|
|
22
|
+
|
|
23
|
+
| 地位 | 典型文件 |
|
|
24
|
+
|------|----------|
|
|
25
|
+
| 入口 | index.ts, main.ts |
|
|
26
|
+
| 核心 | service.ts, engine.ts |
|
|
27
|
+
| 辅助 | utils.ts, helpers.ts |
|
|
28
|
+
| 类型 | types.ts |
|
|
29
|
+
| 配置 | config.ts |
|
|
30
|
+
| 测试 | *.test.ts |
|
|
31
|
+
|
|
32
|
+
## 示例
|
|
33
|
+
|
|
34
|
+
```markdown
|
|
35
|
+
<!-- 若此目录变更,立即更新本文件 -->
|
|
36
|
+
# auth - 认证授权
|
|
37
|
+
|
|
38
|
+
| 文件 | 地位 | 职责 |
|
|
39
|
+
|------|------|------|
|
|
40
|
+
| index.ts | 入口 | 导出 AuthService |
|
|
41
|
+
| auth.service.ts | 核心 | 登录、令牌刷新 |
|
|
42
|
+
| jwt.helper.ts | 辅助 | JWT 签发验证 |
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
协作:本 skill 管目录,file-header-guardian 管文件。
|
|
@@ -129,6 +129,81 @@
|
|
|
129
129
|
"envOverride": "SKIP_CONSTITUTION_CHECK"
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
|
+
"fractal-docs-generator": {
|
|
133
|
+
"type": "domain",
|
|
134
|
+
"enforcement": "suggest",
|
|
135
|
+
"priority": "high",
|
|
136
|
+
"description": "分形文档生成器。创建目录时自动生成目录级 CLAUDE.md,实现 GEB 式递归架构文档",
|
|
137
|
+
"promptTriggers": {
|
|
138
|
+
"keywords": [
|
|
139
|
+
"创建目录",
|
|
140
|
+
"新建文件夹",
|
|
141
|
+
"mkdir",
|
|
142
|
+
"add folder",
|
|
143
|
+
"create directory",
|
|
144
|
+
"目录结构",
|
|
145
|
+
"CLAUDE.md",
|
|
146
|
+
"架构文档",
|
|
147
|
+
"分形文档"
|
|
148
|
+
],
|
|
149
|
+
"intentPatterns": [
|
|
150
|
+
"(创建|新建|添加).*?(目录|文件夹|folder|directory)",
|
|
151
|
+
"(mkdir|create|add).*?(folder|directory|dir)",
|
|
152
|
+
"目录.*?(结构|变更|调整)",
|
|
153
|
+
"(更新|同步).*?CLAUDE\\.md"
|
|
154
|
+
]
|
|
155
|
+
},
|
|
156
|
+
"fileTriggers": {
|
|
157
|
+
"pathPatterns": [
|
|
158
|
+
"**/CLAUDE.md"
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"file-header-guardian": {
|
|
163
|
+
"type": "domain",
|
|
164
|
+
"enforcement": "suggest",
|
|
165
|
+
"priority": "high",
|
|
166
|
+
"description": "文件头注释守护者。创建/修改代码文件时确保 @input/@output/@pos 三行契约注释存在",
|
|
167
|
+
"promptTriggers": {
|
|
168
|
+
"keywords": [
|
|
169
|
+
"创建文件",
|
|
170
|
+
"新建文件",
|
|
171
|
+
"write file",
|
|
172
|
+
"create file",
|
|
173
|
+
"add file",
|
|
174
|
+
"文件头注释",
|
|
175
|
+
"头注释",
|
|
176
|
+
"@input",
|
|
177
|
+
"@output",
|
|
178
|
+
"@pos"
|
|
179
|
+
],
|
|
180
|
+
"intentPatterns": [
|
|
181
|
+
"(创建|新建|添加|编写).*?(文件|模块|组件)",
|
|
182
|
+
"(create|write|add).*?(file|module|component)",
|
|
183
|
+
"(检查|更新|添加).*?(头注释|header comment)",
|
|
184
|
+
"文件.*?(注释|documentation)"
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"fileTriggers": {
|
|
188
|
+
"pathPatterns": [
|
|
189
|
+
"**/*.ts",
|
|
190
|
+
"**/*.tsx",
|
|
191
|
+
"**/*.js",
|
|
192
|
+
"**/*.jsx",
|
|
193
|
+
"**/*.py",
|
|
194
|
+
"**/*.go",
|
|
195
|
+
"**/*.rs",
|
|
196
|
+
"**/*.sh"
|
|
197
|
+
],
|
|
198
|
+
"pathExclusions": [
|
|
199
|
+
"**/*.test.ts",
|
|
200
|
+
"**/*.spec.ts",
|
|
201
|
+
"**/*.d.ts",
|
|
202
|
+
"**/node_modules/**",
|
|
203
|
+
"**/.claude/**"
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
},
|
|
132
207
|
"devflow-file-standards": {
|
|
133
208
|
"type": "domain",
|
|
134
209
|
"enforcement": "suggest",
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verification-before-completion
|
|
3
|
+
description: "Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verification Before Completion
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This skill enforces a critical discipline: **never claim completion without fresh verification evidence**.
|
|
11
|
+
|
|
12
|
+
The most common failure mode for AI agents is claiming success without actually verifying. This skill prevents that by requiring explicit verification steps before any completion claim.
|
|
13
|
+
|
|
14
|
+
## The Iron Law
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## The Process
|
|
21
|
+
|
|
22
|
+
### Before ANY Completion Claim
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
1. IDENTIFY: What command proves this claim?
|
|
26
|
+
→ "Tests pass" requires: npm test / pytest / go test
|
|
27
|
+
→ "Build succeeds" requires: npm run build / make
|
|
28
|
+
→ "Lint clean" requires: npm run lint / eslint
|
|
29
|
+
→ "Type check passes" requires: tsc --noEmit / mypy
|
|
30
|
+
|
|
31
|
+
2. RUN: Execute the FULL command (fresh, complete)
|
|
32
|
+
→ Not cached results
|
|
33
|
+
→ Not partial output
|
|
34
|
+
→ Not "I ran it earlier"
|
|
35
|
+
|
|
36
|
+
3. READ: Full output, check exit code, count failures
|
|
37
|
+
→ Exit code 0 = success
|
|
38
|
+
→ Exit code non-zero = failure
|
|
39
|
+
→ Count actual pass/fail numbers
|
|
40
|
+
|
|
41
|
+
4. VERIFY: Does output confirm the claim?
|
|
42
|
+
→ "All tests pass" = 0 failures in output
|
|
43
|
+
→ "Build succeeds" = no errors, artifacts created
|
|
44
|
+
→ "No lint errors" = 0 problems found
|
|
45
|
+
|
|
46
|
+
5. ONLY THEN: Make the claim with evidence
|
|
47
|
+
→ Quote the relevant output
|
|
48
|
+
→ Include exit code
|
|
49
|
+
→ Show pass/fail counts
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Verification Commands by Context
|
|
53
|
+
|
|
54
|
+
### Flow Exit Gates
|
|
55
|
+
|
|
56
|
+
| Flow | Verification Command | Success Criteria |
|
|
57
|
+
|------|---------------------|------------------|
|
|
58
|
+
| /flow-prd | `validate-constitution --type prd` | Exit 0, no violations |
|
|
59
|
+
| /flow-epic | `validate-constitution --type epic` | Exit 0, no violations |
|
|
60
|
+
| /flow-dev | `npm test && npm run build` | All tests pass, build succeeds |
|
|
61
|
+
| /flow-qa | `npm test && npm run lint` | All pass, no blockers |
|
|
62
|
+
| /flow-release | `gh pr checks` | All checks pass |
|
|
63
|
+
|
|
64
|
+
### Common Development Tasks
|
|
65
|
+
|
|
66
|
+
| Claim | Required Verification |
|
|
67
|
+
|-------|----------------------|
|
|
68
|
+
| "Tests pass" | Run full test suite, show output |
|
|
69
|
+
| "Build succeeds" | Run build command, show output |
|
|
70
|
+
| "Lint clean" | Run linter, show 0 errors |
|
|
71
|
+
| "Type check passes" | Run type checker, show output |
|
|
72
|
+
| "No regressions" | Run affected tests, compare before/after |
|
|
73
|
+
| "Bug fixed" | Show failing test → fix → passing test |
|
|
74
|
+
|
|
75
|
+
## Rationalization Prevention
|
|
76
|
+
|
|
77
|
+
| Excuse | Reality |
|
|
78
|
+
|--------|---------|
|
|
79
|
+
| "I just ran it" | Run it again. Fresh evidence required. |
|
|
80
|
+
| "It was passing before" | Before ≠ now. Verify current state. |
|
|
81
|
+
| "The change is trivial" | Trivial changes break things. Verify. |
|
|
82
|
+
| "I'm confident it works" | Confidence ≠ evidence. Run the command. |
|
|
83
|
+
| "Tests are slow" | Slow tests > broken production. Run them. |
|
|
84
|
+
| "I'll verify after commit" | Verify BEFORE commit. Always. |
|
|
85
|
+
| "The CI will catch it" | You catch it first. Don't waste CI cycles. |
|
|
86
|
+
| "It's just documentation" | Doc changes can break builds. Verify. |
|
|
87
|
+
|
|
88
|
+
## Red Flags - STOP
|
|
89
|
+
|
|
90
|
+
If you find yourself:
|
|
91
|
+
- Saying "should work" without running verification
|
|
92
|
+
- Claiming "tests pass" without showing output
|
|
93
|
+
- Saying "I believe" instead of "I verified"
|
|
94
|
+
- Skipping verification "just this once"
|
|
95
|
+
- Trusting cached or stale results
|
|
96
|
+
|
|
97
|
+
**STOP. Run the verification command. Show the evidence.**
|
|
98
|
+
|
|
99
|
+
## Evidence Format
|
|
100
|
+
|
|
101
|
+
When claiming completion, always include:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
## Verification Evidence
|
|
105
|
+
|
|
106
|
+
**Command**: `npm test`
|
|
107
|
+
**Exit Code**: 0
|
|
108
|
+
**Output Summary**:
|
|
109
|
+
- Tests: 42 passed, 0 failed
|
|
110
|
+
- Coverage: 85%
|
|
111
|
+
- Duration: 12.3s
|
|
112
|
+
|
|
113
|
+
**Conclusion**: All tests pass. Ready for commit.
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Integration with CC-DevFlow
|
|
117
|
+
|
|
118
|
+
### Every Flow Exit Gate
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
Exit Gate Verification:
|
|
122
|
+
1. Identify required verification commands
|
|
123
|
+
2. Run each command fresh
|
|
124
|
+
3. Capture full output
|
|
125
|
+
4. Verify success criteria met
|
|
126
|
+
5. Document evidence in EXECUTION_LOG.md
|
|
127
|
+
6. Only then proceed to next stage
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Task Completion
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
Task Completion Verification:
|
|
134
|
+
1. Run task-specific tests
|
|
135
|
+
2. Verify acceptance criteria met
|
|
136
|
+
3. Show evidence in task completion message
|
|
137
|
+
4. Mark task complete only with evidence
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## The Discipline
|
|
141
|
+
|
|
142
|
+
This skill is about **intellectual honesty**. It's easy to believe something works. It's harder to prove it.
|
|
143
|
+
|
|
144
|
+
The discipline is:
|
|
145
|
+
1. **Assume nothing** - Don't trust memory or intuition
|
|
146
|
+
2. **Verify everything** - Run the actual commands
|
|
147
|
+
3. **Show evidence** - Quote output, not beliefs
|
|
148
|
+
4. **Fresh results only** - No stale or cached data
|
|
149
|
+
|
|
150
|
+
## Cross-Reference
|
|
151
|
+
|
|
152
|
+
- Constitution Article I: Quality First (complete implementation)
|
|
153
|
+
- Constitution Article VI: Test-First Development (TDD)
|
|
154
|
+
- rationalization-library.md: Cross-Article rationalizations
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
**[PROTOCOL]**: 变更时更新此头部,然后检查 CLAUDE.md
|
package/README.md
CHANGED
|
@@ -29,6 +29,7 @@ Complete automated workflow from PRD generation to code delivery with `/flow-new
|
|
|
29
29
|
- 🔍 **Consistency Verification** - Enterprise-grade consistency checking with intelligent conflict detection
|
|
30
30
|
- 🧪 **TDD Enforced** - Strict Test-Driven Development with TEST VERIFICATION CHECKPOINT
|
|
31
31
|
- 📜 **Constitution** - 10 Articles governing quality, security, and architecture
|
|
32
|
+
- 🔄 **Autonomous Development** - Ralph × Manus Integration for memory-enhanced continuous iteration
|
|
32
33
|
- 🔌 **Multi-Platform Support** - Compile workflows for Codex, Cursor, Qwen, Antigravity via `npm run adapt`
|
|
33
34
|
|
|
34
35
|
---
|
|
@@ -239,6 +240,8 @@ bash .claude/tests/constitution/run_all_constitution_tests.sh
|
|
|
239
240
|
| `/flow-init` | 📦 Initialize Requirement | `/flow-init "REQ-123\|Feature"` | [→](docs/commands/flow-init.md) |
|
|
240
241
|
| `/flow-clarify` | 🔎 Clarify Ambiguities | `/flow-clarify "REQ-123"` | [→](.claude/commands/flow-clarify.md) |
|
|
241
242
|
| `/flow-checklist` | ✅ Requirement Quality Check | `/flow-checklist --type ux` | [→](.claude/commands/flow-checklist.md) |
|
|
243
|
+
| `/flow-review` | �� Two-Stage Code Review | `/flow-review "REQ-123"` | [→](.claude/commands/flow-review.md) |
|
|
244
|
+
| `/flow-fix` | 🐛 Systematic Bug Fix | `/flow-fix "BUG-123\|Description"` | [→](.claude/commands/flow-fix.md) |
|
|
242
245
|
| `/flow-verify` | 🔍 Verify Consistency | `/flow-verify "REQ-123"` | [→](docs/commands/flow-verify.md) |
|
|
243
246
|
| `/flow-qa` | 🧪 Quality Assurance | `/flow-qa "REQ-123"` | [→](docs/commands/flow-qa.md) |
|
|
244
247
|
| `/flow-release` | 🚢 Create Release | `/flow-release "REQ-123"` | [→](docs/commands/flow-release.md) |
|
|
@@ -275,42 +278,44 @@ The following Mermaid diagram illustrates the complete cc-devflow workflow, incl
|
|
|
275
278
|
```mermaid
|
|
276
279
|
graph TB
|
|
277
280
|
Start([Start Project]) --> ProjectLevel{Project-Level Setup}
|
|
278
|
-
|
|
281
|
+
|
|
279
282
|
ProjectLevel --> CoreRoadmap["/core-roadmap<br/>ROADMAP.md & BACKLOG.md"]
|
|
280
283
|
ProjectLevel --> CoreArch["/core-architecture<br/>ARCHITECTURE.md"]
|
|
281
284
|
ProjectLevel --> CoreGuidelines["/core-guidelines<br/>frontend/backend guidelines"]
|
|
282
285
|
ProjectLevel --> CoreStyle["/core-style<br/>STYLE.md"]
|
|
283
|
-
|
|
286
|
+
|
|
284
287
|
CoreRoadmap --> ReqLevel
|
|
285
288
|
CoreArch --> ReqLevel
|
|
286
289
|
CoreGuidelines --> ReqLevel
|
|
287
290
|
CoreStyle --> ReqLevel
|
|
288
|
-
|
|
289
|
-
ReqLevel([Requirement-Level Development]) --> FlowInit["/flow-init<br/>research.md &
|
|
290
|
-
|
|
291
|
+
|
|
292
|
+
ReqLevel([Requirement-Level Development]) --> FlowInit["/flow-init<br/>research.md & BRAINSTORM.md"]
|
|
293
|
+
|
|
291
294
|
FlowInit --> FlowClarify["/flow-clarify<br/>clarifications/*.md<br/>Optional"]
|
|
292
|
-
FlowClarify --> FlowPRD["/flow-prd<br/>PRD.md"]
|
|
295
|
+
FlowClarify --> FlowPRD["/flow-prd<br/>PRD.md<br/>BRAINSTORM alignment"]
|
|
293
296
|
FlowInit -.->|Skip clarify| FlowPRD
|
|
294
297
|
FlowPRD --> FlowChecklist["/flow-checklist<br/>checklists/*.md<br/>80% Gate"]
|
|
295
298
|
FlowPRD --> FlowTech["/flow-tech<br/>TECH_DESIGN.md & data-model"]
|
|
296
299
|
FlowPRD --> FlowUI["/flow-ui<br/>UI_PROTOTYPE.html<br/>Optional"]
|
|
297
300
|
|
|
298
301
|
FlowChecklist --> FlowEpic
|
|
299
|
-
FlowTech --> FlowEpic["/flow-epic<br/>EPIC.md & TASKS.md"]
|
|
302
|
+
FlowTech --> FlowEpic["/flow-epic<br/>EPIC.md & TASKS.md<br/>bite-sized tasks"]
|
|
300
303
|
FlowUI --> FlowEpic
|
|
301
|
-
|
|
302
|
-
FlowEpic --> FlowDev["/flow-dev<br/>TASKS.md execution<br/>TDD
|
|
303
|
-
|
|
304
|
-
FlowDev -->
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
304
|
+
|
|
305
|
+
FlowEpic --> FlowDev["/flow-dev<br/>TASKS.md execution<br/>TDD Checkpoint"]
|
|
306
|
+
|
|
307
|
+
FlowDev --> FlowReview["/flow-review<br/>Two-Stage Review<br/>Spec → Quality"]
|
|
308
|
+
|
|
309
|
+
FlowReview --> FlowQA["/flow-qa<br/>QA reports & Security"]
|
|
310
|
+
|
|
311
|
+
FlowQA --> FlowRelease["/flow-release<br/>PR creation<br/>Branch decision"]
|
|
312
|
+
|
|
308
313
|
FlowRelease --> FlowVerify["/flow-verify<br/>Consistency check"]
|
|
309
|
-
|
|
314
|
+
|
|
310
315
|
FlowVerify --> End([Release Complete])
|
|
311
|
-
|
|
316
|
+
|
|
312
317
|
FlowVerify -.->|Can be called at any stage| ReqLevel
|
|
313
|
-
|
|
318
|
+
|
|
314
319
|
style ProjectLevel fill:#e1f5ff
|
|
315
320
|
style ReqLevel fill:#fff4e1
|
|
316
321
|
style FlowInit fill:#e8f5e9
|
|
@@ -321,6 +326,7 @@ graph TB
|
|
|
321
326
|
style FlowUI fill:#fff9c4
|
|
322
327
|
style FlowEpic fill:#e8f5e9
|
|
323
328
|
style FlowDev fill:#f3e5f5
|
|
329
|
+
style FlowReview fill:#e1bee7
|
|
324
330
|
style FlowQA fill:#fce4ec
|
|
325
331
|
style FlowRelease fill:#e0f2f1
|
|
326
332
|
style FlowVerify fill:#e3f2fd
|
|
@@ -329,10 +335,12 @@ graph TB
|
|
|
329
335
|
**Workflow Notes**:
|
|
330
336
|
- **Project-Level Commands** (light blue): Execute once at project initialization, establish global standards (SSOT)
|
|
331
337
|
- **Requirement-Level Commands** (light orange): Execute once per requirement (REQ-XXX)
|
|
338
|
+
- **Brainstorming** (v2.3.0): `/flow-init` now generates `BRAINSTORM.md` as requirement "North Star"
|
|
339
|
+
- **Two-Stage Review** (v2.3.0): `/flow-review` validates Spec Compliance before Code Quality
|
|
332
340
|
- **Optional Steps** (yellow): `/flow-clarify` and `/flow-ui` are optional; clarify can be skipped if requirements are clear
|
|
333
341
|
- **Quality Gate** (orange): `/flow-checklist` validates requirement quality with 80% completion threshold before `/flow-epic`
|
|
342
|
+
- **TDD Checkpoint** (v2.3.0): `/flow-dev` includes mandatory TDD checkpoint (tests must FAIL first)
|
|
334
343
|
- **Quality Gates**: Each stage has entry/exit gates ensuring document quality and Constitution compliance
|
|
335
|
-
- **TDD Enforcement**: `/flow-dev` strictly enforces Test-Driven Development order
|
|
336
344
|
- **Consistency Check**: `/flow-verify` can be called at any stage to ensure document consistency
|
|
337
345
|
|
|
338
346
|
---
|
|
@@ -476,7 +484,84 @@ bash .claude/tests/run-all-tests.sh --scripts
|
|
|
476
484
|
|
|
477
485
|
## 📝 Version History
|
|
478
486
|
|
|
479
|
-
### v2.
|
|
487
|
+
### v2.3.0 (2026-01-08) - Latest Release
|
|
488
|
+
|
|
489
|
+
**🛡️ Discipline System: Iron Law + Rationalization Defense + Pressure Testing**
|
|
490
|
+
|
|
491
|
+
v2.3.0 upgrades the Constitution from a "document" to an "executable discipline system", borrowing best practices from superpowers project:
|
|
492
|
+
|
|
493
|
+
- **Iron Law + Rationalization Tables** - Pre-block AI Agent rationalization attempts
|
|
494
|
+
- Each of 10 Constitution Articles now has an Iron Law (absolute prohibition)
|
|
495
|
+
- Rationalization Tables with `| Excuse | Reality |` format
|
|
496
|
+
- Red Flags for AI self-check triggers
|
|
497
|
+
- Centralized `rationalization-library.md` for all rationalizations
|
|
498
|
+
|
|
499
|
+
- **Two-Stage Code Review** - `/flow-review` command (NEW)
|
|
500
|
+
- Stage 1: Spec Compliance (don't trust implementer reports, read code directly)
|
|
501
|
+
- Stage 2: Code Quality (only runs after Stage 1 passes)
|
|
502
|
+
- `spec-reviewer.md` and `code-quality-reviewer.md` agents
|
|
503
|
+
|
|
504
|
+
- **Verification Before Completion** - Evidence before assertions
|
|
505
|
+
- `verification-before-completion` skill
|
|
506
|
+
- `verify-gate.sh` script for all flow exit gates
|
|
507
|
+
- No completion claims without fresh verification evidence
|
|
508
|
+
|
|
509
|
+
- **Systematic Debugging** - `/flow-fix` enhanced with 4-phase debugging
|
|
510
|
+
- Phase 1: Root Cause Investigation (NO FIXES YET)
|
|
511
|
+
- Phase 2: Pattern Analysis
|
|
512
|
+
- Phase 3: Hypothesis and Testing
|
|
513
|
+
- Phase 4: TDD Implementation
|
|
514
|
+
- `flow-debugging` and `flow-tdd` skills
|
|
515
|
+
|
|
516
|
+
- **Brainstorming Integration** - `/flow-init` now includes brainstorming
|
|
517
|
+
- `BRAINSTORM.md` as requirement "North Star"
|
|
518
|
+
- `/flow-prd` requires BRAINSTORM alignment check
|
|
519
|
+
- `flow-brainstorming` skill
|
|
520
|
+
|
|
521
|
+
- **Pressure Testing Framework** - TDD for Skills
|
|
522
|
+
- `tests/pressure-scenarios/` with 4 scenarios
|
|
523
|
+
- Tests AI behavior under time/sunk cost/authority/exhaustion pressure
|
|
524
|
+
- `run-pressure-tests.sh` runner
|
|
525
|
+
|
|
526
|
+
- **Skills Fusion** - Superpowers skills migrated to local
|
|
527
|
+
- `flow-tdd`, `flow-debugging`, `flow-receiving-review`, `flow-finishing-branch`
|
|
528
|
+
- All `superpowers:xxx` references replaced with local skills
|
|
529
|
+
|
|
530
|
+
- **Ralph × Manus Integration** - Autonomous development with memory (NEW)
|
|
531
|
+
- Merged into `/flow-dev` (Autonomous by default)
|
|
532
|
+
- `flow-attention-refresh` skill with 4 refresh protocols
|
|
533
|
+
- `ERROR_LOG.md` structured error tracking
|
|
534
|
+
- `research/attempts/` failure trace recording
|
|
535
|
+
- Stop Hook for self-referential loops
|
|
536
|
+
- Manus method in `/flow-init` Stage 2.5 Research
|
|
537
|
+
- Target: ≥85% task completion rate without human intervention
|
|
538
|
+
|
|
539
|
+
**📋 Constitution v2.1.0**:
|
|
540
|
+
- All 10 Articles now have Iron Law + Rationalization Defense + Red Flags
|
|
541
|
+
- Cross-reference to `rationalization-library.md`
|
|
542
|
+
|
|
543
|
+
**📁 New Files**:
|
|
544
|
+
- `.claude/commands/cancel-ralph.md` - Cancel Ralph loop command
|
|
545
|
+
- `.claude/skills/flow-attention-refresh/SKILL.md` - 4 attention refresh protocols
|
|
546
|
+
- `.claude/hooks/ralph-stop-hook.sh` - Stop Hook for self-referential loops
|
|
547
|
+
- `.claude/hooks/hooks.json` - Hook registration configuration
|
|
548
|
+
- `.claude/scripts/setup-ralph-loop.sh` - Ralph state initialization script
|
|
549
|
+
- `.claude/docs/templates/ERROR_LOG_TEMPLATE.md` - Execution error log format
|
|
550
|
+
- `.claude/docs/templates/ATTEMPT_TEMPLATE.md` - Research attempt log format
|
|
551
|
+
- `.claude/agents/spec-reviewer.md` - Stage 1 spec compliance reviewer
|
|
552
|
+
- `.claude/agents/code-quality-reviewer.md` - Stage 2 code quality reviewer
|
|
553
|
+
- `.claude/commands/flow-review.md` - Two-stage review command
|
|
554
|
+
- `.claude/rules/rationalization-library.md` - Centralized rationalization defense
|
|
555
|
+
- `.claude/scripts/verify-gate.sh` - Exit gate verification script
|
|
556
|
+
- `.claude/skills/flow-brainstorming/` - Brainstorming skill
|
|
557
|
+
- `.claude/skills/flow-debugging/` - Systematic debugging skill
|
|
558
|
+
- `.claude/skills/flow-tdd/` - TDD enforcement skill
|
|
559
|
+
- `.claude/skills/flow-receiving-review/` - Review feedback handling skill
|
|
560
|
+
- `.claude/skills/flow-finishing-branch/` - Branch completion decision skill
|
|
561
|
+
- `.claude/skills/verification-before-completion/` - Completion verification skill
|
|
562
|
+
- `tests/` - Pressure testing framework
|
|
563
|
+
|
|
564
|
+
### v2.2.0 (2025-12-19)
|
|
480
565
|
|
|
481
566
|
**🔌 Multi-Platform Adaptation: Agent Adapter Architecture + Command Emitter**
|
|
482
567
|
|