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,442 +0,0 @@
1
- # Phase 2: Security Analysis
2
-
3
- ## Objective
4
-
5
- Analyze code files for security vulnerabilities based on OWASP Top 10, CWE Top 25, and language-specific security patterns.
6
-
7
- ## Input
8
-
9
- - **File Inventory**: From Phase 1 (`.code-review/inventory.json`)
10
- - **Priority Focus**: Critical and High priority files (unless `--scope all`)
11
- - **User Arguments**:
12
- - `--focus security`: Security-only mode
13
- - `--severity critical,high,medium,low`: Minimum severity to report
14
- - `--checks`: Specific security checks to run (e.g., sql-injection, xss)
15
-
16
- ## Process
17
-
18
- ### Step 1: Load Security Rules
19
-
20
- ```javascript
21
- // Load security check definitions
22
- const securityRules = {
23
- owasp_top_10: [
24
- 'injection',
25
- 'broken_authentication',
26
- 'sensitive_data_exposure',
27
- 'xxe',
28
- 'broken_access_control',
29
- 'security_misconfiguration',
30
- 'xss',
31
- 'insecure_deserialization',
32
- 'vulnerable_components',
33
- 'insufficient_logging'
34
- ],
35
- cwe_top_25: [
36
- 'cwe-79', // XSS
37
- 'cwe-89', // SQL Injection
38
- 'cwe-20', // Improper Input Validation
39
- 'cwe-78', // OS Command Injection
40
- 'cwe-190', // Integer Overflow
41
- // ... more CWE checks
42
- ]
43
- };
44
-
45
- // Load language-specific rules
46
- const languageRules = {
47
- typescript: require('./rules/typescript-security.json'),
48
- python: require('./rules/python-security.json'),
49
- java: require('./rules/java-security.json'),
50
- go: require('./rules/go-security.json'),
51
- };
52
- ```
53
-
54
- ### Step 2: Analyze Files for Vulnerabilities
55
-
56
- For each file in the inventory, perform security analysis:
57
-
58
- ```javascript
59
- const findings = [];
60
-
61
- for (const file of inventory.files) {
62
- if (file.priority !== 'critical' && file.priority !== 'high') continue;
63
-
64
- // Read file content
65
- const content = await Read({ file_path: file.path });
66
-
67
- // Run security checks
68
- const fileFindings = await runSecurityChecks(content, file, {
69
- rules: securityRules,
70
- languageRules: languageRules[file.language],
71
- severity: args.severity || 'medium'
72
- });
73
-
74
- findings.push(...fileFindings);
75
- }
76
- ```
77
-
78
- ### Step 3: Security Check Patterns
79
-
80
- #### A. Injection Vulnerabilities
81
-
82
- **SQL Injection**:
83
- ```javascript
84
- // Pattern: String concatenation in SQL queries
85
- const sqlInjectionPatterns = [
86
- /\$\{.*\}.*SELECT/, // Template literal with SELECT
87
- /"SELECT.*\+\s*\w+/, // String concatenation
88
- /execute\([`'"].*\$\{.*\}.*[`'"]\)/, // Parameterized query bypass
89
- /query\(.*\+.*\)/, // Query concatenation
90
- ];
91
-
92
- // Check code
93
- for (const pattern of sqlInjectionPatterns) {
94
- const matches = content.matchAll(new RegExp(pattern, 'g'));
95
- for (const match of matches) {
96
- findings.push({
97
- type: 'sql-injection',
98
- severity: 'critical',
99
- line: getLineNumber(content, match.index),
100
- code: match[0],
101
- file: file.path,
102
- message: 'Potential SQL injection vulnerability',
103
- recommendation: 'Use parameterized queries or ORM methods',
104
- cwe: 'CWE-89',
105
- owasp: 'A03:2021 - Injection'
106
- });
107
- }
108
- }
109
- ```
110
-
111
- **Command Injection**:
112
- ```javascript
113
- // Pattern: Unsanitized input in exec/spawn
114
- const commandInjectionPatterns = [
115
- /exec\(.*\$\{.*\}/, // exec with template literal
116
- /spawn\(.*,\s*\[.*\$\{.*\}.*\]\)/, // spawn with unsanitized args
117
- /execSync\(.*\+.*\)/, // execSync with concatenation
118
- ];
119
- ```
120
-
121
- **XSS (Cross-Site Scripting)**:
122
- ```javascript
123
- // Pattern: Unsanitized user input in DOM/HTML
124
- const xssPatterns = [
125
- /innerHTML\s*=.*\$\{.*\}/, // innerHTML with template literal
126
- /dangerouslySetInnerHTML/, // React dangerous prop
127
- /document\.write\(.*\)/, // document.write
128
- /<\w+.*\$\{.*\}.*>/, // JSX with unsanitized data
129
- ];
130
- ```
131
-
132
- #### B. Authentication & Authorization
133
-
134
- ```javascript
135
- // Pattern: Weak authentication
136
- const authPatterns = [
137
- /password\s*===?\s*['"]/, // Hardcoded password comparison
138
- /jwt\.sign\(.*,\s*['"][^'"]{1,16}['"]\)/, // Weak JWT secret
139
- /bcrypt\.hash\(.*,\s*[1-9]\s*\)/, // Low bcrypt rounds
140
- /md5\(.*password.*\)/, // MD5 for passwords
141
- /if\s*\(\s*user\s*\)\s*\{/, // Missing auth check
142
- ];
143
-
144
- // Check for missing authorization
145
- const authzPatterns = [
146
- /router\.(get|post|put|delete)\(.*\)\s*=>/, // No middleware
147
- /app\.use\([^)]*\)\s*;(?!.*auth)/, // Missing auth middleware
148
- ];
149
- ```
150
-
151
- #### C. Sensitive Data Exposure
152
-
153
- ```javascript
154
- // Pattern: Sensitive data in logs/responses
155
- const sensitiveDataPatterns = [
156
- /(password|secret|token|key)\s*:/i, // Sensitive keys in objects
157
- /console\.log\(.*password.*\)/i, // Password in logs
158
- /res\.send\(.*user.*password.*\)/, // Password in response
159
- /(api_key|apikey)\s*=\s*['"]/i, // Hardcoded API keys
160
- ];
161
- ```
162
-
163
- #### D. Security Misconfiguration
164
-
165
- ```javascript
166
- // Pattern: Insecure configurations
167
- const misconfigPatterns = [
168
- /cors\(\{.*origin:\s*['"]?\*['"]?.*\}\)/, // CORS wildcard
169
- /https?\s*:\s*false/, // HTTPS disabled
170
- /helmet\(\)/, // Missing helmet config
171
- /strictMode\s*:\s*false/, // Strict mode disabled
172
- ];
173
- ```
174
-
175
- ### Step 4: Language-Specific Checks
176
-
177
- **TypeScript/JavaScript**:
178
- ```javascript
179
- const jsFindings = [
180
- checkPrototypePollution(content),
181
- checkEvalUsage(content),
182
- checkUnsafeRegex(content),
183
- checkWeakCrypto(content),
184
- ];
185
- ```
186
-
187
- **Python**:
188
- ```javascript
189
- const pythonFindings = [
190
- checkPickleVulnerabilities(content),
191
- checkYamlUnsafeLoad(content),
192
- checkSqlAlchemy(content),
193
- checkFlaskSecurityHeaders(content),
194
- ];
195
- ```
196
-
197
- **Java**:
198
- ```javascript
199
- const javaFindings = [
200
- checkDeserialization(content),
201
- checkXXE(content),
202
- checkPathTraversal(content),
203
- checkSQLInjection(content),
204
- ];
205
- ```
206
-
207
- **Go**:
208
- ```javascript
209
- const goFindings = [
210
- checkRaceConditions(content),
211
- checkSQLInjection(content),
212
- checkPathTraversal(content),
213
- checkCryptoWeakness(content),
214
- ];
215
- ```
216
-
217
- ## Output
218
-
219
- ### Security Findings File
220
-
221
- Save to `.code-review/security-findings.json`:
222
-
223
- ```json
224
- {
225
- "scan_date": "2024-01-15T11:00:00Z",
226
- "total_findings": 24,
227
- "by_severity": {
228
- "critical": 3,
229
- "high": 8,
230
- "medium": 10,
231
- "low": 3
232
- },
233
- "by_category": {
234
- "injection": 5,
235
- "authentication": 3,
236
- "data_exposure": 4,
237
- "misconfiguration": 6,
238
- "xss": 3,
239
- "other": 3
240
- },
241
- "findings": [
242
- {
243
- "id": "SEC-001",
244
- "type": "sql-injection",
245
- "severity": "critical",
246
- "file": "src/auth/user-service.ts",
247
- "line": 145,
248
- "column": 12,
249
- "code": "const query = `SELECT * FROM users WHERE username = '${username}'`;",
250
- "message": "SQL Injection vulnerability: User input directly concatenated in SQL query",
251
- "cwe": "CWE-89",
252
- "owasp": "A03:2021 - Injection",
253
- "recommendation": {
254
- "description": "Use parameterized queries to prevent SQL injection",
255
- "fix_example": "const query = 'SELECT * FROM users WHERE username = ?';\ndb.execute(query, [username]);"
256
- },
257
- "references": [
258
- "https://owasp.org/www-community/attacks/SQL_Injection",
259
- "https://cwe.mitre.org/data/definitions/89.html"
260
- ]
261
- }
262
- ]
263
- }
264
- ```
265
-
266
- ### Security Report
267
-
268
- Generate markdown report:
269
-
270
- ```markdown
271
- # Security Analysis Report
272
-
273
- **Scan Date**: 2024-01-15 11:00:00
274
- **Files Analyzed**: 57 (Critical + High priority)
275
- **Total Findings**: 24
276
-
277
- ## Severity Summary
278
-
279
- | Severity | Count | Percentage |
280
- |----------|-------|------------|
281
- | Critical | 3 | 12.5% |
282
- | High | 8 | 33.3% |
283
- | Medium | 10 | 41.7% |
284
- | Low | 3 | 12.5% |
285
-
286
- ## Critical Findings (Requires Immediate Action)
287
-
288
- ### 🔴 [SEC-001] SQL Injection in User Authentication
289
-
290
- **File**: `src/auth/user-service.ts:145`
291
- **CWE**: CWE-89 | **OWASP**: A03:2021 - Injection
292
-
293
- **Vulnerable Code**:
294
- \`\`\`typescript
295
- const query = \`SELECT * FROM users WHERE username = '\${username}'\`;
296
- const user = await db.execute(query);
297
- \`\`\`
298
-
299
- **Issue**: User input (`username`) is directly concatenated into SQL query, allowing attackers to inject malicious SQL commands.
300
-
301
- **Attack Example**:
302
- \`\`\`
303
- username: ' OR '1'='1' --
304
- Result: SELECT * FROM users WHERE username = '' OR '1'='1' --'
305
- Effect: Bypasses authentication, returns all users
306
- \`\`\`
307
-
308
- **Recommended Fix**:
309
- \`\`\`typescript
310
- // Use parameterized queries
311
- const query = 'SELECT * FROM users WHERE username = ?';
312
- const user = await db.execute(query, [username]);
313
-
314
- // Or use ORM
315
- const user = await User.findOne({ where: { username } });
316
- \`\`\`
317
-
318
- **References**:
319
- - [OWASP SQL Injection](https://owasp.org/www-community/attacks/SQL_Injection)
320
- - [CWE-89](https://cwe.mitre.org/data/definitions/89.html)
321
-
322
- ---
323
-
324
- ### 🔴 [SEC-002] Hardcoded JWT Secret
325
-
326
- **File**: `src/auth/jwt.ts:23`
327
- **CWE**: CWE-798 | **OWASP**: A07:2021 - Identification and Authentication Failures
328
-
329
- **Vulnerable Code**:
330
- \`\`\`typescript
331
- const token = jwt.sign(payload, 'mysecret123', { expiresIn: '1h' });
332
- \`\`\`
333
-
334
- **Issue**: JWT secret is hardcoded and weak (only 11 characters).
335
-
336
- **Recommended Fix**:
337
- \`\`\`typescript
338
- // Use environment variable with strong secret
339
- const token = jwt.sign(payload, process.env.JWT_SECRET, {
340
- expiresIn: '1h',
341
- algorithm: 'HS256'
342
- });
343
-
344
- // Generate strong secret (32+ bytes):
345
- // node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
346
- \`\`\`
347
-
348
- ---
349
-
350
- ## High Findings
351
-
352
- ### 🟠 [SEC-003] Missing Input Validation
353
-
354
- **File**: `src/api/users.ts:67`
355
- **CWE**: CWE-20 | **OWASP**: A03:2021 - Injection
356
-
357
- ...
358
-
359
- ## Medium Findings
360
-
361
- ...
362
-
363
- ## Remediation Priority
364
-
365
- 1. **Critical (3)**: Fix within 24 hours
366
- 2. **High (8)**: Fix within 1 week
367
- 3. **Medium (10)**: Fix within 1 month
368
- 4. **Low (3)**: Fix in next release
369
-
370
- ## Compliance Impact
371
-
372
- - **PCI DSS**: 4 findings affect compliance (SEC-001, SEC-002, SEC-008, SEC-011)
373
- - **HIPAA**: 2 findings affect compliance (SEC-005, SEC-009)
374
- - **GDPR**: 3 findings affect compliance (SEC-002, SEC-005, SEC-007)
375
- ```
376
-
377
- ## State Management
378
-
379
- ```json
380
- {
381
- "phase": "02-security-analysis",
382
- "status": "completed",
383
- "timestamp": "2024-01-15T11:15:00Z",
384
- "input": {
385
- "inventory_path": ".code-review/inventory.json",
386
- "files_analyzed": 57
387
- },
388
- "output": {
389
- "findings_path": ".code-review/security-findings.json",
390
- "total_findings": 24,
391
- "critical_count": 3,
392
- "high_count": 8
393
- }
394
- }
395
- ```
396
-
397
- ## Agent Instructions
398
-
399
- ```markdown
400
- You are in Phase 2 of the Code Review workflow. Your task is to analyze code for security vulnerabilities.
401
-
402
- **Instructions**:
403
- 1. Load file inventory from Phase 1
404
- 2. Focus on Critical + High priority files
405
- 3. Run security checks for:
406
- - OWASP Top 10 vulnerabilities
407
- - CWE Top 25 weaknesses
408
- - Language-specific security patterns
409
- 4. Use smart_search with mode="ripgrep" for pattern matching
410
- 5. Use mcp__ace-tool__search_context for semantic security pattern discovery
411
- 6. Classify findings by severity (Critical/High/Medium/Low)
412
- 7. Generate security-findings.json and markdown report
413
- 8. Proceed to Phase 3 (Best Practices Review)
414
-
415
- **Tools Available**:
416
- - mcp__ccw_tools__smart_search (pattern search)
417
- - mcp__ace-tool__search_context (semantic search)
418
- - Read (read file content)
419
- - Write (save findings and reports)
420
- - Grep (targeted pattern matching)
421
-
422
- **Output Requirements**:
423
- - security-findings.json with detailed findings
424
- - Security report in markdown format
425
- - Each finding must include: file, line, severity, CWE, OWASP, fix recommendation
426
- - State file for phase tracking
427
- ```
428
-
429
- ## Validation
430
-
431
- Before proceeding to Phase 3:
432
-
433
- - ✅ All Critical + High priority files analyzed
434
- - ✅ Findings categorized by severity
435
- - ✅ Each finding has fix recommendation
436
- - ✅ CWE and OWASP mappings included
437
- - ✅ Security report generated
438
- - ✅ State saved
439
-
440
- ## Next Phase
441
-
442
- **Phase 3: Best Practices Review** - Analyze code quality, performance, and maintainability issues.
@@ -1,36 +0,0 @@
1
- # Phase 3: Best Practices Review
2
-
3
- ## Objective
4
-
5
- Analyze code for best practices violations including code quality, performance issues, and maintainability concerns.
6
-
7
- ## Input
8
-
9
- - **File Inventory**: From Phase 1 (`.code-review/inventory.json`)
10
- - **Security Findings**: From Phase 2 (`.code-review/security-findings.json`)
11
- - **User Arguments**:
12
- - `--focus best-practices`: Best practices only mode
13
- - `--check quality,performance,maintainability`: Specific areas to check
14
-
15
- ## Process
16
-
17
- ### Step 1: Code Quality Analysis
18
-
19
- Check naming conventions, function complexity, code duplication, and dead code detection.
20
-
21
- ### Step 2: Performance Analysis
22
-
23
- Detect N+1 queries, inefficient algorithms, and memory leaks.
24
-
25
- ### Step 3: Maintainability Analysis
26
-
27
- Check documentation coverage, test coverage, and dependency management.
28
-
29
- ## Output
30
-
31
- - best-practices-findings.json
32
- - Markdown report with recommendations
33
-
34
- ## Next Phase
35
-
36
- **Phase 4: Report Generation**