Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add miles-knowbl/orchestrator --skill "code-review"
Install specific skill from multi-skill repository
# Description
Comprehensive PR review combining structural verification, semantic validation, and PR-specific concerns. Use before merging to assess code quality, correctness, and merge readiness. Produces actionable feedback formatted for PR comments with clear blocking vs. non-blocking distinctions.
# SKILL.md
name: code-review
description: "Comprehensive PR review combining structural verification, semantic validation, and PR-specific concerns. Use before merging to assess code quality, correctness, and merge readiness. Produces actionable feedback formatted for PR comments with clear blocking vs. non-blocking distinctions."
phase: REVIEW
category: core
version: "1.0.0"
depends_on: ["code-verification"]
tags: [quality, review, core-workflow]
Code Review
Comprehensive review for pull request merge readiness. Orchestrates verification and validation, adds PR-specific analysis, and produces actionable feedback.
When to Use
- Before merging a PR β "Is this ready to merge?"
- During review β "What feedback should I give?"
- Self-review β "What did I miss before requesting review?"
- When you say: "review this PR", "is this mergeable?", "what's wrong with this code?"
Reference Requirements
MUST read before applying this skill:
| Reference | Why Required |
|---|---|
maintainability-checklist.md |
Quality criteria for review |
feedback-formatting.md |
How to structure review comments |
Read if applicable:
| Reference | When Needed |
|---|---|
diff-analysis.md |
When reviewing PR diffs |
commit-quality.md |
When assessing commit hygiene |
test-expectations.md |
When verifying test coverage |
Verification: Ensure CODE-REVIEW.md is produced with all 4 passes completed.
Required Deliverables
| Deliverable | Location | Condition |
|---|---|---|
CODE-REVIEW.md |
Project root | Always |
Core Concept
Code review answers: "Should this be merged?"
It combines:
1. Verification β Is this structurally sound? (code-verification, thorough)
2. Validation β Does this solve the right problem? (code-validation)
3. PR hygiene β Is this a good PR? (commits, scope, documentation)
4. Maintainability β Will future developers thank or curse us?
Review Passes
Code review runs four sequential passes:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CODE REVIEW β
β β
β Pass 1: Verification (structural) β
β βββ Invoke code-verification (thorough mode) β
β β’ Complexity, security, error handling β
β β’ Memory, concurrency, resources β
β β
β Pass 2: Validation (semantic) β
β βββ Invoke code-validation β
β β’ Requirements, edge cases, failure modes β
β β’ Operations, integration, scalability β
β β
β Pass 3: PR Hygiene β
β βββ PR-specific concerns β
β β’ Diff analysis, commit quality β
β β’ Scope appropriateness, documentation β
β β
β Pass 4: Maintainability β
β βββ Long-term code health β
β β’ Naming, structure, clarity β
β β’ Patterns, conventions, testability β
β β
β Synthesis: Merge Verdict β
β βββ APPROVE / REQUEST_CHANGES / COMMENT β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Pass 1: Verification
Invoke code-verification in thorough mode.
This catches structural issues:
- Complexity anti-patterns (O(nΒ²), etc.)
- Security vulnerabilities (injection, auth bypass, etc.)
- Error handling gaps
- Memory leaks
- Concurrency issues
- Resource management problems
If verification fails: Stop and report. No point reviewing semantics if structure is broken.
β See code-verification skill for details
Pass 2: Validation
Invoke code-validation.
This checks semantic correctness:
- Requirements alignment
- Edge case coverage
- Failure mode handling
- Operational readiness
- Integration correctness
- Scalability assessment
If validation fails: Report blockers. Recommendations can proceed to later passes.
β See code-validation skill for details
Pass 3: PR Hygiene
Analyze PR-specific concerns.
3.1 Diff Analysis
What changed, and is it appropriate?
| Check | What to Look For |
|---|---|
| Scope | Does the diff match the PR description? |
| Unrelated changes | Formatting, refactoring mixed with feature? |
| Size | Is this reviewable? (>500 lines is a smell) |
| Risk distribution | Are high-risk changes isolated? |
Red flags:
- PR titled "Feature X" but includes unrelated refactoring
- Massive PR that should be split
- Changes to critical paths buried in large diff
β See references/diff-analysis.md
3.2 Commit Quality
Are commits well-structured?
| Check | Good | Bad |
|---|---|---|
| Message format | "Add user export endpoint" | "fixes" |
| Atomic commits | One logical change per commit | "WIP", "more changes" |
| History | Clean, reviewable | Merge commits, reverts, fixups |
| Commit scope | Matches message | Message says X, commit does Y |
Commit message format:
<type>: <short summary>
<body explaining what and why>
<footer with references>
Types: feat, fix, refactor, docs, test, chore
β See references/commit-quality.md
3.3 Documentation Updates
Is documentation in sync with code?
| Change Type | Documentation Needed |
|---|---|
| New endpoint | API docs, README if public |
| Config change | Config reference, deployment notes |
| New feature | User-facing docs if applicable |
| Breaking change | Migration guide, changelog |
| New dependency | README, setup instructions |
3.4 Test Coverage
Are changes tested?
| Check | Expectation |
|---|---|
| New code | Has corresponding tests |
| Bug fix | Has regression test |
| Edge cases | Critical paths tested |
| Coverage | No significant decrease |
Not everything needs tests, but changes without tests need justification.
β See references/test-expectations.md
Pass 4: Maintainability
Will future developers understand and extend this?
4.1 Naming
| Element | Good Naming | Bad Naming |
|---|---|---|
| Functions | Verb + noun: calculateTotal() |
doIt(), process(), handle() |
| Variables | Descriptive: userCount |
x, temp, data |
| Booleans | Question form: isActive, hasPermission |
flag, status |
| Classes | Noun: OrderProcessor |
Manager, Helper, Utils |
Ask: Could someone understand this without context?
4.2 Structure
| Concern | What to Check |
|---|---|
| Single responsibility | Does each function/class do one thing? |
| Appropriate abstraction | Not too abstract, not too concrete |
| Consistent patterns | Matches rest of codebase |
| Reasonable file size | <500 lines per file |
| Logical organization | Related code together |
4.3 Code Clarity
| Smell | Symptom | Fix |
|---|---|---|
| Magic numbers | if (status === 3) |
Named constants |
| Deep nesting | 4+ levels of indentation | Early returns, extraction |
| Long functions | >50 lines | Extract methods |
| Complex conditionals | if (a && b \|\| c && !d) |
Named predicates |
| Comments explaining "what" | // increment i |
Code should be self-documenting |
Good comments explain "why", not "what".
4.4 Consistency
Does this match codebase conventions?
- Formatting (should be automated)
- Naming conventions
- Error handling patterns
- Logging patterns
- File organization
- Import ordering
Consistency > personal preference. Match existing patterns unless changing them project-wide.
β See references/maintainability-checklist.md
Synthesis: Merge Verdict
After all passes, synthesize a verdict:
APPROVE
All of the following are true:
- Verification passed (no structural issues)
- Validation passed (no blockers)
- PR hygiene acceptable
- Maintainability acceptable
- Minor issues documented as non-blocking comments
REQUEST_CHANGES
Any of the following are true:
- Verification failed (structural issues)
- Validation has blockers
- Critical PR hygiene issues (wrong target branch, breaking change without migration)
- Severe maintainability issues
COMMENT
- Validation passed but has recommendations
- PR hygiene suggestions
- Maintainability improvements suggested
- Questions needing answers before approval
Feedback Formatting
Severity Levels
| Level | Meaning | Action |
|---|---|---|
| π« Blocker | Must fix before merge | REQUEST_CHANGES |
| β οΈ Warning | Should fix, but not blocking | COMMENT |
| π‘ Suggestion | Nice to have, optional | COMMENT |
| β Question | Need clarification | COMMENT |
| β Praise | This is good, call it out | APPROVE |
Comment Structure
**[SEVERITY] Category: Brief summary**
[Explanation of the issue]
[Specific location if applicable]
[Suggested fix if applicable]
Example:
π« **Security: SQL injection vulnerability**
User input is interpolated directly into the query string.
`src/db/users.js:47`
Use parameterized queries instead:
```sql
const result = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
### Grouping Feedback
Group by file, then by severity:
```markdown
## src/services/order-service.js
π« **Blocker:** Missing error handling for payment API timeout (line 142)
β οΈ **Warning:** This function is 80 linesβconsider extracting payment logic (lines 120-200)
π‘ **Suggestion:** `processOrder` could be renamed to `submitOrderForPayment` for clarity
## src/controllers/order-controller.js
β
**Good:** Nice input validation pattern, matches our conventions
β See references/feedback-formatting.md
Output Format
Structured Output
{
"verdict": "REQUEST_CHANGES",
"summary": "Security issue blocks merge. Good feature implementation otherwise.",
"passes": {
"verification": {
"status": "fail",
"blockers": 1,
"warnings": 0
},
"validation": {
"status": "pass",
"blockers": 0,
"recommendations": 2
},
"pr_hygiene": {
"status": "pass",
"issues": ["Large PRβconsider splitting in future"]
},
"maintainability": {
"status": "warn",
"suggestions": 3
}
},
"blockers": [
{
"pass": "verification",
"category": "security",
"location": "src/db/users.js:47",
"issue": "SQL injection via string interpolation",
"suggestion": "Use parameterized query"
}
],
"comments": [
{
"severity": "warning",
"location": "src/services/order-service.js:120-200",
"issue": "Function too long (80 lines)",
"suggestion": "Extract payment processing logic"
}
]
}
Conversational Output
## Code Review: Add Order Export Feature
### Verdict: REQUEST_CHANGES
Good feature implementation, but there's a security issue that needs to be fixed before merge.
---
### π« Blockers (1)
**Security: SQL injection in user lookup**
`src/db/users.js:47`
User input is interpolated directly into the query. Use parameterized queries:
```javascript
const result = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
β οΈ Warnings (2)
Long function in order-service.js
src/services/order-service.js:120-200
processOrder is 80 lines. Consider extracting the payment processing logic into a separate function.
Missing test for edge case
The export should handle empty order listsβadd a test case.
π‘ Suggestions (2)
- Rename
processOrdertosubmitOrderForPaymentfor clarity - Consider adding JSDoc for the new
exportOrdersfunction
β What's Good
- Clean separation between controller and service
- Good input validation pattern
- Matches existing codebase conventions
Fix the SQL injection issue, and this is good to merge. The other items are non-blocking.
```
Review Principles
Be constructive, not critical. The goal is better code, not proving you're smart.
Distinguish blocking from non-blocking. Don't block a PR for style preferences.
Explain the "why". "This is bad" isn't helpful. "This could cause X because Y" is.
Offer solutions. Don't just point out problemsβsuggest fixes.
Acknowledge good work. Positive feedback reinforces good patterns.
Right-size the review. A typo fix doesn't need the same scrutiny as a payment system.
Consider the author. Junior dev? More teaching. Senior dev? More trust.
Relationship to Other Skills
| Skill | Relationship |
|---|---|
code-verification |
Invoked as Pass 1 (thorough mode) |
code-validation |
Invoked as Pass 2 |
implement |
Review is the gate after implementation |
test-generation |
Review may identify missing tests |
spec |
Review checks against spec if available |
frontend-design |
(Frontend systems) Review verifies code matches DESIGN.md |
References
references/diff-analysis.md: How to analyze what changedreferences/commit-quality.md: Commit message and history standardsreferences/test-expectations.md: What tests to expect for different changesreferences/maintainability-checklist.md: Code quality checklistreferences/feedback-formatting.md: How to write effective review comments
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.