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,174 @@
1
+ # State Schema
2
+
3
+ Code Review 状态结构定义。
4
+
5
+ ## Schema Definition
6
+
7
+ ```typescript
8
+ interface ReviewState {
9
+ // === 元数据 ===
10
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'user_exit';
11
+ started_at: string; // ISO timestamp
12
+ updated_at: string; // ISO timestamp
13
+ completed_at?: string; // ISO timestamp
14
+
15
+ // === 审查目标 ===
16
+ context: {
17
+ target_path: string; // 目标路径(文件或目录)
18
+ files: string[]; // 待审查文件列表
19
+ language: string; // 主要编程语言
20
+ framework?: string; // 框架(如有)
21
+ total_lines: number; // 总代码行数
22
+ file_count: number; // 文件数量
23
+ };
24
+
25
+ // === 扫描结果 ===
26
+ scan_completed: boolean;
27
+ scan_summary: {
28
+ risk_areas: RiskArea[]; // 高风险区域
29
+ complexity_score: number; // 复杂度评分
30
+ quick_issues: QuickIssue[]; // 快速发现的问题
31
+ };
32
+
33
+ // === 审查进度 ===
34
+ reviewed_dimensions: string[]; // 已完成的审查维度
35
+ current_dimension?: string; // 当前审查维度
36
+
37
+ // === 发现的问题 ===
38
+ findings: {
39
+ correctness: Finding[];
40
+ readability: Finding[];
41
+ performance: Finding[];
42
+ security: Finding[];
43
+ testing: Finding[];
44
+ architecture: Finding[];
45
+ };
46
+
47
+ // === 报告状态 ===
48
+ report_generated: boolean;
49
+ report_path?: string;
50
+
51
+ // === 执行跟踪 ===
52
+ current_action?: string;
53
+ completed_actions: string[];
54
+ errors: ExecutionError[];
55
+ error_count: number;
56
+
57
+ // === 统计信息 ===
58
+ summary?: {
59
+ total_issues: number;
60
+ critical: number;
61
+ high: number;
62
+ medium: number;
63
+ low: number;
64
+ info: number;
65
+ review_duration_ms: number;
66
+ };
67
+ }
68
+
69
+ interface RiskArea {
70
+ file: string;
71
+ reason: string;
72
+ priority: 'high' | 'medium' | 'low';
73
+ }
74
+
75
+ interface QuickIssue {
76
+ type: string;
77
+ file: string;
78
+ line?: number;
79
+ message: string;
80
+ }
81
+
82
+ interface Finding {
83
+ id: string; // 唯一标识 e.g., "CORR-001"
84
+ severity: 'critical' | 'high' | 'medium' | 'low' | 'info';
85
+ dimension: string; // 所属维度
86
+ category: string; // 问题类别
87
+ file: string; // 文件路径
88
+ line?: number; // 行号
89
+ column?: number; // 列号
90
+ code_snippet?: string; // 问题代码片段
91
+ description: string; // 问题描述
92
+ recommendation: string; // 修复建议
93
+ fix_example?: string; // 修复示例代码
94
+ references?: string[]; // 参考资料链接
95
+ }
96
+
97
+ interface ExecutionError {
98
+ action: string;
99
+ message: string;
100
+ timestamp: string;
101
+ }
102
+ ```
103
+
104
+ ## Initial State
105
+
106
+ ```json
107
+ {
108
+ "status": "pending",
109
+ "started_at": "2024-01-01T00:00:00.000Z",
110
+ "updated_at": "2024-01-01T00:00:00.000Z",
111
+ "context": null,
112
+ "scan_completed": false,
113
+ "scan_summary": null,
114
+ "reviewed_dimensions": [],
115
+ "current_dimension": null,
116
+ "findings": {
117
+ "correctness": [],
118
+ "readability": [],
119
+ "performance": [],
120
+ "security": [],
121
+ "testing": [],
122
+ "architecture": []
123
+ },
124
+ "report_generated": false,
125
+ "report_path": null,
126
+ "current_action": null,
127
+ "completed_actions": [],
128
+ "errors": [],
129
+ "error_count": 0,
130
+ "summary": null
131
+ }
132
+ ```
133
+
134
+ ## State Transitions
135
+
136
+ ```mermaid
137
+ stateDiagram-v2
138
+ [*] --> pending: Initialize
139
+ pending --> running: collect-context
140
+ running --> running: quick-scan
141
+ running --> running: deep-review (6x)
142
+ running --> running: generate-report
143
+ running --> completed: complete
144
+ running --> failed: error_count >= 3
145
+ running --> user_exit: User abort
146
+ completed --> [*]
147
+ failed --> [*]
148
+ user_exit --> [*]
149
+ ```
150
+
151
+ ## Dimension Review Order
152
+
153
+ 1. **correctness** - 正确性(最高优先级)
154
+ 2. **security** - 安全性(关键)
155
+ 3. **performance** - 性能
156
+ 4. **readability** - 可读性
157
+ 5. **testing** - 测试覆盖
158
+ 6. **architecture** - 架构一致性
159
+
160
+ ## Finding ID Format
161
+
162
+ ```
163
+ {DIMENSION_PREFIX}-{SEQUENCE}
164
+
165
+ Prefixes:
166
+ - CORR: Correctness
167
+ - READ: Readability
168
+ - PERF: Performance
169
+ - SEC: Security
170
+ - TEST: Testing
171
+ - ARCH: Architecture
172
+
173
+ Example: SEC-003 = Security issue #3
174
+ ```
@@ -0,0 +1,228 @@
1
+ # Issue Classification
2
+
3
+ 问题分类和严重程度标准。
4
+
5
+ ## When to Use
6
+
7
+ | Phase | Usage | Section |
8
+ |-------|-------|---------|
9
+ | action-deep-review | 确定问题严重程度 | Severity Levels |
10
+ | action-generate-report | 问题分类展示 | Category Mapping |
11
+
12
+ ---
13
+
14
+ ## Severity Levels
15
+
16
+ ### Critical (严重) 🔴
17
+
18
+ **定义**: 必须在合并前修复的阻塞性问题
19
+
20
+ **标准**:
21
+ - 安全漏洞 (可被利用)
22
+ - 数据损坏或丢失风险
23
+ - 系统崩溃风险
24
+ - 生产环境重大故障
25
+
26
+ **示例**:
27
+ - SQL/XSS/命令注入
28
+ - 硬编码密钥泄露
29
+ - 未捕获的异常导致崩溃
30
+ - 数据库事务未正确处理
31
+
32
+ **响应**: 必须立即修复,阻塞合并
33
+
34
+ ---
35
+
36
+ ### High (高) 🟠
37
+
38
+ **定义**: 应在合并前修复的重要问题
39
+
40
+ **标准**:
41
+ - 功能缺陷
42
+ - 重要边界条件未处理
43
+ - 性能严重退化
44
+ - 资源泄漏
45
+
46
+ **示例**:
47
+ - 核心业务逻辑错误
48
+ - 内存泄漏
49
+ - N+1 查询问题
50
+ - 缺少必要的错误处理
51
+
52
+ **响应**: 强烈建议修复
53
+
54
+ ---
55
+
56
+ ### Medium (中) 🟡
57
+
58
+ **定义**: 建议修复的代码质量问题
59
+
60
+ **标准**:
61
+ - 代码可维护性问题
62
+ - 轻微性能问题
63
+ - 测试覆盖不足
64
+ - 不符合团队规范
65
+
66
+ **示例**:
67
+ - 函数过长
68
+ - 命名不清晰
69
+ - 缺少注释
70
+ - 代码重复
71
+
72
+ **响应**: 建议在后续迭代修复
73
+
74
+ ---
75
+
76
+ ### Low (低) 🔵
77
+
78
+ **定义**: 可选优化的问题
79
+
80
+ **标准**:
81
+ - 风格问题
82
+ - 微小优化
83
+ - 可读性改进
84
+
85
+ **示例**:
86
+ - 变量声明顺序
87
+ - 额外的空行
88
+ - 可以更简洁的写法
89
+
90
+ **响应**: 可根据团队偏好处理
91
+
92
+ ---
93
+
94
+ ### Info (信息) ⚪
95
+
96
+ **定义**: 信息性建议,非问题
97
+
98
+ **标准**:
99
+ - 学习机会
100
+ - 替代方案建议
101
+ - 文档完善建议
102
+
103
+ **示例**:
104
+ - "这里可以考虑使用新的 API"
105
+ - "建议添加 JSDoc 注释"
106
+ - "可以参考 xxx 模式"
107
+
108
+ **响应**: 仅供参考
109
+
110
+ ---
111
+
112
+ ## Category Mapping
113
+
114
+ ### By Dimension
115
+
116
+ | Dimension | Common Categories |
117
+ |-----------|-------------------|
118
+ | Correctness | `null-check`, `boundary`, `error-handling`, `type-safety`, `logic-error` |
119
+ | Security | `injection`, `xss`, `hardcoded-secret`, `auth`, `sensitive-data` |
120
+ | Performance | `complexity`, `n+1-query`, `memory-leak`, `blocking-io`, `inefficient-algorithm` |
121
+ | Readability | `naming`, `function-length`, `complexity`, `comments`, `duplication` |
122
+ | Testing | `coverage`, `boundary-test`, `mock-abuse`, `test-isolation` |
123
+ | Architecture | `layer-violation`, `circular-dependency`, `coupling`, `srp-violation` |
124
+
125
+ ### Category Details
126
+
127
+ #### Correctness Categories
128
+
129
+ | Category | Description | Default Severity |
130
+ |----------|-------------|------------------|
131
+ | `null-check` | 缺少空值检查 | High |
132
+ | `boundary` | 边界条件未处理 | High |
133
+ | `error-handling` | 错误处理不当 | High |
134
+ | `type-safety` | 类型安全问题 | Medium |
135
+ | `logic-error` | 逻辑错误 | Critical/High |
136
+ | `resource-leak` | 资源泄漏 | High |
137
+
138
+ #### Security Categories
139
+
140
+ | Category | Description | Default Severity |
141
+ |----------|-------------|------------------|
142
+ | `injection` | 注入风险 (SQL/Command) | Critical |
143
+ | `xss` | 跨站脚本风险 | Critical |
144
+ | `hardcoded-secret` | 硬编码密钥 | Critical |
145
+ | `auth` | 认证授权问题 | High |
146
+ | `sensitive-data` | 敏感数据暴露 | High |
147
+ | `insecure-dependency` | 不安全依赖 | Medium |
148
+
149
+ #### Performance Categories
150
+
151
+ | Category | Description | Default Severity |
152
+ |----------|-------------|------------------|
153
+ | `complexity` | 高算法复杂度 | Medium |
154
+ | `n+1-query` | N+1 查询问题 | High |
155
+ | `memory-leak` | 内存泄漏 | High |
156
+ | `blocking-io` | 阻塞 I/O | Medium |
157
+ | `inefficient-algorithm` | 低效算法 | Medium |
158
+ | `missing-cache` | 缺少缓存 | Low |
159
+
160
+ #### Readability Categories
161
+
162
+ | Category | Description | Default Severity |
163
+ |----------|-------------|------------------|
164
+ | `naming` | 命名问题 | Medium |
165
+ | `function-length` | 函数过长 | Medium |
166
+ | `nesting-depth` | 嵌套过深 | Medium |
167
+ | `comments` | 注释问题 | Low |
168
+ | `duplication` | 代码重复 | Medium |
169
+ | `magic-number` | 魔法数字 | Low |
170
+
171
+ #### Testing Categories
172
+
173
+ | Category | Description | Default Severity |
174
+ |----------|-------------|------------------|
175
+ | `coverage` | 测试覆盖不足 | Medium |
176
+ | `boundary-test` | 缺少边界测试 | Medium |
177
+ | `mock-abuse` | Mock 过度使用 | Low |
178
+ | `test-isolation` | 测试不独立 | Medium |
179
+ | `flaky-test` | 不稳定测试 | High |
180
+
181
+ #### Architecture Categories
182
+
183
+ | Category | Description | Default Severity |
184
+ |----------|-------------|------------------|
185
+ | `layer-violation` | 层次违规 | Medium |
186
+ | `circular-dependency` | 循环依赖 | High |
187
+ | `coupling` | 耦合过紧 | Medium |
188
+ | `srp-violation` | 单一职责违规 | Medium |
189
+ | `god-class` | 上帝类 | High |
190
+
191
+ ---
192
+
193
+ ## Finding ID Format
194
+
195
+ ```
196
+ {PREFIX}-{NNN}
197
+
198
+ Prefixes by Dimension:
199
+ - CORR: Correctness
200
+ - SEC: Security
201
+ - PERF: Performance
202
+ - READ: Readability
203
+ - TEST: Testing
204
+ - ARCH: Architecture
205
+
206
+ Examples:
207
+ - SEC-001: First security finding
208
+ - CORR-015: 15th correctness finding
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Quality Gates
214
+
215
+ | Gate | Condition | Action |
216
+ |------|-----------|--------|
217
+ | **Block** | Critical > 0 | 禁止合并 |
218
+ | **Warn** | High > 0 | 需要审批 |
219
+ | **Pass** | Critical = 0, High = 0 | 允许合并 |
220
+
221
+ ### Recommended Thresholds
222
+
223
+ | Metric | Ideal | Acceptable | Needs Work |
224
+ |--------|-------|------------|------------|
225
+ | Critical | 0 | 0 | Any > 0 |
226
+ | High | 0 | ≤ 2 | > 2 |
227
+ | Medium | ≤ 5 | ≤ 10 | > 10 |
228
+ | Total | ≤ 10 | ≤ 20 | > 20 |
@@ -0,0 +1,214 @@
1
+ # Quality Standards
2
+
3
+ 代码审查质量标准。
4
+
5
+ ## When to Use
6
+
7
+ | Phase | Usage | Section |
8
+ |-------|-------|---------|
9
+ | action-generate-report | 质量评估 | Quality Dimensions |
10
+ | action-complete | 最终评分 | Quality Gates |
11
+
12
+ ---
13
+
14
+ ## Quality Dimensions
15
+
16
+ ### 1. Completeness (完整性) - 25%
17
+
18
+ **评估审查覆盖的完整程度**
19
+
20
+ | Score | Criteria |
21
+ |-------|----------|
22
+ | 100% | 所有维度审查完成,所有高风险文件检查 |
23
+ | 80% | 核心维度完成,主要文件检查 |
24
+ | 60% | 部分维度完成 |
25
+ | < 60% | 审查不完整 |
26
+
27
+ **检查点**:
28
+ - [ ] 6 个维度全部审查
29
+ - [ ] 高风险区域重点检查
30
+ - [ ] 关键文件覆盖
31
+
32
+ ---
33
+
34
+ ### 2. Accuracy (准确性) - 25%
35
+
36
+ **评估发现问题的准确程度**
37
+
38
+ | Score | Criteria |
39
+ |-------|----------|
40
+ | 100% | 问题定位准确,分类正确,无误报 |
41
+ | 80% | 偶有分类偏差,定位准确 |
42
+ | 60% | 存在误报或漏报 |
43
+ | < 60% | 准确性差 |
44
+
45
+ **检查点**:
46
+ - [ ] 问题行号准确
47
+ - [ ] 严重程度合理
48
+ - [ ] 分类正确
49
+
50
+ ---
51
+
52
+ ### 3. Actionability (可操作性) - 25%
53
+
54
+ **评估建议的实用程度**
55
+
56
+ | Score | Criteria |
57
+ |-------|----------|
58
+ | 100% | 每个问题都有具体可执行的修复建议 |
59
+ | 80% | 大部分问题有清晰建议 |
60
+ | 60% | 建议较笼统 |
61
+ | < 60% | 缺乏可操作建议 |
62
+
63
+ **检查点**:
64
+ - [ ] 提供具体修复建议
65
+ - [ ] 包含代码示例
66
+ - [ ] 说明修复优先级
67
+
68
+ ---
69
+
70
+ ### 4. Consistency (一致性) - 25%
71
+
72
+ **评估审查标准的一致程度**
73
+
74
+ | Score | Criteria |
75
+ |-------|----------|
76
+ | 100% | 相同问题相同处理,标准统一 |
77
+ | 80% | 基本一致,偶有差异 |
78
+ | 60% | 标准不太统一 |
79
+ | < 60% | 标准混乱 |
80
+
81
+ **检查点**:
82
+ - [ ] ID 格式统一
83
+ - [ ] 严重程度标准一致
84
+ - [ ] 描述风格统一
85
+
86
+ ---
87
+
88
+ ## Quality Gates
89
+
90
+ ### Review Quality Gate
91
+
92
+ | Gate | Overall Score | Action |
93
+ |------|---------------|--------|
94
+ | **Excellent** | ≥ 90% | 高质量审查 |
95
+ | **Good** | ≥ 80% | 合格审查 |
96
+ | **Acceptable** | ≥ 70% | 基本可接受 |
97
+ | **Needs Improvement** | < 70% | 需要改进 |
98
+
99
+ ### Code Quality Gate (Based on Findings)
100
+
101
+ | Gate | Condition | Recommendation |
102
+ |------|-----------|----------------|
103
+ | **Block** | Critical > 0 | 禁止合并,必须修复 |
104
+ | **Warn** | High > 3 | 需要团队讨论 |
105
+ | **Caution** | Medium > 10 | 建议改进 |
106
+ | **Pass** | 其他 | 可以合并 |
107
+
108
+ ---
109
+
110
+ ## Report Quality Checklist
111
+
112
+ ### Structure
113
+
114
+ - [ ] 包含审查概览
115
+ - [ ] 包含问题统计
116
+ - [ ] 包含高风险区域
117
+ - [ ] 包含问题详情
118
+ - [ ] 包含修复建议
119
+
120
+ ### Content
121
+
122
+ - [ ] 问题描述清晰
123
+ - [ ] 文件位置准确
124
+ - [ ] 代码片段有效
125
+ - [ ] 修复建议具体
126
+ - [ ] 优先级明确
127
+
128
+ ### Format
129
+
130
+ - [ ] Markdown 格式正确
131
+ - [ ] 表格对齐
132
+ - [ ] 代码块语法正确
133
+ - [ ] 链接有效
134
+ - [ ] 无拼写错误
135
+
136
+ ---
137
+
138
+ ## Validation Function
139
+
140
+ ```javascript
141
+ function validateReviewQuality(state) {
142
+ const scores = {
143
+ completeness: 0,
144
+ accuracy: 0,
145
+ actionability: 0,
146
+ consistency: 0
147
+ };
148
+
149
+ // 1. Completeness
150
+ const dimensionsReviewed = state.reviewed_dimensions?.length || 0;
151
+ scores.completeness = (dimensionsReviewed / 6) * 100;
152
+
153
+ // 2. Accuracy (需要人工验证或后续反馈)
154
+ // 暂时基于有无错误来估算
155
+ scores.accuracy = state.error_count === 0 ? 100 : Math.max(0, 100 - state.error_count * 20);
156
+
157
+ // 3. Actionability
158
+ const findings = Object.values(state.findings).flat();
159
+ const withRecommendations = findings.filter(f => f.recommendation).length;
160
+ scores.actionability = findings.length > 0
161
+ ? (withRecommendations / findings.length) * 100
162
+ : 100;
163
+
164
+ // 4. Consistency (检查 ID 格式等)
165
+ const validIds = findings.filter(f => /^(CORR|SEC|PERF|READ|TEST|ARCH)-\d{3}$/.test(f.id)).length;
166
+ scores.consistency = findings.length > 0
167
+ ? (validIds / findings.length) * 100
168
+ : 100;
169
+
170
+ // Overall
171
+ const overall = (
172
+ scores.completeness * 0.25 +
173
+ scores.accuracy * 0.25 +
174
+ scores.actionability * 0.25 +
175
+ scores.consistency * 0.25
176
+ );
177
+
178
+ return {
179
+ scores,
180
+ overall,
181
+ gate: overall >= 90 ? 'excellent' :
182
+ overall >= 80 ? 'good' :
183
+ overall >= 70 ? 'acceptable' : 'needs_improvement'
184
+ };
185
+ }
186
+ ```
187
+
188
+ ---
189
+
190
+ ## Improvement Recommendations
191
+
192
+ ### If Completeness is Low
193
+
194
+ - 增加扫描的文件范围
195
+ - 确保所有维度都被审查
196
+ - 重点关注高风险区域
197
+
198
+ ### If Accuracy is Low
199
+
200
+ - 提高规则精度
201
+ - 减少误报
202
+ - 验证行号准确性
203
+
204
+ ### If Actionability is Low
205
+
206
+ - 为每个问题添加修复建议
207
+ - 提供代码示例
208
+ - 说明修复步骤
209
+
210
+ ### If Consistency is Low
211
+
212
+ - 统一 ID 格式
213
+ - 标准化严重程度判定
214
+ - 使用模板化描述