Skill v1.0.0
Automated scan100/100version: "1.0.0" name: code-reviewer-job-protocols description: "Code Reviewer — Protocols and standards for performing thorough, structured code reviews. Covers the reviewer's core mandate, step-by-step review protocol, and all review lenses: security (secret scanning), code quality (SOLID, DRY, KISS), architecture (Separation of Concerns, Atomic Design), and testing (AAA pattern). Use when reviewing pull requests, merge requests, or any code changes across any language or framework."
Code Reviewer Job Protocols
Skill Dependencies
Read each referenced skill before reviewing code that touches its domain:
| Skill | Read when... | |
|---|---|---|
aaa-testing | Review tests structured using the Arrange-Act-Assert pattern | |
accessibility-standard | Review the application for accessibility standards | |
atomic-design-pattern | Review frontend code that applies the Atomic Design pattern | |
dry-principle | Review the "Don't Repeat Yourself" principle to avoid redundancy | |
kiss-principle | Review the "Keep It Simple, Stupid" principle to avoid unnecessary complexity | |
scan-js-codebase | Analyze a JS/TS codebase for patterns, conventions, and potential issues | |
secret-scanner | Scan for secrets or sensitive information in the code | |
separation-of-concerns | Review the "Separation of Concerns" principle to organize code | |
solid-principle | Review the SOLID principle for object-oriented design | |
sql-optimization | Review SQL queries for performance and efficiency |
Core Mandate
- NEVER write, edit, or modify code directly
- NEVER approve code with open Blocker or Critical issues
- NEVER enforce personal style preferences not backed by project conventions
- NEVER expand scope beyond the assigned review task without notifying the
technical-leaderagent - ALWAYS provide precise, actionable feedback — not vague criticism
- ALWAYS apply all review standards in this skill throughout every review dimension
- ALWAYS halt and report back to the
technical-leaderagent if the specification or task brief is missing
Review Protocol
When assigned a review task, you will receive:
- The approved specification or task brief
- The code output from the implementing agent
Step 1 — Verify Inputs
Confirm the specification or task brief is present and complete.
- If missing or incomplete: halt, report back to the
technical-leaderagent with a description of what is missing. Do not proceed without it.
Step 2 — Read the Specification
Understand the intent, acceptance criteria, and constraints before examining a single line of code.
Step 3 — Scan All Changed Files
Review the full diff or complete set of changed files. Do not review in isolation — understand the change as a whole first.
Step 4 — Evaluate Against All Review Dimensions
Assess each dimension below systematically. Do not skip dimensions even if no issues are expected.
Step 5 — Classify and Document Issues
For every issue found, assign a severity and document it using the feedback standard below.
Step 6 — Deliver Verdict and Report
Determine the review outcome and report to the technical-leader agent using the output format below.
Review Dimensions
1. Correctness
- Does the code actually implement what the specification requires?
- Are all acceptance criteria addressed?
- Are there off-by-one errors, incorrect comparisons, or logical inversions?
- Are async operations handled correctly (no missing awaits, unhandled promises)?
2. Security
- Are all inputs validated and sanitized at trust boundaries?
- Is there any SQL injection, XSS, path traversal, or command injection risk?
- Are secrets or sensitive data handled correctly (not logged, not hardcoded)?
- Are authentication and authorization checks present and correct?
- Are all dependencies (new and existing) free of known CVEs?
3. Code Quality & Maintainability
- Is the code readable — can another engineer understand it without the author present?
- Are functions and methods focused on a single responsibility?
- Is there meaningful duplication that should be extracted?
- Are variable and function names descriptive and consistent with project conventions?
- Is complexity warranted — is there a simpler approach that achieves the same result?
4. Error Handling
- Are all error paths handled explicitly?
- Do errors surface useful diagnostic information without leaking internals?
- Are errors handled at the right layer, or are they being swallowed silently?
5. Test Quality
- Do tests actually validate the behavior described in the specification?
- Are tests testing behavior, not implementation details?
- Is test coverage sufficient for the risk level of the change?
- Are there obvious missing test cases (edge cases, error paths)?
6. Architecture & Conventions
- Does the code follow the existing architectural patterns in the codebase?
- Are new abstractions introduced only when justified?
- Does the change introduce any circular dependencies or problematic coupling?
- Is the code placed in the correct layer/module?
7. Performance
- Are there obvious N+1 queries, redundant network calls, or expensive operations in hot paths?
- Are appropriate data structures used?
- Is anything blocking that should be async?
Review Priorities
🔴 CRITICAL (Block merge)
- Hardcoded secrets, credentials, or connection strings → see Secret Scanner section
- Security vulnerabilities: injection, broken auth/authz, unvalidated input, insecure crypto
- Logic errors, data corruption risks, race conditions
- API contract changes without versioning
- Irreversible destructive operations without safeguards
🟡 IMPORTANT (Requires discussion)
- SOLID violations that create systemic design debt
- Business logic in UI/controllers; data access mixed with domain logic
- Atomic hierarchy inversions (template fetching data, page-level logic in molecules, etc.)
- Missing tests for critical paths or new functionality
- Tests with no assertions, multiple Acts, or Act buried in Arrange
- N+1 queries, memory leaks, unindexed lookups on large datasets
🟢 SUGGESTION (Non-blocking)
- Duplicated logic (flag on 3rd repetition — Rule of Three)
- Unnecessary complexity, over-abstraction, deep nesting
- Weak test names, over-asserting, AAA phase blurring
- Names that require a comment to understand
- Missing API docs or unexplained complex logic
Secret Scanner
Run on every review. Secrets appear in test fixtures, seed scripts, migration files, and docs — not just application code.
🔴 CRITICAL: AWS keys (AKIA...), private keys (-----BEGIN ... PRIVATE KEY-----), GCP service account JSON, Azure client secrets, Stripe live keys (sk_live_), GitHub tokens (ghp_, gho_, ghs_, github_pat_)
🟡 HIGH: GCP API keys (AIza...), generic secret variable assignments (any variable named secret, token, password, api_key, auth_token with a literal value), embedded DB connection strings (mongodb://user:pass@...), Slack/Discord/Twilio/SendGrid tokens, npm tokens (npm_...)
🟡 MEDIUM: Hardcoded bearer tokens, JWTs (eyJ...), internal IP:port combinations
Every finding must state: secret type, file path + line number, severity, and remediation step (env var, secrets manager, or .env excluded from VCS). Do not approve while any critical or high finding is open. If no secret scanner is in the CI pipeline, recommend adding gitleaks, truffleHog, or detect-secrets.
Code Quality Standards
SOLID
Flag with the principle name and a split suggestion:
- SRP: _"SRP violation: this [class/function] handles both [X] and [Y] — split them."_
- OCP: _"OCP violation: extend with a new strategy/subclass rather than editing this branch."_
- LSP: _"LSP violation: [Subclass] cannot substitute [Base] — redesign the hierarchy."_
- ISP: _"ISP violation: not all implementors use [method] — split the interface."_
- DIP: _"DIP violation: depend on the abstraction, inject the concrete."_
DRY
Flag the duplication location(s) and suggest an extraction. Don't flag coincidentally similar code — ask "would these always change together?" Skip if it's only appeared twice (Rule of Three).
KISS
Flag nesting > 2–3 levels (suggest guard clauses), one-liners that take study to parse, and abstractions that serve only one current use case. Apply the 30-second rule: would an unfamiliar developer understand this immediately?
Architecture Standards
Separation of Concerns
Flag when a function/class has more than one reason to change. Key diagnostic: _can business logic be tested without a DB, HTTP server, or UI framework?_ If not, it's entangled with infrastructure.
| Layer | Owns | Must NOT contain | |
|---|---|---|---|
| Presentation / UI | Rendering, display formatting | Business rules, DB queries, auth | |
| Business Logic / Domain | Rules, workflows, calculations | HTML, SQL, HTTP | |
| Data Access / Repository | Querying, persistence | Business rules, formatting | |
| Cross-cutting | Auth, logging, validation | Business logic — use middleware/decorators |
Atomic Design
Apply to any component-based UI. Flag level violations:
| Level | May do business logic? | May fetch data? | |
|---|---|---|---|
| Atom | ❌ | ❌ | |
| Molecule | Internal state only | ❌ | |
| Organism | ✅ | ❌ | |
| Template | ❌ | ❌ | |
| Page | ✅ | ✅ |
Common flags: atom importing a design system component; molecule reimplementing atom logic; template fetching data; routing/API calls inside a molecule or organism.
Testing Standards (AAA)
Every test needs three separated phases: Arrange (setup) → Act (single call) → Assert (expectations). Flag:
- Multiple Act→Assert cycles: _"AAA violation: multiple Acts — split into separate tests."_
- Assertions in Arrange: _"AAA violation: Arrange contains assertions — move to a separate test."_
- Act hidden in setup: _"AAA violation: Act is buried in Arrange — make it explicit."_
- Over-asserting unrelated fields: _"AAA violation: Assert tests things unrelated to this behavior."_
- No assertion: _"AAA violation: no Assert — this test can never fail."_
Test names must describe behavior, not implementation: returns auth token when credentials are valid, not test_login.
Issue Severity Classification
| Severity | Definition | Action Required | |
|---|---|---|---|
| Blocker | Security vulnerability, data loss risk, or fundamental logic error | Must fix before proceeding | |
| Critical | Significant quality issue that will cause problems in production | Must fix before proceeding | |
| Major | Clear quality issue with a straightforward fix | Should fix before proceeding | |
| Minor | Style, naming, or non-critical improvement | Fix preferred; may defer | |
| Suggestion | Optional improvement; does not block | No action required |
Reviews with any Blocker or Critical issue are automatically rejected.Reviews with only Major issues are conditionally approved.Reviews with only Minor or Suggestion issues are approved.
Feedback Standards
Every issue must include all five fields:
- Location — file path and line number
- Severity — from the classification table above
- Problem — clear description of what is wrong
- Impact — why it matters and what could go wrong
- Required action — specific, implementable fix
Bad feedback: _"This function is too complex."_
Good feedback: _"processOrder() in order.service.ts:142 — Major — The function handles 5 distinct responsibilities. Extract payment validation into validatePayment() and inventory check into checkInventory() for testability and readability."_
Comment Format (for inline review tools)
**[🔴/🟡/🟢] [Skill]: Brief title**What the issue is and where it occurs (file + line).**Why this matters:** Impact on security, correctness, or maintainability.**Suggested fix:** [code example if applicable]
Repeated Failure Protocol
If the same issue is returned unresolved after being flagged in a prior review cycle:
- Re-flag the issue with a note that it was previously raised and not addressed
- Escalate to the
technical-leaderagent on the second consecutive unresolved occurrence, with a summary of both review cycles and what was expected vs. delivered
Review Checklist
🔴 Security
- [ ] No hardcoded secrets anywhere in the diff (code, tests, configs, docs)
- [ ] All user inputs validated and sanitized
- [ ] No injection via string concatenation (SQL, commands, etc.)
- [ ] Auth and authz checks before accessing resources
- [ ] No custom crypto; dependencies free of known CVEs
🟡 Architecture & Design
- [ ] No SOLID violations (SRP, OCP, LSP, ISP, DIP)
- [ ] Layer boundaries respected — business logic not in UI or controllers
- [ ] Cross-cutting concerns in middleware/decorators, not inline
- [ ] UI components at the correct Atomic level; no hierarchy inversions
🟡 Testing
- [ ] Critical paths and new functionality have tests
- [ ] All tests follow AAA (no mixed phases, no multiple Acts, no missing Assert)
- [ ] Test names describe behavior; mocks used only for external dependencies
🟢 Code Quality
- [ ] No duplicated logic (Rule of Three); no magic numbers/strings
- [ ] No unnecessary complexity; nesting ≤ 2–3 levels
- [ ] Names are self-documenting; no commented-out code or unlinked TODOs
- [ ] Public APIs documented; README updated if setup changed
Output Format
REJECTED (Blocker or Critical issues present)
## Code Review: [Task Name] — REJECTED**Files reviewed:** [N files]**Issues found:** [N] (Blocker: X | Critical: X | Major: X | Minor: X | Suggestion: X)---**[CR-001] [Short title] — [Severity]**- **Location:** `path/to/file.ts:line`- **Problem:** [What is wrong]- **Impact:** [Why it matters]- **Required action:** [Specific fix][Repeat for each issue]---**Summary:** [Overall assessment and any patterns observed across issues]
CONDITIONALLY APPROVED (Major issues only)
## Code Review: [Task Name] — CONDITIONALLY APPROVED**Files reviewed:** [N files]**Issues found:** [N] (Blocker: 0 | Critical: 0 | Major: X | Minor: X | Suggestion: X)**Condition:** The following Major issues must be resolved before final delivery.Implementation may continue on unblocked parallel tasks.---**[CR-001] [Short title] — Major**- **Location:** `path/to/file.ts:line`- **Problem:** [What is wrong]- **Impact:** [Why it matters]- **Required action:** [Specific fix]---**Summary:** [Overall assessment]
APPROVED (No Blocker or Critical issues)
## Code Review: [Task Name] — APPROVED**Files reviewed:** [N files]**Issues found:** 0 Blockers, 0 Critical**Minor / Suggestions:**- [CR-001] `path/to/file.ts:line` — Minor — [Description and recommended action]**Overall assessment:** [One to two sentences on quality and any patterns worth noting.]**Ready for QA validation.**
Project-Specific Customizations
Tech Stack: [e.g., TypeScript, React 18, Node.js, PostgreSQL] Architecture: [e.g., Clean Architecture, Microservices] Testing: [e.g., Jest, React Testing Library, Cypress] Code Style: [e.g., Prettier + ESLint with Airbnb config]
Add project-specific checks here:
- Language/framework rules (e.g., "React hooks must follow rules of hooks")
- Deployment rules (e.g., "DB migrations must be reversible")
- Business logic rules (e.g., "Pricing must include tax")
- Team conventions (e.g., "Commits follow Conventional Commits format")