claude-code-workflow 6.3.23 → 6.3.25
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/skills/review-code/SKILL.md +170 -0
- package/.claude/skills/review-code/phases/actions/action-collect-context.md +139 -0
- package/.claude/skills/review-code/phases/actions/action-complete.md +115 -0
- package/.claude/skills/review-code/phases/actions/action-deep-review.md +302 -0
- package/.claude/skills/review-code/phases/actions/action-generate-report.md +263 -0
- package/.claude/skills/review-code/phases/actions/action-quick-scan.md +164 -0
- package/.claude/skills/review-code/phases/orchestrator.md +251 -0
- package/.claude/skills/review-code/phases/state-manager.md +752 -0
- package/.claude/skills/review-code/phases/state-schema.md +174 -0
- package/.claude/skills/review-code/specs/issue-classification.md +228 -0
- package/.claude/skills/review-code/specs/quality-standards.md +214 -0
- package/.claude/skills/review-code/specs/review-dimensions.md +337 -0
- package/.claude/skills/review-code/specs/rules/architecture-rules.json +63 -0
- package/.claude/skills/review-code/specs/rules/correctness-rules.json +60 -0
- package/.claude/skills/review-code/specs/rules/index.md +140 -0
- package/.claude/skills/review-code/specs/rules/performance-rules.json +59 -0
- package/.claude/skills/review-code/specs/rules/readability-rules.json +60 -0
- package/.claude/skills/review-code/specs/rules/security-rules.json +58 -0
- package/.claude/skills/review-code/specs/rules/testing-rules.json +59 -0
- package/.claude/skills/review-code/templates/issue-template.md +186 -0
- package/.claude/skills/review-code/templates/review-report.md +173 -0
- package/.claude/skills/skill-generator/SKILL.md +56 -17
- package/.claude/skills/skill-generator/templates/autonomous-orchestrator.md +10 -0
- package/.claude/skills/skill-generator/templates/sequential-phase.md +9 -0
- package/.claude/skills/skill-generator/templates/skill-md.md +84 -5
- package/.claude/skills/text-formatter/SKILL.md +196 -0
- package/.claude/skills/text-formatter/phases/01-input-collection.md +111 -0
- package/.claude/skills/text-formatter/phases/02-content-analysis.md +248 -0
- package/.claude/skills/text-formatter/phases/03-format-transform.md +245 -0
- package/.claude/skills/text-formatter/phases/04-output-preview.md +183 -0
- package/.claude/skills/text-formatter/specs/callout-types.md +293 -0
- package/.claude/skills/text-formatter/specs/element-mapping.md +226 -0
- package/.claude/skills/text-formatter/specs/format-rules.md +273 -0
- package/.claude/skills/text-formatter/templates/bbcode-template.md +350 -0
- package/package.json +91 -91
- package/.claude/skills/code-reviewer/README.md +0 -340
- package/.claude/skills/code-reviewer/SKILL.md +0 -308
- package/.claude/skills/code-reviewer/phases/01-code-discovery.md +0 -246
- package/.claude/skills/code-reviewer/phases/02-security-analysis.md +0 -442
- package/.claude/skills/code-reviewer/phases/03-best-practices-review.md +0 -36
- package/.claude/skills/code-reviewer/phases/04-report-generation.md +0 -278
- package/.claude/skills/code-reviewer/specs/best-practices-requirements.md +0 -346
- package/.claude/skills/code-reviewer/specs/quality-standards.md +0 -252
- package/.claude/skills/code-reviewer/specs/security-requirements.md +0 -243
- package/.claude/skills/code-reviewer/templates/best-practice-finding.md +0 -234
- package/.claude/skills/code-reviewer/templates/report-template.md +0 -316
- package/.claude/skills/code-reviewer/templates/security-finding.md +0 -161
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
# Code Reviewer Skill
|
|
2
|
-
|
|
3
|
-
A comprehensive code review skill for identifying security vulnerabilities and best practices violations.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The **code-reviewer** skill provides automated code review capabilities covering:
|
|
8
|
-
- **Security Analysis**: OWASP Top 10, CWE Top 25, language-specific vulnerabilities
|
|
9
|
-
- **Code Quality**: Naming conventions, complexity, duplication, dead code
|
|
10
|
-
- **Performance**: N+1 queries, inefficient algorithms, memory leaks
|
|
11
|
-
- **Maintainability**: Documentation, test coverage, dependency health
|
|
12
|
-
|
|
13
|
-
## Quick Start
|
|
14
|
-
|
|
15
|
-
### Basic Usage
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
# Review entire codebase
|
|
19
|
-
/code-reviewer
|
|
20
|
-
|
|
21
|
-
# Review specific directory
|
|
22
|
-
/code-reviewer --scope src/auth
|
|
23
|
-
|
|
24
|
-
# Focus on security only
|
|
25
|
-
/code-reviewer --focus security
|
|
26
|
-
|
|
27
|
-
# Focus on best practices only
|
|
28
|
-
/code-reviewer --focus best-practices
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
### Advanced Options
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Review with custom severity threshold
|
|
35
|
-
/code-reviewer --severity critical,high
|
|
36
|
-
|
|
37
|
-
# Review specific file types
|
|
38
|
-
/code-reviewer --languages typescript,python
|
|
39
|
-
|
|
40
|
-
# Generate detailed report
|
|
41
|
-
/code-reviewer --report-level detailed
|
|
42
|
-
|
|
43
|
-
# Resume from previous session
|
|
44
|
-
/code-reviewer --resume
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Features
|
|
48
|
-
|
|
49
|
-
### Security Analysis
|
|
50
|
-
|
|
51
|
-
✅ **OWASP Top 10 2021 Coverage**
|
|
52
|
-
- Injection vulnerabilities (SQL, Command, XSS)
|
|
53
|
-
- Authentication & authorization flaws
|
|
54
|
-
- Sensitive data exposure
|
|
55
|
-
- Security misconfiguration
|
|
56
|
-
- And more...
|
|
57
|
-
|
|
58
|
-
✅ **CWE Top 25 Coverage**
|
|
59
|
-
- Cross-site scripting (CWE-79)
|
|
60
|
-
- SQL injection (CWE-89)
|
|
61
|
-
- Command injection (CWE-78)
|
|
62
|
-
- Input validation (CWE-20)
|
|
63
|
-
- And more...
|
|
64
|
-
|
|
65
|
-
✅ **Language-Specific Checks**
|
|
66
|
-
- JavaScript/TypeScript: prototype pollution, eval usage
|
|
67
|
-
- Python: pickle vulnerabilities, command injection
|
|
68
|
-
- Java: deserialization, XXE
|
|
69
|
-
- Go: race conditions, memory leaks
|
|
70
|
-
|
|
71
|
-
### Best Practices Review
|
|
72
|
-
|
|
73
|
-
✅ **Code Quality**
|
|
74
|
-
- Naming convention compliance
|
|
75
|
-
- Cyclomatic complexity analysis
|
|
76
|
-
- Code duplication detection
|
|
77
|
-
- Dead code identification
|
|
78
|
-
|
|
79
|
-
✅ **Performance**
|
|
80
|
-
- N+1 query detection
|
|
81
|
-
- Inefficient algorithm patterns
|
|
82
|
-
- Memory leak detection
|
|
83
|
-
- Resource cleanup verification
|
|
84
|
-
|
|
85
|
-
✅ **Maintainability**
|
|
86
|
-
- Documentation coverage
|
|
87
|
-
- Test coverage analysis
|
|
88
|
-
- Dependency health check
|
|
89
|
-
- Error handling review
|
|
90
|
-
|
|
91
|
-
## Output
|
|
92
|
-
|
|
93
|
-
The skill generates comprehensive reports in `.code-review/` directory:
|
|
94
|
-
|
|
95
|
-
```
|
|
96
|
-
.code-review/
|
|
97
|
-
├── inventory.json # File inventory with metadata
|
|
98
|
-
├── security-findings.json # Security vulnerabilities
|
|
99
|
-
├── best-practices-findings.json # Best practices violations
|
|
100
|
-
├── summary.json # Summary statistics
|
|
101
|
-
├── REPORT.md # Comprehensive markdown report
|
|
102
|
-
└── FIX-CHECKLIST.md # Actionable fix checklist
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
### Report Contents
|
|
106
|
-
|
|
107
|
-
**REPORT.md** includes:
|
|
108
|
-
- Executive summary with risk assessment
|
|
109
|
-
- Quality scores (Security, Code Quality, Performance, Maintainability)
|
|
110
|
-
- Detailed findings organized by severity
|
|
111
|
-
- Code examples with fix recommendations
|
|
112
|
-
- Action plan prioritized by urgency
|
|
113
|
-
- Compliance status (PCI DSS, HIPAA, GDPR, SOC 2)
|
|
114
|
-
|
|
115
|
-
**FIX-CHECKLIST.md** provides:
|
|
116
|
-
- Checklist format for tracking fixes
|
|
117
|
-
- Organized by severity (Critical → Low)
|
|
118
|
-
- Effort estimates for each issue
|
|
119
|
-
- Priority assignments
|
|
120
|
-
|
|
121
|
-
## Configuration
|
|
122
|
-
|
|
123
|
-
Create `.code-reviewer.json` in project root:
|
|
124
|
-
|
|
125
|
-
```json
|
|
126
|
-
{
|
|
127
|
-
"scope": {
|
|
128
|
-
"include": ["src/**/*", "lib/**/*"],
|
|
129
|
-
"exclude": ["**/*.test.ts", "**/*.spec.ts", "**/node_modules/**"]
|
|
130
|
-
},
|
|
131
|
-
"security": {
|
|
132
|
-
"enabled": true,
|
|
133
|
-
"checks": ["owasp-top-10", "cwe-top-25"],
|
|
134
|
-
"severity_threshold": "medium"
|
|
135
|
-
},
|
|
136
|
-
"best_practices": {
|
|
137
|
-
"enabled": true,
|
|
138
|
-
"code_quality": true,
|
|
139
|
-
"performance": true,
|
|
140
|
-
"maintainability": true
|
|
141
|
-
},
|
|
142
|
-
"reporting": {
|
|
143
|
-
"format": "markdown",
|
|
144
|
-
"output_path": ".code-review/",
|
|
145
|
-
"include_snippets": true,
|
|
146
|
-
"include_fixes": true
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
## Workflow
|
|
152
|
-
|
|
153
|
-
### Phase 1: Code Discovery
|
|
154
|
-
- Discover and categorize code files
|
|
155
|
-
- Extract metadata (LOC, complexity, framework)
|
|
156
|
-
- Prioritize files (Critical, High, Medium, Low)
|
|
157
|
-
|
|
158
|
-
### Phase 2: Security Analysis
|
|
159
|
-
- Scan for OWASP Top 10 vulnerabilities
|
|
160
|
-
- Check CWE Top 25 weaknesses
|
|
161
|
-
- Apply language-specific security patterns
|
|
162
|
-
- Generate security findings
|
|
163
|
-
|
|
164
|
-
### Phase 3: Best Practices Review
|
|
165
|
-
- Analyze code quality issues
|
|
166
|
-
- Detect performance problems
|
|
167
|
-
- Assess maintainability concerns
|
|
168
|
-
- Generate best practices findings
|
|
169
|
-
|
|
170
|
-
### Phase 4: Report Generation
|
|
171
|
-
- Consolidate all findings
|
|
172
|
-
- Calculate quality scores
|
|
173
|
-
- Generate comprehensive reports
|
|
174
|
-
- Create actionable checklists
|
|
175
|
-
|
|
176
|
-
## Integration
|
|
177
|
-
|
|
178
|
-
### Pre-commit Hook
|
|
179
|
-
|
|
180
|
-
Block commits with critical/high issues:
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
#!/bin/bash
|
|
184
|
-
# .git/hooks/pre-commit
|
|
185
|
-
|
|
186
|
-
staged_files=$(git diff --cached --name-only --diff-filter=ACMR)
|
|
187
|
-
ccw run code-reviewer --scope "$staged_files" --severity critical,high
|
|
188
|
-
|
|
189
|
-
if [ $? -ne 0 ]; then
|
|
190
|
-
echo "❌ Code review found critical/high issues. Commit aborted."
|
|
191
|
-
exit 1
|
|
192
|
-
fi
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
### CI/CD Integration
|
|
196
|
-
|
|
197
|
-
```yaml
|
|
198
|
-
# .github/workflows/code-review.yml
|
|
199
|
-
name: Code Review
|
|
200
|
-
on: [pull_request]
|
|
201
|
-
|
|
202
|
-
jobs:
|
|
203
|
-
review:
|
|
204
|
-
runs-on: ubuntu-latest
|
|
205
|
-
steps:
|
|
206
|
-
- uses: actions/checkout@v3
|
|
207
|
-
- name: Run Code Review
|
|
208
|
-
run: |
|
|
209
|
-
ccw run code-reviewer --report-level detailed
|
|
210
|
-
ccw report upload .code-review/report.md
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
## Examples
|
|
214
|
-
|
|
215
|
-
### Example 1: Security-Focused Review
|
|
216
|
-
|
|
217
|
-
```bash
|
|
218
|
-
# Review authentication module for security issues
|
|
219
|
-
/code-reviewer --scope src/auth --focus security --severity critical,high
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
**Output**: Security findings with OWASP/CWE mappings and fix recommendations
|
|
223
|
-
|
|
224
|
-
### Example 2: Performance Review
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
# Review API endpoints for performance issues
|
|
228
|
-
/code-reviewer --scope src/api --focus best-practices --check performance
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
**Output**: N+1 queries, inefficient algorithms, memory leak detections
|
|
232
|
-
|
|
233
|
-
### Example 3: Full Project Audit
|
|
234
|
-
|
|
235
|
-
```bash
|
|
236
|
-
# Comprehensive review of entire codebase
|
|
237
|
-
/code-reviewer --report-level detailed --output .code-review/audit-2024-01.md
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
**Output**: Complete audit with all findings, scores, and action plan
|
|
241
|
-
|
|
242
|
-
## Compliance Support
|
|
243
|
-
|
|
244
|
-
The skill maps findings to compliance requirements:
|
|
245
|
-
|
|
246
|
-
- **PCI DSS**: Requirement 6.5 (Common coding vulnerabilities)
|
|
247
|
-
- **HIPAA**: Technical safeguards and access controls
|
|
248
|
-
- **GDPR**: Article 32 (Security of processing)
|
|
249
|
-
- **SOC 2**: Security controls and monitoring
|
|
250
|
-
|
|
251
|
-
## Architecture
|
|
252
|
-
|
|
253
|
-
### Execution Mode
|
|
254
|
-
**Sequential** - Fixed phase order for systematic review:
|
|
255
|
-
1. Code Discovery → 2. Security Analysis → 3. Best Practices → 4. Report Generation
|
|
256
|
-
|
|
257
|
-
### Tools Used
|
|
258
|
-
- `mcp__ace-tool__search_context` - Semantic code search
|
|
259
|
-
- `mcp__ccw-tools__smart_search` - Pattern matching
|
|
260
|
-
- `Read` - File content access
|
|
261
|
-
- `Write` - Report generation
|
|
262
|
-
|
|
263
|
-
## Quality Standards
|
|
264
|
-
|
|
265
|
-
### Scoring System
|
|
266
|
-
|
|
267
|
-
```
|
|
268
|
-
Overall Score = (
|
|
269
|
-
Security Score × 0.4 +
|
|
270
|
-
Code Quality Score × 0.25 +
|
|
271
|
-
Performance Score × 0.2 +
|
|
272
|
-
Maintainability Score × 0.15
|
|
273
|
-
)
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Score Ranges
|
|
277
|
-
- **A (90-100)**: Excellent - Production ready
|
|
278
|
-
- **B (80-89)**: Good - Minor improvements needed
|
|
279
|
-
- **C (70-79)**: Acceptable - Some issues to address
|
|
280
|
-
- **D (60-69)**: Poor - Significant improvements required
|
|
281
|
-
- **F (0-59)**: Failing - Major issues, not production ready
|
|
282
|
-
|
|
283
|
-
## Troubleshooting
|
|
284
|
-
|
|
285
|
-
### Large Codebase
|
|
286
|
-
|
|
287
|
-
If review takes too long:
|
|
288
|
-
```bash
|
|
289
|
-
# Review in batches
|
|
290
|
-
/code-reviewer --scope src/module-1
|
|
291
|
-
/code-reviewer --scope src/module-2 --resume
|
|
292
|
-
|
|
293
|
-
# Or use parallel execution
|
|
294
|
-
/code-reviewer --parallel 4
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
### False Positives
|
|
298
|
-
|
|
299
|
-
Configure suppressions in `.code-reviewer.json`:
|
|
300
|
-
```json
|
|
301
|
-
{
|
|
302
|
-
"suppressions": {
|
|
303
|
-
"security": {
|
|
304
|
-
"sql-injection": {
|
|
305
|
-
"paths": ["src/legacy/**/*"],
|
|
306
|
-
"reason": "Legacy code, scheduled for refactor"
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
```
|
|
312
|
-
|
|
313
|
-
## File Structure
|
|
314
|
-
|
|
315
|
-
```
|
|
316
|
-
.claude/skills/code-reviewer/
|
|
317
|
-
├── SKILL.md # Main skill documentation
|
|
318
|
-
├── README.md # This file
|
|
319
|
-
├── phases/
|
|
320
|
-
│ ├── 01-code-discovery.md
|
|
321
|
-
│ ├── 02-security-analysis.md
|
|
322
|
-
│ ├── 03-best-practices-review.md
|
|
323
|
-
│ └── 04-report-generation.md
|
|
324
|
-
├── specs/
|
|
325
|
-
│ ├── security-requirements.md
|
|
326
|
-
│ ├── best-practices-requirements.md
|
|
327
|
-
│ └── quality-standards.md
|
|
328
|
-
└── templates/
|
|
329
|
-
├── security-finding.md
|
|
330
|
-
├── best-practice-finding.md
|
|
331
|
-
└── report-template.md
|
|
332
|
-
```
|
|
333
|
-
|
|
334
|
-
## Version
|
|
335
|
-
|
|
336
|
-
**v1.0.0** - Initial release
|
|
337
|
-
|
|
338
|
-
## License
|
|
339
|
-
|
|
340
|
-
MIT License
|
|
@@ -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
|