claude-code-workflow 6.3.22 → 6.3.24

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.
Files changed (42) hide show
  1. package/.claude/agents/issue-plan-agent.md +10 -5
  2. package/.claude/commands/issue/plan.md +1 -1
  3. package/.claude/skills/review-code/SKILL.md +170 -0
  4. package/.claude/skills/review-code/phases/actions/action-collect-context.md +139 -0
  5. package/.claude/skills/review-code/phases/actions/action-complete.md +115 -0
  6. package/.claude/skills/review-code/phases/actions/action-deep-review.md +302 -0
  7. package/.claude/skills/review-code/phases/actions/action-generate-report.md +263 -0
  8. package/.claude/skills/review-code/phases/actions/action-quick-scan.md +164 -0
  9. package/.claude/skills/review-code/phases/orchestrator.md +251 -0
  10. package/.claude/skills/review-code/phases/state-manager.md +752 -0
  11. package/.claude/skills/review-code/phases/state-schema.md +174 -0
  12. package/.claude/skills/review-code/specs/issue-classification.md +228 -0
  13. package/.claude/skills/review-code/specs/quality-standards.md +214 -0
  14. package/.claude/skills/review-code/specs/review-dimensions.md +337 -0
  15. package/.claude/skills/review-code/specs/rules/architecture-rules.json +63 -0
  16. package/.claude/skills/review-code/specs/rules/correctness-rules.json +60 -0
  17. package/.claude/skills/review-code/specs/rules/index.md +140 -0
  18. package/.claude/skills/review-code/specs/rules/performance-rules.json +59 -0
  19. package/.claude/skills/review-code/specs/rules/readability-rules.json +60 -0
  20. package/.claude/skills/review-code/specs/rules/security-rules.json +58 -0
  21. package/.claude/skills/review-code/specs/rules/testing-rules.json +59 -0
  22. package/.claude/skills/review-code/templates/issue-template.md +186 -0
  23. package/.claude/skills/review-code/templates/review-report.md +173 -0
  24. package/.claude/skills/skill-generator/SKILL.md +56 -17
  25. package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +10 -0
  26. package/.claude/skills/skill-generator/templates/sequential-phase.md +9 -0
  27. package/.claude/skills/skill-generator/templates/skill-md.md +84 -5
  28. package/.claude/workflows/cli-templates/schemas/solution-schema.json +3 -3
  29. package/ccw/src/templates/dashboard-js/views/issue-manager.js +8 -0
  30. package/package.json +1 -1
  31. package/.claude/skills/code-reviewer/README.md +0 -340
  32. package/.claude/skills/code-reviewer/SKILL.md +0 -308
  33. package/.claude/skills/code-reviewer/phases/01-code-discovery.md +0 -246
  34. package/.claude/skills/code-reviewer/phases/02-security-analysis.md +0 -442
  35. package/.claude/skills/code-reviewer/phases/03-best-practices-review.md +0 -36
  36. package/.claude/skills/code-reviewer/phases/04-report-generation.md +0 -278
  37. package/.claude/skills/code-reviewer/specs/best-practices-requirements.md +0 -346
  38. package/.claude/skills/code-reviewer/specs/quality-standards.md +0 -252
  39. package/.claude/skills/code-reviewer/specs/security-requirements.md +0 -243
  40. package/.claude/skills/code-reviewer/templates/best-practice-finding.md +0 -234
  41. package/.claude/skills/code-reviewer/templates/report-template.md +0 -316
  42. package/.claude/skills/code-reviewer/templates/security-finding.md +0 -161
