agentic-qe 2.0.0 → 2.1.0
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/agents/qx-partner.md +17 -4
- package/.claude/skills/accessibility-testing/SKILL.md +144 -692
- package/.claude/skills/agentic-quality-engineering/SKILL.md +176 -529
- package/.claude/skills/api-testing-patterns/SKILL.md +180 -560
- package/.claude/skills/brutal-honesty-review/SKILL.md +113 -603
- package/.claude/skills/bug-reporting-excellence/SKILL.md +116 -517
- package/.claude/skills/chaos-engineering-resilience/SKILL.md +127 -72
- package/.claude/skills/cicd-pipeline-qe-orchestrator/SKILL.md +209 -404
- package/.claude/skills/code-review-quality/SKILL.md +158 -608
- package/.claude/skills/compatibility-testing/SKILL.md +148 -38
- package/.claude/skills/compliance-testing/SKILL.md +132 -63
- package/.claude/skills/consultancy-practices/SKILL.md +114 -446
- package/.claude/skills/context-driven-testing/SKILL.md +117 -381
- package/.claude/skills/contract-testing/SKILL.md +176 -141
- package/.claude/skills/database-testing/SKILL.md +137 -130
- package/.claude/skills/exploratory-testing-advanced/SKILL.md +160 -629
- package/.claude/skills/holistic-testing-pact/SKILL.md +140 -188
- package/.claude/skills/localization-testing/SKILL.md +145 -33
- package/.claude/skills/mobile-testing/SKILL.md +132 -448
- package/.claude/skills/mutation-testing/SKILL.md +147 -41
- package/.claude/skills/performance-testing/SKILL.md +200 -546
- package/.claude/skills/quality-metrics/SKILL.md +164 -519
- package/.claude/skills/refactoring-patterns/SKILL.md +132 -699
- package/.claude/skills/regression-testing/SKILL.md +120 -926
- package/.claude/skills/risk-based-testing/SKILL.md +157 -660
- package/.claude/skills/security-testing/SKILL.md +199 -538
- package/.claude/skills/sherlock-review/SKILL.md +163 -699
- package/.claude/skills/shift-left-testing/SKILL.md +161 -465
- package/.claude/skills/shift-right-testing/SKILL.md +161 -519
- package/.claude/skills/six-thinking-hats/SKILL.md +175 -1110
- package/.claude/skills/skills-manifest.json +71 -20
- package/.claude/skills/tdd-london-chicago/SKILL.md +131 -448
- package/.claude/skills/technical-writing/SKILL.md +103 -154
- package/.claude/skills/test-automation-strategy/SKILL.md +166 -772
- package/.claude/skills/test-data-management/SKILL.md +126 -910
- package/.claude/skills/test-design-techniques/SKILL.md +179 -89
- package/.claude/skills/test-environment-management/SKILL.md +136 -91
- package/.claude/skills/test-reporting-analytics/SKILL.md +169 -92
- package/.claude/skills/testability-scoring/SKILL.md +172 -538
- package/.claude/skills/testability-scoring/scripts/generate-html-report.js +0 -0
- package/.claude/skills/visual-testing-advanced/SKILL.md +155 -78
- package/.claude/skills/xp-practices/SKILL.md +151 -587
- package/CHANGELOG.md +48 -0
- package/README.md +23 -16
- package/dist/agents/QXPartnerAgent.d.ts +8 -1
- package/dist/agents/QXPartnerAgent.d.ts.map +1 -1
- package/dist/agents/QXPartnerAgent.js +1174 -112
- package/dist/agents/QXPartnerAgent.js.map +1 -1
- package/dist/agents/lifecycle/AgentLifecycleManager.d.ts.map +1 -1
- package/dist/agents/lifecycle/AgentLifecycleManager.js +34 -31
- package/dist/agents/lifecycle/AgentLifecycleManager.js.map +1 -1
- package/dist/cli/commands/init-claude-md-template.d.ts.map +1 -1
- package/dist/cli/commands/init-claude-md-template.js +14 -0
- package/dist/cli/commands/init-claude-md-template.js.map +1 -1
- package/dist/core/SwarmCoordinator.d.ts +180 -0
- package/dist/core/SwarmCoordinator.d.ts.map +1 -0
- package/dist/core/SwarmCoordinator.js +473 -0
- package/dist/core/SwarmCoordinator.js.map +1 -0
- package/dist/core/metrics/MetricsAggregator.d.ts +228 -0
- package/dist/core/metrics/MetricsAggregator.d.ts.map +1 -0
- package/dist/core/metrics/MetricsAggregator.js +482 -0
- package/dist/core/metrics/MetricsAggregator.js.map +1 -0
- package/dist/core/metrics/index.d.ts +5 -0
- package/dist/core/metrics/index.d.ts.map +1 -0
- package/dist/core/metrics/index.js +11 -0
- package/dist/core/metrics/index.js.map +1 -0
- package/dist/core/optimization/SwarmOptimizer.d.ts +5 -0
- package/dist/core/optimization/SwarmOptimizer.d.ts.map +1 -1
- package/dist/core/optimization/SwarmOptimizer.js +17 -0
- package/dist/core/optimization/SwarmOptimizer.js.map +1 -1
- package/dist/core/orchestration/AdaptiveScheduler.d.ts +190 -0
- package/dist/core/orchestration/AdaptiveScheduler.d.ts.map +1 -0
- package/dist/core/orchestration/AdaptiveScheduler.js +460 -0
- package/dist/core/orchestration/AdaptiveScheduler.js.map +1 -0
- package/dist/core/orchestration/WorkflowOrchestrator.d.ts +13 -0
- package/dist/core/orchestration/WorkflowOrchestrator.d.ts.map +1 -1
- package/dist/core/orchestration/WorkflowOrchestrator.js +32 -0
- package/dist/core/orchestration/WorkflowOrchestrator.js.map +1 -1
- package/dist/core/recovery/CircuitBreaker.d.ts +176 -0
- package/dist/core/recovery/CircuitBreaker.d.ts.map +1 -0
- package/dist/core/recovery/CircuitBreaker.js +382 -0
- package/dist/core/recovery/CircuitBreaker.js.map +1 -0
- package/dist/core/recovery/RecoveryOrchestrator.d.ts +186 -0
- package/dist/core/recovery/RecoveryOrchestrator.d.ts.map +1 -0
- package/dist/core/recovery/RecoveryOrchestrator.js +476 -0
- package/dist/core/recovery/RecoveryOrchestrator.js.map +1 -0
- package/dist/core/recovery/RetryStrategy.d.ts +127 -0
- package/dist/core/recovery/RetryStrategy.d.ts.map +1 -0
- package/dist/core/recovery/RetryStrategy.js +314 -0
- package/dist/core/recovery/RetryStrategy.js.map +1 -0
- package/dist/core/recovery/index.d.ts +8 -0
- package/dist/core/recovery/index.d.ts.map +1 -0
- package/dist/core/recovery/index.js +27 -0
- package/dist/core/recovery/index.js.map +1 -0
- package/dist/core/skills/DependencyResolver.d.ts +99 -0
- package/dist/core/skills/DependencyResolver.d.ts.map +1 -0
- package/dist/core/skills/DependencyResolver.js +260 -0
- package/dist/core/skills/DependencyResolver.js.map +1 -0
- package/dist/core/skills/ManifestGenerator.d.ts +114 -0
- package/dist/core/skills/ManifestGenerator.d.ts.map +1 -0
- package/dist/core/skills/ManifestGenerator.js +449 -0
- package/dist/core/skills/ManifestGenerator.js.map +1 -0
- package/dist/core/skills/index.d.ts +9 -0
- package/dist/core/skills/index.d.ts.map +1 -0
- package/dist/core/skills/index.js +24 -0
- package/dist/core/skills/index.js.map +1 -0
- package/dist/mcp/server.d.ts +9 -9
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +1 -2
- package/dist/mcp/server.js.map +1 -1
- package/dist/types/qx.d.ts +39 -7
- package/dist/types/qx.d.ts.map +1 -1
- package/dist/types/qx.js.map +1 -1
- package/dist/visualization/api/RestEndpoints.js +1 -1
- package/dist/visualization/api/RestEndpoints.js.map +1 -1
- package/package.json +13 -55
|
@@ -1,677 +1,227 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: code-review-quality
|
|
3
|
-
description: Conduct context-driven code reviews focusing on quality, testability, and maintainability. Use when reviewing code, providing feedback, or establishing review practices.
|
|
3
|
+
description: "Conduct context-driven code reviews focusing on quality, testability, and maintainability. Use when reviewing code, providing feedback, or establishing review practices."
|
|
4
|
+
category: development-practices
|
|
5
|
+
priority: high
|
|
6
|
+
tokenEstimate: 900
|
|
7
|
+
agents: [qe-quality-analyzer, qe-security-scanner, qe-performance-tester, qe-coverage-analyzer]
|
|
8
|
+
implementation_status: optimized
|
|
9
|
+
optimization_version: 1.0
|
|
10
|
+
last_optimized: 2025-12-02
|
|
11
|
+
dependencies: []
|
|
12
|
+
quick_reference_card: true
|
|
13
|
+
tags: [code-review, feedback, quality, testability, maintainability, pr-review]
|
|
4
14
|
---
|
|
5
15
|
|
|
6
16
|
# Code Review Quality
|
|
7
17
|
|
|
8
|
-
|
|
18
|
+
<default_to_action>
|
|
19
|
+
When reviewing code or establishing review practices:
|
|
20
|
+
1. PRIORITIZE feedback: 🔴 Blocker (must fix) → 🟡 Major → 🟢 Minor → 💡 Suggestion
|
|
21
|
+
2. FOCUS on: Bugs, security, testability, maintainability (not style preferences)
|
|
22
|
+
3. ASK questions over commands: "Have you considered...?" > "Change this to..."
|
|
23
|
+
4. PROVIDE context: Why this matters, not just what to change
|
|
24
|
+
5. LIMIT scope: Review < 400 lines at a time for effectiveness
|
|
25
|
+
|
|
26
|
+
**Quick Review Checklist:**
|
|
27
|
+
- Logic: Does it work correctly? Edge cases handled?
|
|
28
|
+
- Security: Input validation? Auth checks? Injection risks?
|
|
29
|
+
- Testability: Can this be tested? Is it tested?
|
|
30
|
+
- Maintainability: Clear naming? Single responsibility? DRY?
|
|
31
|
+
- Performance: O(n²) loops? N+1 queries? Memory leaks?
|
|
32
|
+
|
|
33
|
+
**Critical Success Factors:**
|
|
34
|
+
- Review the code, not the person
|
|
35
|
+
- Catching bugs > nitpicking style
|
|
36
|
+
- Fast feedback (< 24h) > thorough feedback
|
|
37
|
+
</default_to_action>
|
|
38
|
+
|
|
39
|
+
## Quick Reference Card
|
|
40
|
+
|
|
41
|
+
### When to Use
|
|
42
|
+
- PR code reviews
|
|
43
|
+
- Pair programming feedback
|
|
44
|
+
- Establishing team review standards
|
|
45
|
+
- Mentoring developers
|
|
46
|
+
|
|
47
|
+
### Feedback Priority Levels
|
|
48
|
+
| Level | Icon | Meaning | Action |
|
|
49
|
+
|-------|------|---------|--------|
|
|
50
|
+
| Blocker | 🔴 | Bug/security/crash | Must fix before merge |
|
|
51
|
+
| Major | 🟡 | Logic issue/test gap | Should fix before merge |
|
|
52
|
+
| Minor | 🟢 | Style/naming | Nice to fix |
|
|
53
|
+
| Suggestion | 💡 | Alternative approach | Consider for future |
|
|
54
|
+
|
|
55
|
+
### Review Scope Limits
|
|
56
|
+
| Lines Changed | Recommendation |
|
|
57
|
+
|---------------|----------------|
|
|
58
|
+
| < 200 | Single review session |
|
|
59
|
+
| 200-400 | Review in chunks |
|
|
60
|
+
| > 400 | Request PR split |
|
|
61
|
+
|
|
62
|
+
### What to Focus On
|
|
63
|
+
| ✅ Review | ❌ Skip |
|
|
64
|
+
|-----------|---------|
|
|
65
|
+
| Logic correctness | Formatting (use linter) |
|
|
66
|
+
| Security risks | Naming preferences |
|
|
67
|
+
| Test coverage | Architecture debates |
|
|
68
|
+
| Performance issues | Style opinions |
|
|
69
|
+
| Error handling | Trivial changes |
|
|
9
70
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
**Key principle:** Review code like you're helping a colleague, not judging them.
|
|
13
|
-
|
|
14
|
-
## The Code Review Mindset
|
|
15
|
-
|
|
16
|
-
### What You're Looking For
|
|
17
|
-
|
|
18
|
-
**Must address:**
|
|
19
|
-
- Bugs and logic errors
|
|
20
|
-
- Security vulnerabilities
|
|
21
|
-
- Performance issues
|
|
22
|
-
- Breaking changes
|
|
23
|
-
|
|
24
|
-
**Should address:**
|
|
25
|
-
- Unclear naming
|
|
26
|
-
- Missing tests
|
|
27
|
-
- Duplicated code
|
|
28
|
-
- Complex logic
|
|
29
|
-
|
|
30
|
-
**Nice to have:**
|
|
31
|
-
- Style inconsistencies (if not auto-fixable)
|
|
32
|
-
- Minor optimizations
|
|
33
|
-
- Suggestions for improvement
|
|
34
|
-
|
|
35
|
-
**Not your job:**
|
|
36
|
-
- Enforcing personal preferences
|
|
37
|
-
- Rewriting in your style
|
|
38
|
-
- Nitpicking formatting (use linter)
|
|
39
|
-
|
|
40
|
-
### Questions to Ask Yourself
|
|
41
|
-
|
|
42
|
-
**Is this a problem or a preference?**
|
|
43
|
-
- Problem: Will cause bugs, confuse future maintainers
|
|
44
|
-
- Preference: "I would have done it differently"
|
|
45
|
-
|
|
46
|
-
**Is this blocking or non-blocking?**
|
|
47
|
-
- Blocking: Must fix before merge
|
|
48
|
-
- Non-blocking: Suggestion for future improvement
|
|
49
|
-
|
|
50
|
-
**Am I teaching or judging?**
|
|
51
|
-
- Teaching: "Here's why this could be better"
|
|
52
|
-
- Judging: "This is wrong"
|
|
53
|
-
|
|
54
|
-
## Feedback Levels
|
|
55
|
-
|
|
56
|
-
Use these prefixes to indicate severity:
|
|
57
|
-
|
|
58
|
-
**🔴 BLOCKER** - Must fix before merging
|
|
59
|
-
```
|
|
60
|
-
🔴 This function has SQL injection vulnerability.
|
|
61
|
-
Use parameterized queries instead.
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
**🟡 MAJOR** - Should fix, but not necessarily blocking
|
|
65
|
-
```
|
|
66
|
-
🟡 This test doesn't actually verify the error handling.
|
|
67
|
-
Consider adding assertion for error message.
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
**🟢 MINOR** - Nice to have, optional
|
|
71
|
-
```
|
|
72
|
-
🟢 Consider extracting this into a separate function
|
|
73
|
-
for better readability (optional).
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
**💡 SUGGESTION** - Ideas for improvement
|
|
77
|
-
```
|
|
78
|
-
💡 For future consideration: We could cache this
|
|
79
|
-
result to improve performance.
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## The Review Process
|
|
83
|
-
|
|
84
|
-
### 1. Understand the Context
|
|
85
|
-
|
|
86
|
-
**Before reviewing code, check:**
|
|
87
|
-
- PR description - What problem does this solve?
|
|
88
|
-
- Linked issues/tickets - Why is this needed?
|
|
89
|
-
- Related PRs - Is this part of larger change?
|
|
90
|
-
|
|
91
|
-
**Bad start:** Jump straight to code and criticize
|
|
92
|
-
**Good start:** Understand what they're trying to accomplish
|
|
93
|
-
|
|
94
|
-
### 2. Review at Different Levels
|
|
95
|
-
|
|
96
|
-
**High-level (5 min):**
|
|
97
|
-
- Does approach make sense?
|
|
98
|
-
- Are there architectural concerns?
|
|
99
|
-
- Does it fit with existing patterns?
|
|
100
|
-
|
|
101
|
-
**Detail-level (15-30 min):**
|
|
102
|
-
- Logic correctness
|
|
103
|
-
- Edge cases handled?
|
|
104
|
-
- Error handling adequate?
|
|
105
|
-
- Tests sufficient?
|
|
71
|
+
---
|
|
106
72
|
|
|
107
|
-
|
|
108
|
-
- Naming clear?
|
|
109
|
-
- Code readable?
|
|
110
|
-
- Comments where needed?
|
|
73
|
+
## Feedback Templates
|
|
111
74
|
|
|
112
|
-
###
|
|
75
|
+
### Blocker (Must Fix)
|
|
76
|
+
```markdown
|
|
77
|
+
🔴 **BLOCKER: SQL Injection Risk**
|
|
113
78
|
|
|
114
|
-
|
|
79
|
+
This query is vulnerable to SQL injection:
|
|
115
80
|
```javascript
|
|
116
|
-
|
|
117
|
-
if (price > 100 && price < 50) { // Impossible condition
|
|
118
|
-
applyDiscount();
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// Should be:
|
|
122
|
-
if (price > 100 || (price >= 50 && price <= 100)) {
|
|
123
|
-
applyDiscount();
|
|
124
|
-
}
|
|
81
|
+
db.query(`SELECT * FROM users WHERE id = ${userId}`)
|
|
125
82
|
```
|
|
126
83
|
|
|
127
|
-
**
|
|
84
|
+
**Fix:** Use parameterized queries:
|
|
128
85
|
```javascript
|
|
129
|
-
|
|
130
|
-
function calculateTotal(order) {
|
|
131
|
-
return order.items.reduce(...); // What if order.items is null?
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Suggestion:
|
|
135
|
-
function calculateTotal(order) {
|
|
136
|
-
if (!order?.items?.length) return 0;
|
|
137
|
-
return order.items.reduce(...);
|
|
138
|
-
}
|
|
86
|
+
db.query('SELECT * FROM users WHERE id = ?', [userId])
|
|
139
87
|
```
|
|
140
88
|
|
|
141
|
-
**
|
|
142
|
-
```javascript
|
|
143
|
-
// 🔴 BLOCKER: Race condition
|
|
144
|
-
async function updateInventory(productId, quantity) {
|
|
145
|
-
const product = await db.products.findById(productId);
|
|
146
|
-
product.stock -= quantity; // Not atomic!
|
|
147
|
-
await product.save();
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// Suggestion:
|
|
151
|
-
async function updateInventory(productId, quantity) {
|
|
152
|
-
await db.products.updateOne(
|
|
153
|
-
{ _id: productId, stock: { $gte: quantity } },
|
|
154
|
-
{ $inc: { stock: -quantity } }
|
|
155
|
-
);
|
|
156
|
-
}
|
|
89
|
+
**Why:** User input directly in SQL allows attackers to execute arbitrary queries.
|
|
157
90
|
```
|
|
158
91
|
|
|
159
|
-
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
function calculateDiscount(price, customerType) {
|
|
163
|
-
// Complex business logic
|
|
164
|
-
// ...
|
|
165
|
-
}
|
|
92
|
+
### Major (Should Fix)
|
|
93
|
+
```markdown
|
|
94
|
+
🟡 **MAJOR: Missing Error Handling**
|
|
166
95
|
|
|
167
|
-
|
|
168
|
-
// - Different customer types
|
|
169
|
-
// - Edge cases (price = 0, negative)
|
|
170
|
-
// - Boundary values
|
|
171
|
-
```
|
|
96
|
+
What happens if `fetchUser()` throws? The error bubbles up unhandled.
|
|
172
97
|
|
|
173
|
-
**
|
|
98
|
+
**Suggestion:** Add try/catch with appropriate error response:
|
|
174
99
|
```javascript
|
|
175
|
-
|
|
176
|
-
const
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
## Writing Good Review Comments
|
|
184
|
-
|
|
185
|
-
### Be Specific
|
|
186
|
-
|
|
187
|
-
**Bad:**
|
|
188
|
-
```
|
|
189
|
-
This function is too long.
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
**Good:**
|
|
193
|
-
```
|
|
194
|
-
🟡 This function has 4 distinct responsibilities:
|
|
195
|
-
1. Validation
|
|
196
|
-
2. Calculation
|
|
197
|
-
3. Database save
|
|
198
|
-
4. Email sending
|
|
199
|
-
|
|
200
|
-
Consider extracting into separate functions for easier testing:
|
|
201
|
-
- validateOrder()
|
|
202
|
-
- calculateTotal()
|
|
203
|
-
- saveOrder()
|
|
204
|
-
- sendConfirmation()
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### Explain Why
|
|
208
|
-
|
|
209
|
-
**Bad:**
|
|
210
|
-
```
|
|
211
|
-
Don't use var.
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**Good:**
|
|
215
|
-
```
|
|
216
|
-
🟢 Consider using `const` or `let` instead of `var`.
|
|
217
|
-
`var` has function scope which can lead to unexpected
|
|
218
|
-
behavior with closures. `const`/`let` have block scope
|
|
219
|
-
which is more predictable.
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Suggest Solutions
|
|
223
|
-
|
|
224
|
-
**Bad:**
|
|
225
|
-
```
|
|
226
|
-
This won't work.
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
**Good:**
|
|
230
|
-
```
|
|
231
|
-
🔴 This will fail when items array is empty.
|
|
232
|
-
|
|
233
|
-
Suggested fix:
|
|
234
|
-
if (!items || items.length === 0) {
|
|
235
|
-
return 0;
|
|
100
|
+
try {
|
|
101
|
+
const user = await fetchUser(id);
|
|
102
|
+
return user;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
logger.error('Failed to fetch user', { id, error });
|
|
105
|
+
throw new NotFoundError('User not found');
|
|
236
106
|
}
|
|
237
107
|
```
|
|
238
|
-
|
|
239
|
-
### Ask Questions
|
|
240
|
-
|
|
241
|
-
**Accusatory:**
|
|
242
|
-
```
|
|
243
|
-
Why did you do it this way?
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
**Curious:**
|
|
247
|
-
```
|
|
248
|
-
💡 I'm curious about the approach here. Have you
|
|
249
|
-
considered using X pattern? It might simplify
|
|
250
|
-
the error handling. What do you think?
|
|
251
108
|
```
|
|
252
109
|
|
|
253
|
-
###
|
|
254
|
-
|
|
255
|
-
**Don't just criticize, also highlight good things:**
|
|
256
|
-
```
|
|
257
|
-
✅ Nice use of early returns to avoid nested conditionals.
|
|
258
|
-
This is much more readable than the previous version!
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
```
|
|
262
|
-
✅ Great test coverage on the edge cases. The negative
|
|
263
|
-
price test is especially important.
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
## The Comment Template
|
|
267
|
-
|
|
110
|
+
### Minor (Nice to Fix)
|
|
268
111
|
```markdown
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
**Current code:**
|
|
272
|
-
```[language]
|
|
273
|
-
[code snippet]
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
**Issue:**
|
|
277
|
-
[Explain what's wrong and why it matters]
|
|
112
|
+
🟢 **minor:** Variable name could be clearer
|
|
278
113
|
|
|
279
|
-
|
|
280
|
-
```[language]
|
|
281
|
-
[code snippet with solution]
|
|
114
|
+
`d` doesn't convey meaning. Consider `daysSinceLastLogin`.
|
|
282
115
|
```
|
|
283
116
|
|
|
284
|
-
|
|
285
|
-
[If applicable, mention other approaches]
|
|
286
|
-
```
|
|
287
|
-
|
|
288
|
-
### Example Using Template
|
|
289
|
-
|
|
117
|
+
### Suggestion (Consider)
|
|
290
118
|
```markdown
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
**Current code:**
|
|
294
|
-
```javascript
|
|
295
|
-
const query = `SELECT * FROM users WHERE name LIKE '%${searchTerm}%'`;
|
|
296
|
-
const results = await db.query(query);
|
|
297
|
-
```
|
|
119
|
+
💡 **suggestion:** Consider extracting this to a helper
|
|
298
120
|
|
|
299
|
-
|
|
300
|
-
User input is directly interpolated into SQL query. An attacker
|
|
301
|
-
could inject SQL code (e.g., searchTerm = "'; DROP TABLE users--")
|
|
302
|
-
|
|
303
|
-
**Suggested fix:**
|
|
304
|
-
```javascript
|
|
305
|
-
const query = 'SELECT * FROM users WHERE name LIKE ?';
|
|
306
|
-
const results = await db.query(query, [`%${searchTerm}%`]);
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
**Alternative:**
|
|
310
|
-
If using an ORM:
|
|
311
|
-
```javascript
|
|
312
|
-
const results = await User.findAll({
|
|
313
|
-
where: {
|
|
314
|
-
name: { [Op.like]: `%${searchTerm}%` }
|
|
315
|
-
}
|
|
316
|
-
});
|
|
121
|
+
This validation logic appears in 3 places. A `validateEmail()` helper would reduce duplication. Not blocking, but might be worth a follow-up PR.
|
|
317
122
|
```
|
|
318
|
-
```
|
|
319
|
-
|
|
320
|
-
## What NOT to Review
|
|
321
|
-
|
|
322
|
-
### Don't Review (Automate Instead)
|
|
323
|
-
|
|
324
|
-
**Formatting**
|
|
325
|
-
- Indentation, spacing, line breaks
|
|
326
|
-
- **Solution:** Use Prettier, ESLint with auto-fix
|
|
327
|
-
|
|
328
|
-
**Code Style**
|
|
329
|
-
- Semicolons, quotes, naming conventions
|
|
330
|
-
- **Solution:** ESLint, style guide enforced in CI
|
|
331
|
-
|
|
332
|
-
**Import Order**
|
|
333
|
-
- Which imports come first
|
|
334
|
-
- **Solution:** ESLint plugin for imports
|
|
335
|
-
|
|
336
|
-
**Type Errors**
|
|
337
|
-
- TypeScript compile errors
|
|
338
|
-
- **Solution:** TypeScript in CI
|
|
339
123
|
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
- Logic correctness
|
|
343
|
-
- Business logic implementation
|
|
344
|
-
- Test quality and coverage
|
|
345
|
-
- Security concerns
|
|
346
|
-
- Performance issues
|
|
347
|
-
- API design
|
|
348
|
-
- Error handling
|
|
349
|
-
- Edge cases
|
|
350
|
-
|
|
351
|
-
## Review Checklist
|
|
124
|
+
---
|
|
352
125
|
|
|
353
|
-
|
|
354
|
-
- [ ] Does code do what PR says it does?
|
|
355
|
-
- [ ] Are edge cases handled?
|
|
356
|
-
- [ ] Is error handling adequate?
|
|
357
|
-
- [ ] What happens with invalid input?
|
|
126
|
+
## Review Questions to Ask
|
|
358
127
|
|
|
359
|
-
###
|
|
360
|
-
-
|
|
361
|
-
-
|
|
362
|
-
-
|
|
363
|
-
- [ ] Are error cases tested?
|
|
364
|
-
- [ ] Can I understand what's being tested?
|
|
128
|
+
### Logic
|
|
129
|
+
- What happens when X is null/empty/negative?
|
|
130
|
+
- Is there a race condition here?
|
|
131
|
+
- What if the API call fails?
|
|
365
132
|
|
|
366
133
|
### Security
|
|
367
|
-
-
|
|
368
|
-
-
|
|
369
|
-
-
|
|
370
|
-
- [ ] Authorization checks in place?
|
|
371
|
-
- [ ] Secrets not hardcoded?
|
|
372
|
-
|
|
373
|
-
### Performance
|
|
374
|
-
- [ ] No obvious performance issues?
|
|
375
|
-
- [ ] Database queries optimized?
|
|
376
|
-
- [ ] No N+1 queries?
|
|
377
|
-
- [ ] Appropriate use of caching?
|
|
378
|
-
|
|
379
|
-
### Maintainability
|
|
380
|
-
- [ ] Code is readable?
|
|
381
|
-
- [ ] Naming is clear?
|
|
382
|
-
- [ ] Complex logic is commented?
|
|
383
|
-
- [ ] No obvious duplication?
|
|
384
|
-
- [ ] Follows existing patterns?
|
|
385
|
-
|
|
386
|
-
### Documentation
|
|
387
|
-
- [ ] Public API documented?
|
|
388
|
-
- [ ] Complex logic explained?
|
|
389
|
-
- [ ] README updated if needed?
|
|
390
|
-
|
|
391
|
-
## Handling Disagreements
|
|
392
|
-
|
|
393
|
-
### When Author Disagrees with Your Feedback
|
|
394
|
-
|
|
395
|
-
**Your comment:**
|
|
396
|
-
```
|
|
397
|
-
🟡 Consider extracting this into a separate function.
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
**Their response:**
|
|
401
|
-
```
|
|
402
|
-
I don't think that's necessary. The function is fine as is.
|
|
403
|
-
```
|
|
404
|
-
|
|
405
|
-
**Your options:**
|
|
406
|
-
|
|
407
|
-
**If non-blocking (🟢💡):**
|
|
408
|
-
```
|
|
409
|
-
Fair enough! It's a stylistic preference. Feel free to leave as is.
|
|
410
|
-
```
|
|
411
|
-
|
|
412
|
-
**If important (🟡):**
|
|
413
|
-
```
|
|
414
|
-
I understand your perspective. My concern is that this
|
|
415
|
-
function currently handles 4 different responsibilities,
|
|
416
|
-
which makes it harder to test in isolation. Would you be
|
|
417
|
-
open to extracting just the calculation logic?
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
**If critical (🔴):**
|
|
421
|
-
```
|
|
422
|
-
I appreciate you're trying to keep it simple, but this
|
|
423
|
-
is a security vulnerability. We need to fix this before
|
|
424
|
-
merging. Let's discuss the best approach - happy to pair
|
|
425
|
-
on it if helpful.
|
|
426
|
-
```
|
|
427
|
-
|
|
428
|
-
### When You're Wrong
|
|
429
|
-
|
|
430
|
-
**Happens to everyone. Be gracious:**
|
|
431
|
-
```
|
|
432
|
-
You're absolutely right - I missed that this is handled
|
|
433
|
-
in the middleware layer. Thanks for clarifying!
|
|
434
|
-
Resolving this comment.
|
|
435
|
-
```
|
|
436
|
-
|
|
437
|
-
## Review Timing
|
|
438
|
-
|
|
439
|
-
### How Long Should Review Take?
|
|
440
|
-
|
|
441
|
-
**Small PR (<100 lines):** 10-15 minutes
|
|
442
|
-
**Medium PR (100-500 lines):** 30-45 minutes
|
|
443
|
-
**Large PR (>500 lines):** 1-2 hours (or ask to split)
|
|
444
|
-
|
|
445
|
-
### When to Request Changes
|
|
446
|
-
|
|
447
|
-
**Immediately:** Critical bugs, security issues
|
|
448
|
-
**Within 4 hours:** Normal business hours, blocking work
|
|
449
|
-
**Within 24 hours:** Non-urgent, non-blocking
|
|
450
|
-
|
|
451
|
-
### When PR is Too Large
|
|
452
|
-
|
|
453
|
-
```
|
|
454
|
-
This PR is quite large (847 lines). Would you consider
|
|
455
|
-
splitting into smaller PRs? It's hard to review thoroughly
|
|
456
|
-
in one go, and increases risk of missing issues.
|
|
457
|
-
|
|
458
|
-
Suggested splits:
|
|
459
|
-
1. Database schema changes
|
|
460
|
-
2. API endpoints
|
|
461
|
-
3. Frontend components
|
|
462
|
-
4. Tests
|
|
463
|
-
|
|
464
|
-
Happy to prioritize reviewing the first chunk today!
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
## Common Review Smells
|
|
468
|
-
|
|
469
|
-
### Unhelpful Reviews
|
|
470
|
-
|
|
471
|
-
**❌ Just "LGTM"**
|
|
472
|
-
- Not helpful unless you actually reviewed thoroughly
|
|
473
|
-
|
|
474
|
-
**❌ Nitpicking**
|
|
475
|
-
- 20 comments about spacing and naming
|
|
476
|
-
- 0 comments about logic
|
|
477
|
-
|
|
478
|
-
**❌ Rewriting in Your Style**
|
|
479
|
-
- "I would do it this way" (but their way works fine)
|
|
134
|
+
- Is user input validated/sanitized?
|
|
135
|
+
- Are auth checks in place?
|
|
136
|
+
- Any secrets or PII exposed?
|
|
480
137
|
|
|
481
|
-
|
|
482
|
-
-
|
|
483
|
-
-
|
|
138
|
+
### Testability
|
|
139
|
+
- How would you test this?
|
|
140
|
+
- Are dependencies injectable?
|
|
141
|
+
- Is there a test for the happy path? Edge cases?
|
|
484
142
|
|
|
485
|
-
|
|
486
|
-
-
|
|
487
|
-
-
|
|
488
|
-
|
|
489
|
-
### Helpful Reviews
|
|
490
|
-
|
|
491
|
-
**✅ Constructive Feedback**
|
|
492
|
-
- Specific, actionable, explained
|
|
493
|
-
|
|
494
|
-
**✅ Praise + Improvements**
|
|
495
|
-
- Highlight good work
|
|
496
|
-
- Suggest improvements where needed
|
|
497
|
-
|
|
498
|
-
**✅ Teaching Moments**
|
|
499
|
-
- Explain why, not just what
|
|
500
|
-
- Share knowledge and context
|
|
501
|
-
|
|
502
|
-
**✅ Focus on Impact**
|
|
503
|
-
- Prioritize important issues
|
|
504
|
-
- Let minor things go
|
|
505
|
-
|
|
506
|
-
**✅ Timely Response**
|
|
507
|
-
- Review within reasonable time
|
|
508
|
-
- Don't block progress unnecessarily
|
|
509
|
-
|
|
510
|
-
## Example Reviews
|
|
511
|
-
|
|
512
|
-
### Excellent Review Comment
|
|
513
|
-
|
|
514
|
-
```markdown
|
|
515
|
-
🔴 Memory leak in event handler
|
|
516
|
-
|
|
517
|
-
**Current code:**
|
|
518
|
-
```javascript
|
|
519
|
-
useEffect(() => {
|
|
520
|
-
window.addEventListener('resize', handleResize);
|
|
521
|
-
}, []);
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
**Issue:**
|
|
525
|
-
Event listener is registered but never cleaned up. On component
|
|
526
|
-
unmount, the listener remains active, causing a memory leak.
|
|
527
|
-
This will accumulate if component mounts/unmounts frequently.
|
|
528
|
-
|
|
529
|
-
**Suggested fix:**
|
|
530
|
-
```javascript
|
|
531
|
-
useEffect(() => {
|
|
532
|
-
window.addEventListener('resize', handleResize);
|
|
533
|
-
|
|
534
|
-
return () => {
|
|
535
|
-
window.removeEventListener('resize', handleResize);
|
|
536
|
-
};
|
|
537
|
-
}, []);
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
The return function acts as cleanup, removing the listener when
|
|
541
|
-
component unmounts.
|
|
542
|
-
|
|
543
|
-
**Further reading:**
|
|
544
|
-
React docs on cleanup: https://react.dev/learn/synchronizing-with-effects#step-3-add-cleanup-if-needed
|
|
545
|
-
```
|
|
546
|
-
|
|
547
|
-
### Poor Review Comment
|
|
548
|
-
|
|
549
|
-
```markdown
|
|
550
|
-
This is bad. Rewrite it.
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
**Problems:**
|
|
554
|
-
- Not specific
|
|
555
|
-
- No explanation
|
|
556
|
-
- No suggestion
|
|
557
|
-
- Unhelpful tone
|
|
558
|
-
|
|
559
|
-
## Reviewing Your Own Code
|
|
560
|
-
|
|
561
|
-
Before requesting review:
|
|
562
|
-
|
|
563
|
-
### Self-Review Checklist
|
|
564
|
-
- [ ] Read through entire diff
|
|
565
|
-
- [ ] Remove debug code, console.logs
|
|
566
|
-
- [ ] Check for commented-out code
|
|
567
|
-
- [ ] Verify tests pass locally
|
|
568
|
-
- [ ] Update documentation if needed
|
|
569
|
-
- [ ] Write clear PR description
|
|
570
|
-
- [ ] Add screenshots/videos if UI change
|
|
571
|
-
- [ ] Link related issues
|
|
143
|
+
### Maintainability
|
|
144
|
+
- Will the next developer understand this?
|
|
145
|
+
- Is this doing too many things?
|
|
146
|
+
- Is there duplication we could reduce?
|
|
572
147
|
|
|
573
|
-
|
|
148
|
+
---
|
|
574
149
|
|
|
575
|
-
|
|
576
|
-
- Non-obvious decisions
|
|
577
|
-
- Workarounds and why
|
|
578
|
-
- Areas you're unsure about
|
|
579
|
-
- Questions for reviewers
|
|
150
|
+
## Agent-Assisted Reviews
|
|
580
151
|
|
|
581
|
-
```
|
|
582
|
-
//
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
152
|
+
```typescript
|
|
153
|
+
// Comprehensive code review
|
|
154
|
+
await Task("Code Review", {
|
|
155
|
+
prNumber: 123,
|
|
156
|
+
checks: ['security', 'performance', 'testability', 'maintainability'],
|
|
157
|
+
feedbackLevels: ['blocker', 'major', 'minor'],
|
|
158
|
+
autoApprove: { maxBlockers: 0, maxMajor: 2 }
|
|
159
|
+
}, "qe-quality-analyzer");
|
|
160
|
+
|
|
161
|
+
// Security-focused review
|
|
162
|
+
await Task("Security Review", {
|
|
163
|
+
prFiles: changedFiles,
|
|
164
|
+
scanTypes: ['injection', 'auth', 'secrets', 'dependencies']
|
|
165
|
+
}, "qe-security-scanner");
|
|
166
|
+
|
|
167
|
+
// Test coverage review
|
|
168
|
+
await Task("Coverage Review", {
|
|
169
|
+
prNumber: 123,
|
|
170
|
+
requireNewTests: true,
|
|
171
|
+
minCoverageDelta: 0
|
|
172
|
+
}, "qe-coverage-analyzer");
|
|
586
173
|
```
|
|
587
174
|
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
### Automated Code Review with qe-quality-analyzer
|
|
175
|
+
---
|
|
591
176
|
|
|
592
|
-
|
|
593
|
-
```typescript
|
|
594
|
-
// Agent analyzes PR for quality issues
|
|
595
|
-
const reviewAnalysis = await agent.reviewCode({
|
|
596
|
-
files: prChanges,
|
|
597
|
-
depth: 'comprehensive',
|
|
598
|
-
checkBugs: true,
|
|
599
|
-
checkSecurity: true,
|
|
600
|
-
checkPerformance: true,
|
|
601
|
-
checkMaintainability: true
|
|
602
|
-
});
|
|
177
|
+
## Agent Coordination Hints
|
|
603
178
|
|
|
604
|
-
|
|
605
|
-
// {
|
|
606
|
-
// blockers: [{ file, line, issue, severity: 'BLOCKER' }],
|
|
607
|
-
// major: [{ file, line, issue, severity: 'MAJOR' }],
|
|
608
|
-
// suggestions: [{ file, line, suggestion, severity: 'MINOR' }],
|
|
609
|
-
// qualityScore: 0.87
|
|
610
|
-
// }
|
|
179
|
+
### Memory Namespace
|
|
611
180
|
```
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
const agentReview = await qe-quality-analyzer.reviewCode(prChanges);
|
|
618
|
-
const humanRefinements = await human.refineReview(agentReview);
|
|
619
|
-
const finalReview = await agent.formatFeedback({
|
|
620
|
-
agentFindings: agentReview,
|
|
621
|
-
humanInsights: humanRefinements,
|
|
622
|
-
useEmojis: true // 🔴 🟡 🟢 💡
|
|
623
|
-
});
|
|
181
|
+
aqe/code-review/
|
|
182
|
+
├── review-history/* - Past review decisions
|
|
183
|
+
├── patterns/* - Common issues by team/repo
|
|
184
|
+
├── feedback-templates/* - Reusable feedback
|
|
185
|
+
└── metrics/* - Review turnaround time
|
|
624
186
|
```
|
|
625
187
|
|
|
626
|
-
### Fleet Coordination
|
|
627
|
-
|
|
188
|
+
### Fleet Coordination
|
|
628
189
|
```typescript
|
|
629
|
-
// Multiple agents review different aspects
|
|
630
190
|
const reviewFleet = await FleetManager.coordinate({
|
|
631
191
|
strategy: 'code-review',
|
|
632
192
|
agents: [
|
|
633
|
-
'qe-quality-analyzer',
|
|
634
|
-
'qe-security-scanner',
|
|
635
|
-
'qe-performance-tester',
|
|
636
|
-
'qe-coverage-analyzer'
|
|
193
|
+
'qe-quality-analyzer', // Logic, maintainability
|
|
194
|
+
'qe-security-scanner', // Security risks
|
|
195
|
+
'qe-performance-tester', // Performance issues
|
|
196
|
+
'qe-coverage-analyzer' // Test coverage
|
|
637
197
|
],
|
|
638
198
|
topology: 'parallel'
|
|
639
199
|
});
|
|
640
|
-
|
|
641
|
-
await reviewFleet.execute({
|
|
642
|
-
prNumber: 123,
|
|
643
|
-
aggregateResults: true
|
|
644
|
-
});
|
|
645
200
|
```
|
|
646
201
|
|
|
647
202
|
---
|
|
648
203
|
|
|
649
|
-
##
|
|
204
|
+
## Review Etiquette
|
|
650
205
|
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
206
|
+
| ✅ Do | ❌ Don't |
|
|
207
|
+
|-------|---------|
|
|
208
|
+
| "Have you considered...?" | "This is wrong" |
|
|
209
|
+
| Explain why it matters | Just say "fix this" |
|
|
210
|
+
| Acknowledge good code | Only point out negatives |
|
|
211
|
+
| Suggest, don't demand | Be condescending |
|
|
212
|
+
| Review < 400 lines | Review 2000 lines at once |
|
|
654
213
|
|
|
655
|
-
|
|
656
|
-
- [refactoring-patterns](../refactoring-patterns/) - Code improvements post-review
|
|
657
|
-
- [tdd-london-chicago](../tdd-london-chicago/) - Test-driven development practices
|
|
658
|
-
- [xp-practices](../xp-practices/) - Pair programming and ensemble coding
|
|
214
|
+
---
|
|
659
215
|
|
|
660
|
-
|
|
661
|
-
- [
|
|
662
|
-
- [
|
|
216
|
+
## Related Skills
|
|
217
|
+
- [agentic-quality-engineering](../agentic-quality-engineering/) - Agent coordination
|
|
218
|
+
- [security-testing](../security-testing/) - Security review depth
|
|
219
|
+
- [refactoring-patterns](../refactoring-patterns/) - Maintainability patterns
|
|
663
220
|
|
|
664
221
|
---
|
|
665
222
|
|
|
666
223
|
## Remember
|
|
667
224
|
|
|
668
|
-
**
|
|
669
|
-
- Collaborative, not adversarial
|
|
670
|
-
- Teaching, not judging
|
|
671
|
-
- Specific, not vague
|
|
672
|
-
- Constructive, not destructive
|
|
673
|
-
- Timely, not delayed
|
|
674
|
-
|
|
675
|
-
**The goal is better code and better developers, not perfect code.**
|
|
225
|
+
**Prioritize feedback:** 🔴 Blocker → 🟡 Major → 🟢 Minor → 💡 Suggestion. Focus on bugs and security, not style. Ask questions, don't command. Review < 400 lines at a time. Fast feedback (< 24h) beats thorough feedback.
|
|
676
226
|
|
|
677
|
-
|
|
227
|
+
**With Agents:** Agents automate security, performance, and coverage checks, freeing human reviewers to focus on logic and design. Use agents for consistent, fast initial review.
|