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
@@ -1,308 +0,0 @@
1
- ---
2
- name: code-reviewer
3
- description: Comprehensive code review skill for identifying security vulnerabilities and best practices violations. Triggers on "code review", "review code", "security audit", "代码审查".
4
- allowed-tools: Read, Glob, Grep, mcp__ace-tool__search_context, mcp__ccw-tools__smart_search
5
- ---
6
-
7
- # Code Reviewer
8
-
9
- Comprehensive code review skill for identifying security vulnerabilities and best practices violations.
10
-
11
- ## Architecture Overview
12
-
13
- ```
14
- ┌─────────────────────────────────────────────────────────────────┐
15
- │ Code Reviewer Workflow │
16
- ├─────────────────────────────────────────────────────────────────┤
17
- │ │
18
- │ Phase 1: Code Discovery → 发现待审查的代码文件 │
19
- │ & Scoping - 根据语言/框架识别文件 │
20
- │ ↓ - 设置审查范围和优先级 │
21
- │ │
22
- │ Phase 2: Security → 安全漏洞扫描 │
23
- │ Analysis - OWASP Top 10 检查 │
24
- │ ↓ - 常见漏洞模式识别 │
25
- │ - 敏感数据泄露检查 │
26
- │ │
27
- │ Phase 3: Best Practices → 最佳实践审查 │
28
- │ Review - 代码质量检查 │
29
- │ ↓ - 性能优化建议 │
30
- │ - 可维护性评估 │
31
- │ │
32
- │ Phase 4: Report → 生成审查报告 │
33
- │ Generation - 按严重程度分类问题 │
34
- │ - 提供修复建议和示例 │
35
- │ - 生成可追踪的修复清单 │
36
- │ │
37
- └─────────────────────────────────────────────────────────────────┘
38
- ```
39
-
40
- ## Features
41
-
42
- ### Security Analysis
43
-
44
- - **OWASP Top 10 Coverage**
45
- - Injection vulnerabilities (SQL, Command, LDAP)
46
- - Authentication & authorization bypass
47
- - Sensitive data exposure
48
- - XML External Entities (XXE)
49
- - Broken access control
50
- - Security misconfiguration
51
- - Cross-Site Scripting (XSS)
52
- - Insecure deserialization
53
- - Components with known vulnerabilities
54
- - Insufficient logging & monitoring
55
-
56
- - **Language-Specific Checks**
57
- - JavaScript/TypeScript: prototype pollution, eval usage
58
- - Python: pickle vulnerabilities, command injection
59
- - Java: deserialization, path traversal
60
- - Go: race conditions, memory leaks
61
-
62
- ### Best Practices Review
63
-
64
- - **Code Quality**
65
- - Naming conventions
66
- - Function complexity (cyclomatic complexity)
67
- - Code duplication
68
- - Dead code detection
69
-
70
- - **Performance**
71
- - N+1 queries
72
- - Inefficient algorithms
73
- - Memory leaks
74
- - Resource cleanup
75
-
76
- - **Maintainability**
77
- - Documentation quality
78
- - Test coverage
79
- - Error handling patterns
80
- - Dependency management
81
-
82
- ## Usage
83
-
84
- ### Basic Review
85
-
86
- ```bash
87
- # Review entire codebase
88
- /code-reviewer
89
-
90
- # Review specific directory
91
- /code-reviewer --scope src/auth
92
-
93
- # Focus on security only
94
- /code-reviewer --focus security
95
-
96
- # Focus on best practices only
97
- /code-reviewer --focus best-practices
98
- ```
99
-
100
- ### Advanced Options
101
-
102
- ```bash
103
- # Review with custom severity threshold
104
- /code-reviewer --severity critical,high
105
-
106
- # Review specific file types
107
- /code-reviewer --languages typescript,python
108
-
109
- # Generate detailed report with code snippets
110
- /code-reviewer --report-level detailed
111
-
112
- # Resume from previous session
113
- /code-reviewer --resume
114
- ```
115
-
116
- ## Configuration
117
-
118
- Create `.code-reviewer.json` in project root:
119
-
120
- ```json
121
- {
122
- "scope": {
123
- "include": ["src/**/*", "lib/**/*"],
124
- "exclude": ["**/*.test.ts", "**/*.spec.ts", "**/node_modules/**"]
125
- },
126
- "security": {
127
- "enabled": true,
128
- "checks": ["owasp-top-10", "cwe-top-25"],
129
- "severity_threshold": "medium"
130
- },
131
- "best_practices": {
132
- "enabled": true,
133
- "code_quality": true,
134
- "performance": true,
135
- "maintainability": true
136
- },
137
- "reporting": {
138
- "format": "markdown",
139
- "output_path": ".code-review/",
140
- "include_snippets": true,
141
- "include_fixes": true
142
- }
143
- }
144
- ```
145
-
146
- ## Output
147
-
148
- ### Review Report Structure
149
-
150
- ```markdown
151
- # Code Review Report
152
-
153
- ## Executive Summary
154
- - Total Issues: 42
155
- - Critical: 3
156
- - High: 8
157
- - Medium: 15
158
- - Low: 16
159
-
160
- ## Security Findings
161
-
162
- ### [CRITICAL] SQL Injection in User Query
163
- **File**: src/auth/user-service.ts:145
164
- **Issue**: Unsanitized user input in SQL query
165
- **Fix**: Use parameterized queries
166
-
167
- Code Snippet:
168
- \`\`\`typescript
169
- // ❌ Vulnerable
170
- const query = `SELECT * FROM users WHERE username = '${username}'`;
171
-
172
- // ✅ Fixed
173
- const query = 'SELECT * FROM users WHERE username = ?';
174
- db.execute(query, [username]);
175
- \`\`\`
176
-
177
- ## Best Practices Findings
178
-
179
- ### [MEDIUM] High Cyclomatic Complexity
180
- **File**: src/utils/validator.ts:78
181
- **Issue**: Function has complexity score of 15 (threshold: 10)
182
- **Fix**: Break into smaller functions
183
-
184
- ...
185
- ```
186
-
187
- ## Phase Documentation
188
-
189
- | Phase | Description | Output |
190
- |-------|-------------|--------|
191
- | [01-code-discovery.md](phases/01-code-discovery.md) | Discover and categorize code files | File inventory with metadata |
192
- | [02-security-analysis.md](phases/02-security-analysis.md) | Analyze security vulnerabilities | Security findings list |
193
- | [03-best-practices-review.md](phases/03-best-practices-review.md) | Review code quality and practices | Best practices findings |
194
- | [04-report-generation.md](phases/04-report-generation.md) | Generate comprehensive report | Markdown report |
195
-
196
- ## Specifications
197
-
198
- - [specs/security-requirements.md](specs/security-requirements.md) - Security check specifications
199
- - [specs/best-practices-requirements.md](specs/best-practices-requirements.md) - Best practices standards
200
- - [specs/quality-standards.md](specs/quality-standards.md) - Overall quality standards
201
- - [specs/severity-classification.md](specs/severity-classification.md) - Issue severity criteria
202
-
203
- ## Templates
204
-
205
- - [templates/security-finding.md](templates/security-finding.md) - Security finding template
206
- - [templates/best-practice-finding.md](templates/best-practice-finding.md) - Best practice finding template
207
- - [templates/report-template.md](templates/report-template.md) - Final report template
208
-
209
- ## Integration with Development Workflow
210
-
211
- ### Pre-commit Hook
212
-
213
- ```bash
214
- #!/bin/bash
215
- # .git/hooks/pre-commit
216
-
217
- # Run code review on staged files
218
- staged_files=$(git diff --cached --name-only --diff-filter=ACMR)
219
- ccw run code-reviewer --scope "$staged_files" --severity critical,high
220
-
221
- if [ $? -ne 0 ]; then
222
- echo "❌ Code review found critical/high issues. Commit aborted."
223
- exit 1
224
- fi
225
- ```
226
-
227
- ### CI/CD Integration
228
-
229
- ```yaml
230
- # .github/workflows/code-review.yml
231
- name: Code Review
232
- on: [pull_request]
233
-
234
- jobs:
235
- review:
236
- runs-on: ubuntu-latest
237
- steps:
238
- - uses: actions/checkout@v3
239
- - name: Run Code Review
240
- run: |
241
- ccw run code-reviewer --report-level detailed
242
- ccw report upload .code-review/report.md
243
- ```
244
-
245
- ## Examples
246
-
247
- ### Example 1: Security-Focused Review
248
-
249
- ```bash
250
- # Review authentication module for security issues
251
- /code-reviewer --scope src/auth --focus security --severity critical,high
252
- ```
253
-
254
- ### Example 2: Performance Review
255
-
256
- ```bash
257
- # Review API endpoints for performance issues
258
- /code-reviewer --scope src/api --focus best-practices --check performance
259
- ```
260
-
261
- ### Example 3: Full Project Audit
262
-
263
- ```bash
264
- # Comprehensive review of entire codebase
265
- /code-reviewer --report-level detailed --output .code-review/audit-2024-01.md
266
- ```
267
-
268
- ## Troubleshooting
269
-
270
- ### Large Codebase
271
-
272
- If review takes too long:
273
- ```bash
274
- # Review in batches
275
- /code-reviewer --scope src/module-1
276
- /code-reviewer --scope src/module-2 --resume
277
-
278
- # Or use parallel execution
279
- /code-reviewer --parallel 4
280
- ```
281
-
282
- ### False Positives
283
-
284
- Configure suppressions in `.code-reviewer.json`:
285
- ```json
286
- {
287
- "suppressions": {
288
- "security": {
289
- "sql-injection": {
290
- "paths": ["src/legacy/**/*"],
291
- "reason": "Legacy code, scheduled for refactor"
292
- }
293
- }
294
- }
295
- }
296
- ```
297
-
298
- ## Roadmap
299
-
300
- - [ ] AI-powered vulnerability detection
301
- - [ ] Integration with popular security scanners (Snyk, SonarQube)
302
- - [ ] Automated fix suggestions with diffs
303
- - [ ] IDE plugins for real-time feedback
304
- - [ ] Custom rule engine for organization-specific policies
305
-
306
- ## License
307
-
308
- MIT License - See LICENSE file for details
@@ -1,246 +0,0 @@
1
- # Phase 1: Code Discovery & Scoping
2
-
3
- ## Objective
4
-
5
- Discover and categorize all code files within the specified scope, preparing them for security analysis and best practices review.
6
-
7
- ## Input
8
-
9
- - **User Arguments**:
10
- - `--scope`: Directory or file patterns (default: entire project)
11
- - `--languages`: Specific languages to review (e.g., typescript, python, java)
12
- - `--exclude`: Patterns to exclude (e.g., test files, node_modules)
13
-
14
- - **Configuration**: `.code-reviewer.json` (if exists)
15
-
16
- ## Process
17
-
18
- ### Step 1: Load Configuration
19
-
20
- ```javascript
21
- // Check for project-level configuration
22
- const configPath = path.join(projectRoot, '.code-reviewer.json');
23
- const config = fileExists(configPath)
24
- ? JSON.parse(readFile(configPath))
25
- : getDefaultConfig();
26
-
27
- // Merge user arguments with config
28
- const scope = args.scope || config.scope.include;
29
- const exclude = args.exclude || config.scope.exclude;
30
- const languages = args.languages || config.languages || 'auto';
31
- ```
32
-
33
- ### Step 2: Discover Files
34
-
35
- Use MCP tools for efficient file discovery:
36
-
37
- ```javascript
38
- // Use smart_search for file discovery
39
- const files = await mcp__ccw_tools__smart_search({
40
- action: "find_files",
41
- pattern: scope,
42
- includeHidden: false
43
- });
44
-
45
- // Apply exclusion patterns
46
- const filteredFiles = files.filter(file => {
47
- return !exclude.some(pattern => minimatch(file, pattern));
48
- });
49
- ```
50
-
51
- ### Step 3: Categorize Files
52
-
53
- Categorize files by:
54
- - **Language/Framework**: TypeScript, Python, Java, Go, etc.
55
- - **File Type**: Source, config, test, build
56
- - **Priority**: Critical (auth, payment), High (API), Medium (utils), Low (docs)
57
-
58
- ```javascript
59
- const inventory = {
60
- critical: {
61
- auth: ['src/auth/login.ts', 'src/auth/jwt.ts'],
62
- payment: ['src/payment/stripe.ts'],
63
- },
64
- high: {
65
- api: ['src/api/users.ts', 'src/api/orders.ts'],
66
- database: ['src/db/queries.ts'],
67
- },
68
- medium: {
69
- utils: ['src/utils/validator.ts'],
70
- services: ['src/services/*.ts'],
71
- },
72
- low: {
73
- types: ['src/types/*.ts'],
74
- }
75
- };
76
- ```
77
-
78
- ### Step 4: Extract Metadata
79
-
80
- For each file, extract:
81
- - **Lines of Code (LOC)**
82
- - **Complexity Indicators**: Function count, class count
83
- - **Dependencies**: Import statements
84
- - **Framework Detection**: Express, React, Django, etc.
85
-
86
- ```javascript
87
- const metadata = files.map(file => ({
88
- path: file,
89
- language: detectLanguage(file),
90
- loc: countLines(file),
91
- complexity: estimateComplexity(file),
92
- framework: detectFramework(file),
93
- priority: categorizePriority(file)
94
- }));
95
- ```
96
-
97
- ## Output
98
-
99
- ### File Inventory
100
-
101
- Save to `.code-review/inventory.json`:
102
-
103
- ```json
104
- {
105
- "scan_date": "2024-01-15T10:30:00Z",
106
- "total_files": 247,
107
- "by_language": {
108
- "typescript": 185,
109
- "python": 42,
110
- "javascript": 15,
111
- "go": 5
112
- },
113
- "by_priority": {
114
- "critical": 12,
115
- "high": 45,
116
- "medium": 120,
117
- "low": 70
118
- },
119
- "files": [
120
- {
121
- "path": "src/auth/login.ts",
122
- "language": "typescript",
123
- "loc": 245,
124
- "functions": 8,
125
- "classes": 2,
126
- "priority": "critical",
127
- "framework": "express",
128
- "dependencies": ["bcrypt", "jsonwebtoken", "express"]
129
- }
130
- ]
131
- }
132
- ```
133
-
134
- ### Summary Report
135
-
136
- ```markdown
137
- ## Code Discovery Summary
138
-
139
- **Scope**: src/**/*
140
- **Total Files**: 247
141
- **Languages**: TypeScript (75%), Python (17%), JavaScript (6%), Go (2%)
142
-
143
- ### Priority Distribution
144
- - Critical: 12 files (authentication, payment processing)
145
- - High: 45 files (API endpoints, database queries)
146
- - Medium: 120 files (utilities, services)
147
- - Low: 70 files (types, configs)
148
-
149
- ### Key Areas Identified
150
- 1. **Authentication Module** (src/auth/) - 12 files, 2,400 LOC
151
- 2. **Payment Processing** (src/payment/) - 5 files, 1,200 LOC
152
- 3. **API Layer** (src/api/) - 35 files, 5,600 LOC
153
- 4. **Database Layer** (src/db/) - 8 files, 1,800 LOC
154
-
155
- **Next Phase**: Security Analysis on Critical + High priority files
156
- ```
157
-
158
- ## State Management
159
-
160
- Save phase state for potential resume:
161
-
162
- ```json
163
- {
164
- "phase": "01-code-discovery",
165
- "status": "completed",
166
- "timestamp": "2024-01-15T10:35:00Z",
167
- "output": {
168
- "inventory_path": ".code-review/inventory.json",
169
- "total_files": 247,
170
- "critical_files": 12,
171
- "high_files": 45
172
- }
173
- }
174
- ```
175
-
176
- ## Agent Instructions
177
-
178
- ```markdown
179
- You are in Phase 1 of the Code Review workflow. Your task is to discover and categorize code files.
180
-
181
- **Instructions**:
182
- 1. Use mcp__ccw_tools__smart_search with action="find_files" to discover files
183
- 2. Apply exclusion patterns from config or arguments
184
- 3. Categorize files by language, type, and priority
185
- 4. Extract basic metadata (LOC, complexity indicators)
186
- 5. Save inventory to .code-review/inventory.json
187
- 6. Generate summary report
188
- 7. Proceed to Phase 2 with critical + high priority files
189
-
190
- **Tools Available**:
191
- - mcp__ccw_tools__smart_search (file discovery)
192
- - Read (read configuration and sample files)
193
- - Write (save inventory and reports)
194
-
195
- **Output Requirements**:
196
- - inventory.json with complete file list and metadata
197
- - Summary markdown report
198
- - State file for phase tracking
199
- ```
200
-
201
- ## Error Handling
202
-
203
- ### No Files Found
204
-
205
- ```javascript
206
- if (filteredFiles.length === 0) {
207
- throw new Error(`No files found matching scope: ${scope}
208
-
209
- Suggestions:
210
- - Check if scope pattern is correct
211
- - Verify exclude patterns are not too broad
212
- - Ensure project has code files in specified scope
213
- `);
214
- }
215
- ```
216
-
217
- ### Large Codebase
218
-
219
- ```javascript
220
- if (filteredFiles.length > 1000) {
221
- console.warn(`⚠️ Large codebase detected (${filteredFiles.length} files)`);
222
- console.log(`Consider using --scope to review in batches`);
223
-
224
- // Offer to focus on critical/high priority only
225
- const answer = await askUser("Review critical/high priority files only?");
226
- if (answer === 'yes') {
227
- filteredFiles = filteredFiles.filter(f =>
228
- f.priority === 'critical' || f.priority === 'high'
229
- );
230
- }
231
- }
232
- ```
233
-
234
- ## Validation
235
-
236
- Before proceeding to Phase 2:
237
-
238
- - ✅ Inventory file created
239
- - ✅ At least one file categorized as critical or high priority
240
- - ✅ Metadata extracted for all files
241
- - ✅ Summary report generated
242
- - ✅ State saved for resume capability
243
-
244
- ## Next Phase
245
-
246
- **Phase 2: Security Analysis** - Analyze critical and high priority files for security vulnerabilities using OWASP Top 10 and CWE Top 25 checks.