@@ -0,0 +1,60 @@
1
+ {
2
+ "dimension": "readability",
3
+ "prefix": "READ",
4
+ "description": "Rules for detecting code readability issues including naming, complexity, and documentation",
5
+ "rules": [
6
+ {
7
+ "id": "long-function",
8
+ "category": "function-length",
9
+ "severity": "medium",
10
+ "pattern": "function\\s+\\w+\\s*\\([^)]*\\)\\s*\\{|=>\\s*\\{",
11
+ "patternType": "regex",
12
+ "lineThreshold": 50,
13
+ "description": "Functions longer than 50 lines are difficult to understand and maintain",
14
+ "recommendation": "Break down into smaller, focused functions. Each function should do one thing well",
15
+ "fixExample": "// Before - 100 line function\nfunction processData(data) {\n // validation\n // transformation\n // calculation\n // formatting\n // output\n}\n\n// After - composed functions\nfunction processData(data) {\n const validated = validateData(data);\n const transformed = transformData(validated);\n return formatOutput(calculateResults(transformed));\n}"
16
+ },
17
+ {
18
+ "id": "single-letter-variable",
19
+ "category": "naming",
20
+ "severity": "low",
21
+ "pattern": "(?:const|let|var)\\s+[a-z]\\s*=",
22
+ "patternType": "regex",
23
+ "negativePatterns": ["for\\s*\\(", "\\[\\w,\\s*\\w\\]", "catch\\s*\\(e\\)"],
24
+ "description": "Single letter variable names reduce code readability except in specific contexts (loop counters, catch)",
25
+ "recommendation": "Use descriptive names that convey the variable's purpose",
26
+ "fixExample": "// Before\nconst d = getData();\nconst r = d.map(x => x.value);\n\n// After\nconst userData = getData();\nconst userValues = userData.map(user => user.value);"
27
+ },
28
+ {
29
+ "id": "deep-nesting",
30
+ "category": "complexity",
31
+ "severity": "high",
32
+ "pattern": "\\{[^}]*\\{[^}]*\\{[^}]*\\{",
33
+ "patternType": "regex",
34
+ "description": "Deeply nested code (4+ levels) is hard to follow and maintain",
35
+ "recommendation": "Use early returns, extract functions, or flatten conditionals",
36
+ "fixExample": "// Before\nif (user) {\n if (user.permissions) {\n if (user.permissions.canEdit) {\n if (document.isEditable) {\n // do work\n }\n }\n }\n}\n\n// After\nif (!user?.permissions?.canEdit) return;\nif (!document.isEditable) return;\n// do work"
37
+ },
38
+ {
39
+ "id": "magic-number",
40
+ "category": "magic-value",
41
+ "severity": "low",
42
+ "pattern": "[^\\d]\\d{2,}[^\\d]|setTimeout\\s*\\([^,]+,\\s*\\d{4,}\\)",
43
+ "patternType": "regex",
44
+ "negativePatterns": ["const", "let", "enum", "0x", "100", "1000"],
45
+ "description": "Magic numbers without explanation make code hard to understand",
46
+ "recommendation": "Extract magic numbers into named constants with descriptive names",
47
+ "fixExample": "// Before\nif (status === 403) { ... }\nsetTimeout(callback, 86400000);\n\n// After\nconst HTTP_FORBIDDEN = 403;\nconst ONE_DAY_MS = 24 * 60 * 60 * 1000;\nif (status === HTTP_FORBIDDEN) { ... }\nsetTimeout(callback, ONE_DAY_MS);"
48
+ },
49
+ {
50
+ "id": "commented-code",
51
+ "category": "dead-code",
52
+ "severity": "low",
53
+ "pattern": "//\\s*(const|let|var|function|if|for|while|return)\\s+",
54
+ "patternType": "regex",
55
+ "description": "Commented-out code adds noise and should be removed. Use version control for history",
56
+ "recommendation": "Remove commented code. If needed for reference, add a comment explaining why with a link to relevant commit/issue",
57
+ "fixExample": "// Before\n// function oldImplementation() { ... }\n// const legacyConfig = {...};\n\n// After\n// See PR #123 for previous implementation\n// removed 2024-01-01"
58
+ }
59
+ ]
60
+ }
@@ -0,0 +1,58 @@
1
+ {
2
+ "dimension": "security",
3
+ "prefix": "SEC",
4
+ "description": "Rules for detecting security vulnerabilities including XSS, injection, and credential exposure",
5
+ "rules": [
6
+ {
7
+ "id": "xss-innerHTML",
8
+ "category": "xss-risk",
9
+ "severity": "critical",
10
+ "pattern": "innerHTML\\s*=|dangerouslySetInnerHTML",
11
+ "patternType": "includes",
12
+ "description": "Direct HTML injection via innerHTML or dangerouslySetInnerHTML can lead to XSS vulnerabilities",
13
+ "recommendation": "Use textContent for plain text, or sanitize HTML input using a library like DOMPurify before injection",
14
+ "fixExample": "// Before\nelement.innerHTML = userInput;\n<div dangerouslySetInnerHTML={{__html: data}} />\n\n// After\nelement.textContent = userInput;\n// or\nimport DOMPurify from 'dompurify';\nelement.innerHTML = DOMPurify.sanitize(userInput);"
15
+ },
16
+ {
17
+ "id": "hardcoded-secret",
18
+ "category": "hardcoded-secret",
19
+ "severity": "critical",
20
+ "pattern": "(?:password|secret|api[_-]?key|token|credential)\\s*[=:]\\s*['\"][^'\"]{8,}['\"]",
21
+ "patternType": "regex",
22
+ "caseInsensitive": true,
23
+ "description": "Hardcoded credentials detected in source code. This is a security risk if code is exposed",
24
+ "recommendation": "Use environment variables, secret management services, or configuration files excluded from version control",
25
+ "fixExample": "// Before\nconst apiKey = 'sk-1234567890abcdef';\n\n// After\nconst apiKey = process.env.API_KEY;\n// or\nconst apiKey = await getSecretFromVault('api-key');"
26
+ },
27
+ {
28
+ "id": "sql-injection",
29
+ "category": "injection",
30
+ "severity": "critical",
31
+ "pattern": "query\\s*\\(\\s*[`'\"].*\\$\\{|execute\\s*\\(\\s*[`'\"].*\\+",
32
+ "patternType": "regex",
33
+ "description": "String concatenation or template literals in SQL queries can lead to SQL injection",
34
+ "recommendation": "Use parameterized queries or prepared statements with placeholders",
35
+ "fixExample": "// Before\ndb.query(`SELECT * FROM users WHERE id = ${userId}`);\n\n// After\ndb.query('SELECT * FROM users WHERE id = ?', [userId]);\n// or\ndb.query('SELECT * FROM users WHERE id = $1', [userId]);"
36
+ },
37
+ {
38
+ "id": "command-injection",
39
+ "category": "injection",
40
+ "severity": "critical",
41
+ "pattern": "exec\\s*\\(|execSync\\s*\\(|spawn\\s*\\([^,]*\\+|child_process",
42
+ "patternType": "regex",
43
+ "description": "Command execution with user input can lead to command injection attacks",
44
+ "recommendation": "Validate and sanitize input, use parameterized commands, or avoid shell execution entirely",
45
+ "fixExample": "// Before\nexec(`ls ${userInput}`);\n\n// After\nexecFile('ls', [sanitizedInput], options);\n// or use spawn with {shell: false}"
46
+ },
47
+ {
48
+ "id": "insecure-random",
49
+ "category": "cryptography",
50
+ "severity": "high",
51
+ "pattern": "Math\\.random\\(\\)",
52
+ "patternType": "includes",
53
+ "description": "Math.random() is not cryptographically secure and should not be used for security-sensitive operations",
54
+ "recommendation": "Use crypto.randomBytes() or crypto.getRandomValues() for security-critical random generation",
55
+ "fixExample": "// Before\nconst token = Math.random().toString(36);\n\n// After\nimport crypto from 'crypto';\nconst token = crypto.randomBytes(32).toString('hex');"
56
+ }
57
+ ]
58
+ }
@@ -0,0 +1,59 @@
1
+ {
2
+ "dimension": "testing",
3
+ "prefix": "TEST",
4
+ "description": "Rules for detecting testing issues including coverage gaps, test quality, and mock usage",
5
+ "rules": [
6
+ {
7
+ "id": "missing-assertion",
8
+ "category": "test-quality",
9
+ "severity": "high",
10
+ "pattern": "(?:it|test)\\s*\\([^)]+,\\s*(?:async\\s*)?\\(\\)\\s*=>\\s*\\{[^}]*\\}\\s*\\)",
11
+ "patternType": "regex",
12
+ "negativePatterns": ["expect", "assert", "should", "toBe", "toEqual"],
13
+ "description": "Test case without assertions always passes and provides no value",
14
+ "recommendation": "Add assertions to verify expected behavior. Each test should have at least one meaningful assertion",
15
+ "fixExample": "// Before\nit('should process data', async () => {\n await processData(input);\n});\n\n// After\nit('should process data', async () => {\n const result = await processData(input);\n expect(result.success).toBe(true);\n expect(result.data).toHaveLength(3);\n});"
16
+ },
17
+ {
18
+ "id": "hardcoded-test-data",
19
+ "category": "test-maintainability",
20
+ "severity": "low",
21
+ "pattern": "expect\\s*\\([^)]+\\)\\.toBe\\s*\\(['\"][^'\"]{20,}['\"]\\)",
22
+ "patternType": "regex",
23
+ "description": "Long hardcoded strings in assertions are brittle and hard to maintain",
24
+ "recommendation": "Use snapshots for large outputs, or extract expected values to test fixtures",
25
+ "fixExample": "// Before\nexpect(result).toBe('very long expected string that is hard to maintain...');\n\n// After\nexpect(result).toMatchSnapshot();\n// or\nconst expected = loadFixture('expected-output.json');\nexpect(result).toEqual(expected);"
26
+ },
27
+ {
28
+ "id": "no-error-test",
29
+ "category": "coverage-gap",
30
+ "severity": "medium",
31
+ "pattern": "describe\\s*\\([^)]+",
32
+ "patternType": "regex",
33
+ "negativePatterns": ["throw", "reject", "error", "fail", "catch"],
34
+ "description": "Test suite may be missing error path testing. Error handling is critical for reliability",
35
+ "recommendation": "Add tests for error cases: invalid input, network failures, edge cases",
36
+ "fixExample": "// Add error path tests\nit('should throw on invalid input', () => {\n expect(() => processData(null)).toThrow('Invalid input');\n});\n\nit('should handle network failure', async () => {\n mockApi.mockRejectedValue(new Error('Network error'));\n await expect(fetchData()).rejects.toThrow('Network error');\n});"
37
+ },
38
+ {
39
+ "id": "test-implementation-detail",
40
+ "category": "test-quality",
41
+ "severity": "medium",
42
+ "pattern": "toHaveBeenCalledWith|toHaveBeenCalledTimes",
43
+ "patternType": "includes",
44
+ "description": "Testing implementation details (call counts, exact parameters) makes tests brittle to refactoring",
45
+ "recommendation": "Prefer testing observable behavior and outcomes over internal implementation",
46
+ "fixExample": "// Before - brittle\nexpect(mockService.process).toHaveBeenCalledTimes(3);\nexpect(mockService.process).toHaveBeenCalledWith('exact-arg');\n\n// After - behavior-focused\nexpect(result.items).toHaveLength(3);\nexpect(result.processed).toBe(true);"
47
+ },
48
+ {
49
+ "id": "skip-test",
50
+ "category": "test-coverage",
51
+ "severity": "high",
52
+ "pattern": "it\\.skip|test\\.skip|xit|xdescribe|describe\\.skip",
53
+ "patternType": "regex",
54
+ "description": "Skipped tests indicate untested code paths or broken functionality",
55
+ "recommendation": "Fix or remove skipped tests. If temporarily skipped, add TODO comment with issue reference",
56
+ "fixExample": "// Before\nit.skip('should handle edge case', () => { ... });\n\n// After - either fix it\nit('should handle edge case', () => {\n // fixed implementation\n});\n\n// Or document why skipped\n// TODO(#123): Re-enable after API migration\nit.skip('should handle edge case', () => { ... });"
57
+ }
58
+ ]
59
+ }
@@ -0,0 +1,186 @@
1
+ # Issue Template
2
+
3
+ 问题记录模板。
4
+
5
+ ## Single Issue Template
6
+
7
+ ```markdown
8
+ #### {{severity_emoji}} [{{id}}] {{category}}
9
+
10
+ - **严重程度**: {{severity}}
11
+ - **维度**: {{dimension}}
12
+ - **文件**: `{{file}}`{{#if line}}:{{line}}{{/if}}
13
+ - **描述**: {{description}}
14
+
15
+ {{#if code_snippet}}
16
+ **问题代码**:
17
+ ```{{language}}
18
+ {{code_snippet}}
19
+ ```
20
+ {{/if}}
21
+
22
+ **建议**: {{recommendation}}
23
+
24
+ {{#if fix_example}}
25
+ **修复示例**:
26
+ ```{{language}}
27
+ {{fix_example}}
28
+ ```
29
+ {{/if}}
30
+
31
+ {{#if references}}
32
+ **参考资料**:
33
+ {{#each references}}
34
+ - {{this}}
35
+ {{/each}}
36
+ {{/if}}
37
+ ```
38
+
39
+ ## Issue Object Schema
40
+
41
+ ```typescript
42
+ interface Issue {
43
+ id: string; // e.g., "SEC-001"
44
+ severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
45
+ dimension: string; // e.g., "security"
46
+ category: string; // e.g., "xss-risk"
47
+ file: string; // e.g., "src/utils/render.ts"
48
+ line?: number; // e.g., 42
49
+ column?: number; // e.g., 15
50
+ code_snippet?: string;
51
+ description: string;
52
+ recommendation: string;
53
+ fix_example?: string;
54
+ references?: string[];
55
+ }
56
+ ```
57
+
58
+ ## ID Generation
59
+
60
+ ```javascript
61
+ function generateIssueId(dimension, counter) {
62
+ const prefixes = {
63
+ correctness: 'CORR',
64
+ readability: 'READ',
65
+ performance: 'PERF',
66
+ security: 'SEC',
67
+ testing: 'TEST',
68
+ architecture: 'ARCH'
69
+ };
70
+
71
+ const prefix = prefixes[dimension] || 'MISC';
72
+ const number = String(counter).padStart(3, '0');
73
+
74
+ return `${prefix}-${number}`;
75
+ }
76
+ ```
77
+
78
+ ## Severity Emojis
79
+
80
+ ```javascript
81
+ const SEVERITY_EMOJI = {
82
+ critical: '🔴',
83
+ high: '🟠',
84
+ medium: '🟡',
85
+ low: '🔵',
86
+ info: '⚪'
87
+ };
88
+ ```
89
+
90
+ ## Issue Categories by Dimension
91
+
92
+ ### Correctness
93
+ - `null-check` - 缺少空值检查
94
+ - `boundary` - 边界条件未处理
95
+ - `error-handling` - 错误处理不当
96
+ - `type-safety` - 类型安全问题
97
+ - `logic-error` - 逻辑错误
98
+ - `resource-leak` - 资源泄漏
99
+
100
+ ### Security
101
+ - `injection` - 注入风险
102
+ - `xss` - 跨站脚本
103
+ - `hardcoded-secret` - 硬编码密钥
104
+ - `auth` - 认证授权
105
+ - `sensitive-data` - 敏感数据
106
+
107
+ ### Performance
108
+ - `complexity` - 复杂度问题
109
+ - `n+1-query` - N+1 查询
110
+ - `memory-leak` - 内存泄漏
111
+ - `blocking-io` - 阻塞 I/O
112
+ - `inefficient-algorithm` - 低效算法
113
+
114
+ ### Readability
115
+ - `naming` - 命名问题
116
+ - `function-length` - 函数过长
117
+ - `nesting-depth` - 嵌套过深
118
+ - `comments` - 注释问题
119
+ - `duplication` - 代码重复
120
+
121
+ ### Testing
122
+ - `coverage` - 覆盖不足
123
+ - `boundary-test` - 缺少边界测试
124
+ - `test-isolation` - 测试不独立
125
+ - `flaky-test` - 不稳定测试
126
+
127
+ ### Architecture
128
+ - `layer-violation` - 层次违规
129
+ - `circular-dependency` - 循环依赖
130
+ - `coupling` - 耦合过紧
131
+ - `srp-violation` - 单一职责违规
132
+
133
+ ## Example Issues
134
+
135
+ ### Critical Security Issue
136
+
137
+ ```json
138
+ {
139
+ "id": "SEC-001",
140
+ "severity": "critical",
141
+ "dimension": "security",
142
+ "category": "xss",
143
+ "file": "src/components/Comment.tsx",
144
+ "line": 25,
145
+ "code_snippet": "element.innerHTML = userComment;",
146
+ "description": "直接使用 innerHTML 插入用户输入,存在 XSS 攻击风险",
147
+ "recommendation": "使用 textContent 或对用户输入进行 HTML 转义",
148
+ "fix_example": "element.textContent = userComment;\n// 或\nelement.innerHTML = DOMPurify.sanitize(userComment);",
149
+ "references": [
150
+ "https://owasp.org/www-community/xss-filter-evasion-cheatsheet"
151
+ ]
152
+ }
153
+ ```
154
+
155
+ ### High Correctness Issue
156
+
157
+ ```json
158
+ {
159
+ "id": "CORR-003",
160
+ "severity": "high",
161
+ "dimension": "correctness",
162
+ "category": "error-handling",
163
+ "file": "src/services/api.ts",
164
+ "line": 42,
165
+ "code_snippet": "try {\n await fetchData();\n} catch (e) {}",
166
+ "description": "空的 catch 块会静默吞掉错误,导致问题难以发现和调试",
167
+ "recommendation": "记录错误日志或重新抛出异常",
168
+ "fix_example": "try {\n await fetchData();\n} catch (e) {\n console.error('Failed to fetch data:', e);\n throw e;\n}"
169
+ }
170
+ ```
171
+
172
+ ### Medium Readability Issue
173
+
174
+ ```json
175
+ {
176
+ "id": "READ-007",
177
+ "severity": "medium",
178
+ "dimension": "readability",
179
+ "category": "function-length",
180
+ "file": "src/utils/processor.ts",
181
+ "line": 15,
182
+ "description": "函数 processData 有 150 行,超过推荐的 50 行限制,难以理解和维护",
183
+ "recommendation": "将函数拆分为多个小函数,每个函数负责单一职责",
184
+ "fix_example": "// 拆分为:\nfunction validateInput(data) { ... }\nfunction transformData(data) { ... }\nfunction saveData(data) { ... }"
185
+ }
186
+ ```
@@ -0,0 +1,173 @@
1
+ # Review Report Template
2
+
3
+ 审查报告模板。
4
+
5
+ ## Template Structure
6
+
7
+ ```markdown
8
+ # Code Review Report
9
+
10
+ ## 审查概览
11
+
12
+ | 项目 | 值 |
13
+ |------|------|
14
+ | 目标路径 | `{{target_path}}` |
15
+ | 文件数量 | {{file_count}} |
16
+ | 代码行数 | {{total_lines}} |
17
+ | 主要语言 | {{language}} |
18
+ | 框架 | {{framework}} |
19
+ | 审查时间 | {{review_duration}} |
20
+
21
+ ## 问题统计
22
+
23
+ | 严重程度 | 数量 |
24
+ |----------|------|
25
+ | 🔴 Critical | {{critical_count}} |
26
+ | 🟠 High | {{high_count}} |
27
+ | 🟡 Medium | {{medium_count}} |
28
+ | 🔵 Low | {{low_count}} |
29
+ | ⚪ Info | {{info_count}} |
30
+ | **总计** | **{{total_issues}}** |
31
+
32
+ ### 按维度统计
33
+
34
+ | 维度 | 问题数 |
35
+ |------|--------|
36
+ | Correctness (正确性) | {{correctness_count}} |
37
+ | Security (安全性) | {{security_count}} |
38
+ | Performance (性能) | {{performance_count}} |
39
+ | Readability (可读性) | {{readability_count}} |
40
+ | Testing (测试) | {{testing_count}} |
41
+ | Architecture (架构) | {{architecture_count}} |
42
+
43
+ ---
44
+
45
+ ## 高风险区域
46
+
47
+ {{#if risk_areas}}
48
+ | 文件 | 原因 | 优先级 |
49
+ |------|------|--------|
50
+ {{#each risk_areas}}
51
+ | `{{this.file}}` | {{this.reason}} | {{this.priority}} |
52
+ {{/each}}
53
+ {{else}}
54
+ 未发现明显的高风险区域。
55
+ {{/if}}
56
+
57
+ ---
58
+
59
+ ## 问题详情
60
+
61
+ {{#each dimensions}}
62
+ ### {{this.name}}
63
+
64
+ {{#each this.findings}}
65
+ #### {{severity_emoji this.severity}} [{{this.id}}] {{this.category}}
66
+
67
+ - **严重程度**: {{this.severity}}
68
+ - **文件**: `{{this.file}}`{{#if this.line}}:{{this.line}}{{/if}}
69
+ - **描述**: {{this.description}}
70
+
71
+ {{#if this.code_snippet}}
72
+ ```
73
+ {{this.code_snippet}}
74
+ ```
75
+ {{/if}}
76
+
77
+ **建议**: {{this.recommendation}}
78
+
79
+ {{#if this.fix_example}}
80
+ **修复示例**:
81
+ ```
82
+ {{this.fix_example}}
83
+ ```
84
+ {{/if}}
85
+
86
+ ---
87
+
88
+ {{/each}}
89
+ {{/each}}
90
+
91
+ ## 审查建议
92
+
93
+ ### 必须修复 (Must Fix)
94
+
95
+ {{must_fix_summary}}
96
+
97
+ ### 建议改进 (Should Fix)
98
+
99
+ {{should_fix_summary}}
100
+
101
+ ### 可选优化 (Nice to Have)
102
+
103
+ {{nice_to_have_summary}}
104
+
105
+ ---
106
+
107
+ *报告生成时间: {{generated_at}}*
108
+ ```
109
+
110
+ ## Variable Definitions
111
+
112
+ | Variable | Type | Source |
113
+ |----------|------|--------|
114
+ | `{{target_path}}` | string | state.context.target_path |
115
+ | `{{file_count}}` | number | state.context.file_count |
116
+ | `{{total_lines}}` | number | state.context.total_lines |
117
+ | `{{language}}` | string | state.context.language |
118
+ | `{{framework}}` | string | state.context.framework |
119
+ | `{{review_duration}}` | string | Formatted duration |
120
+ | `{{critical_count}}` | number | Count of critical findings |
121
+ | `{{high_count}}` | number | Count of high findings |
122
+ | `{{medium_count}}` | number | Count of medium findings |
123
+ | `{{low_count}}` | number | Count of low findings |
124
+ | `{{info_count}}` | number | Count of info findings |
125
+ | `{{total_issues}}` | number | Total findings |
126
+ | `{{risk_areas}}` | array | state.scan_summary.risk_areas |
127
+ | `{{dimensions}}` | array | Grouped findings by dimension |
128
+ | `{{generated_at}}` | string | ISO timestamp |
129
+
130
+ ## Helper Functions
131
+
132
+ ```javascript
133
+ function severity_emoji(severity) {
134
+ const emojis = {
135
+ critical: '🔴',
136
+ high: '🟠',
137
+ medium: '🟡',
138
+ low: '🔵',
139
+ info: '⚪'
140
+ };
141
+ return emojis[severity] || '⚪';
142
+ }
143
+
144
+ function formatDuration(ms) {
145
+ const minutes = Math.floor(ms / 60000);
146
+ const seconds = Math.floor((ms % 60000) / 1000);
147
+ return `${minutes}分${seconds}秒`;
148
+ }
149
+
150
+ function generateMustFixSummary(findings) {
151
+ const critical = findings.filter(f => f.severity === 'critical');
152
+ const high = findings.filter(f => f.severity === 'high');
153
+
154
+ if (critical.length + high.length === 0) {
155
+ return '未发现必须立即修复的问题。';
156
+ }
157
+
158
+ return `发现 ${critical.length} 个严重问题和 ${high.length} 个高优先级问题,建议在合并前修复。`;
159
+ }
160
+ ```
161
+
162
+ ## Usage Example
163
+
164
+ ```javascript
165
+ const report = generateReport({
166
+ context: state.context,
167
+ summary: state.summary,
168
+ findings: state.findings,
169
+ scanSummary: state.scan_summary
170
+ });
171
+
172
+ Write(`${workDir}/review-report.md`, report);
173
+ ```
@@ -15,6 +15,9 @@ Meta-skill for creating new Claude Code skills with configurable execution modes
15
15
  │ Skill Generator Architecture │
16
16
  ├─────────────────────────────────────────────────────────────────┤
17
17
  │ │
18
+ │ ⚠️ Phase 0: Specification → 阅读并理解设计规范 (强制前置) │
19
+ │ Study SKILL-DESIGN-SPEC.md + 模板 │
20
+ │ ↓ │
18
21
  │ Phase 1: Requirements → skill-config.json │
19
22
  │ Discovery (name, type, mode, agents) │
20
23
  │ ↓ │
@@ -82,10 +85,63 @@ Phase 01 → Phase 02 → Phase 03 → ... → Phase N
82
85
  3. **规范遵循**: 严格遵循 `_shared/SKILL-DESIGN-SPEC.md`
83
86
  4. **可扩展性**: 生成的 Skill 易于扩展和修改
84
87
 
88
+ ---
89
+
90
+ ## ⚠️ Mandatory Prerequisites (强制前置条件)
91
+
92
+ > **⛔ 禁止跳过**: 在执行任何生成操作之前,**必须**完整阅读以下文档。未阅读规范直接生成将导致输出不符合质量标准。
93
+
94
+ ### 核心规范 (必读)
95
+
96
+ | Document | Purpose | Priority |
97
+ |----------|---------|----------|
98
+ | [../_shared/SKILL-DESIGN-SPEC.md](../_shared/SKILL-DESIGN-SPEC.md) | 通用设计规范 - 定义所有 Skill 的结构、命名、质量标准 | **P0 - 最高** |
99
+
100
+ ### 模板文件 (生成前必读)
101
+
102
+ | Document | Purpose |
103
+ |----------|---------|
104
+ | [templates/skill-md.md](templates/skill-md.md) | SKILL.md 入口文件模板 |
105
+ | [templates/sequential-phase.md](templates/sequential-phase.md) | Sequential Phase 模板 |
106
+ | [templates/autonomous-orchestrator.md](templates/autonomous-orchestrator.md) | Autonomous 编排器模板 |
107
+ | [templates/autonomous-action.md](templates/autonomous-action.md) | Autonomous Action 模板 |
108
+ | [templates/code-analysis-action.md](templates/code-analysis-action.md) | 代码分析 Action 模板 |
109
+ | [templates/llm-action.md](templates/llm-action.md) | LLM Action 模板 |
110
+ | [templates/script-bash.md](templates/script-bash.md) | Bash 脚本模板 |
111
+ | [templates/script-python.md](templates/script-python.md) | Python 脚本模板 |
112
+
113
+ ### 规范文档 (按需阅读)
114
+
115
+ | Document | Purpose |
116
+ |----------|---------|
117
+ | [specs/execution-modes.md](specs/execution-modes.md) | 执行模式规范 |
118
+ | [specs/skill-requirements.md](specs/skill-requirements.md) | Skill 需求规范 |
119
+ | [specs/cli-integration.md](specs/cli-integration.md) | CLI 集成规范 |
120
+ | [specs/scripting-integration.md](specs/scripting-integration.md) | 脚本集成规范 |
121
+
122
+ ### Phase 执行指南 (执行时参考)
123
+
124
+ | Document | Purpose |
125
+ |----------|---------|
126
+ | [phases/01-requirements-discovery.md](phases/01-requirements-discovery.md) | 收集 Skill 需求 |
127
+ | [phases/02-structure-generation.md](phases/02-structure-generation.md) | 生成目录结构 |
128
+ | [phases/03-phase-generation.md](phases/03-phase-generation.md) | 生成 Phase 文件 |
129
+ | [phases/04-specs-templates.md](phases/04-specs-templates.md) | 生成规范和模板 |
130
+ | [phases/05-validation.md](phases/05-validation.md) | 验证和文档 |
131
+
132
+ ---
133
+
85
134
  ## Execution Flow
86
135
 
87
136
  ```
88
137
  ┌─────────────────────────────────────────────────────────────────┐
138
+ │ ⚠️ Phase 0: Specification Study (强制前置 - 禁止跳过) │
139
+ │ → Read: ../_shared/SKILL-DESIGN-SPEC.md (通用设计规范) │
140
+ │ → Read: templates/*.md (所有相关模板文件) │
141
+ │ → 理解: Skill 结构规范、命名约定、质量标准 │
142
+ │ → Output: 内化规范要求,确保后续生成符合标准 │
143
+ │ ⛔ 未完成 Phase 0 禁止进入 Phase 1 │
144
+ ├─────────────────────────────────────────────────────────────────┤
89
145
  │ Phase 1: Requirements Discovery │
90
146
  │ → AskUserQuestion: Skill 名称、目标、执行模式 │
91
147
  │ → Output: skill-config.json │
@@ -168,20 +224,3 @@ if (config.execution_mode === 'autonomous') {
168
224
  ├── orchestrator-base.md # 编排器模板
169
225
  └── action-base.md # 动作模板
170
226
  ```
171
-
172
- ## Reference Documents
173
-
174
- | Document | Purpose |
175
- |----------|---------|
176
- | [phases/01-requirements-discovery.md](phases/01-requirements-discovery.md) | 收集 Skill 需求 |
177
- | [phases/02-structure-generation.md](phases/02-structure-generation.md) | 生成目录结构 |
178
- | [phases/03-phase-generation.md](phases/03-phase-generation.md) | 生成 Phase 文件 |
179
- | [phases/04-specs-templates.md](phases/04-specs-templates.md) | 生成规范和模板 |
180
- | [phases/05-validation.md](phases/05-validation.md) | 验证和文档 |
181
- | [specs/execution-modes.md](specs/execution-modes.md) | 执行模式规范 |
182
- | [specs/skill-requirements.md](specs/skill-requirements.md) | Skill 需求规范 |
183
- | [templates/skill-md.md](templates/skill-md.md) | SKILL.md 模板 |
184
- | [templates/sequential-phase.md](templates/sequential-phase.md) | Sequential Phase 模板 |
185
- | [templates/autonomous-orchestrator.md](templates/autonomous-orchestrator.md) | Autonomous 编排器模板 |
186
- | [templates/autonomous-action.md](templates/autonomous-action.md) | Autonomous Action 模板 |
187
- | [../_shared/SKILL-DESIGN-SPEC.md](../_shared/SKILL-DESIGN-SPEC.md) | 通用设计规范 |
@@ -2,6 +2,16 @@
2
2
 
3
3
  自主模式编排器的模板。
4
4
 
5
+ ## ⚠️ 重要提示
6
+
7
+ > **Phase 0 是强制前置阶段**:在 Orchestrator 启动执行循环之前,必须先完成 Phase 0 的规范研读。
8
+ >
9
+ > 生成 Orchestrator 时,需要确保:
10
+ > 1. SKILL.md 中已包含 Phase 0 规范研读步骤
11
+ > 2. Orchestrator 启动前验证规范已阅读
12
+ > 3. 所有 Action 文件都引用相关的规范文档
13
+ > 4. Architecture Overview 中 Phase 0 位于 Orchestrator 之前
14
+
5
15
  ## 模板结构
6
16
 
7
17
  ```markdown
@@ -2,6 +2,15 @@
2
2
 
3
3
  顺序模式 Phase 文件的模板。
4
4
 
5
+ ## ⚠️ 重要提示
6
+
7
+ > **Phase 0 是强制前置阶段**:在实现任何 Phase (1, 2, 3...) 之前,必须先完成 Phase 0 的规范研读。
8
+ >
9
+ > 生成 Sequential Phase 时,需要确保:
10
+ > 1. SKILL.md 中已包含 Phase 0 规范研读步骤
11
+ > 2. 每个 Phase 文件都引用相关的规范文档
12
+ > 3. 执行流程明确标注 Phase 0 为禁止跳过的前置步骤
13
+
5
14
  ## 模板结构
6
15
 
7
16
  ```markdown