PABCD Initiative Documentation Hub pabcd_initiative codexclaw cli-jaw

dev-code-reviewer

Source: skills/dev-code-reviewer/SKILL.md

Code review router: findings, severity, verdicts, and review workflow.

왜 별도 모듈인가
코드 리뷰를 'LGTM'으로 끝내는 에이전트는 실질적으로 게이트가 없는 것과 같다. 반대로 모든 스타일 이슈를 블로킹하면 리뷰가 바이크셰딩의 늪이 된다. 이 스킬은 리뷰 순서(보안 > 정확성 > 성능 > 가독성)와 심각도 기반 판정(Block/Request Changes/Approve)을 체계화하여 '진짜 문제'를 찾는 리뷰를 보장한다.
LLM 단독 사용 시 발생하는 문제

LLM이 자기가 쓴 코드를 리뷰하면 자기 확인 편향(confirmation bias)이 극대화된다. 자기가 생성한 패턴을 '올바른 패턴'으로 인식하기 때문에, 구조적 문제를 발견하기 어렵다. 또한 LLM은 '통과한 테스트 = 올바른 코드'라는 단축을 쓰는데, 테스트 자체가 해피 패스만 커버하고 있으면 이 단축이 거짓이 된다. REVIEW-POSTURE-01의 '회의적 외부자' 원칙은 이 자기 확인 루프를 깨뜨리기 위한 것이다.

이 스킬이 해결하는 실제 문제

AI 생성 코드의 자기 리뷰 맹점

에이전트가 코드를 작성하고 자기가 리뷰하면 자기 확인 편향(confirmation bias)이 작동한다. REVIEW-POSTURE-01은 '회의적 외부자'로 접근하라는 원칙이다. 실행자 주장, 통과한 테스트, AI 요약은 직접 확인하기 전까지 신뢰하지 않는다.

AI 리뷰 도구와의 역할 분리

GitHub Copilot Review, CodeRabbit, Sourcery 같은 AI 리뷰 도구가 확산되면서, 사람 리뷰와 AI 리뷰의 경계가 모호해졌다. ai-assisted-review.md는 AI 리뷰가 잘하는 것(패턴 탐지)과 못하는 것(비즈니스 의도 판단)을 분리하고, 재리뷰 정책을 정의한다.

기술 부채의 무한 축적

에이전트는 현재 요구사항만 충족하면 기술 부채를 만들어도 신경 쓰지 않는다. tech-debt.md는 부채를 4분면(reckless/prudent x deliberate/inadvertent)으로 분류하고, 리뷰 시점에 인벤토리에 기록하는 프로세스를 제공한다.

Triggers: review this, code review, PR review, check my diff, before merge, antipattern

Key Concepts

  • Review Posture (skeptical outsider)
  • Pre-Review Automated Scan
  • Review Order by Impact
  • Severity-Based Verdict
  • AI-Assisted Review Integration
  • Tech Debt Inventory

Reference Documents

DocumentDescription
AI-Assisted Code ReviewAI 리뷰 도구 워크플로, 심각도 분류, 재리뷰 정책
Tech Debt Inventory & Paydown기술 부채 4분면, 인벤토리 템플릿, 리뷰 통합, 상환 예산

Sections Overview

SectionSummary
Review Posture회의적 외부자 시점으로 접근, 실행자 주장을 신뢰하지 않는다.
Pre-Review Scan린터/타입체커를 먼저 돌려 기계가 잡을 수 있는 문제를 분리한다.
Review Order보안 > 정확성 > 성능 > 가독성 > 스타일 순서로 리뷰한다.
Verdict System심각도 기반으로 Block/Request Changes/Approve를 판정한다.

Academic References

PaperYearRelevance
GitHub Copilot Code Review: Can AI Spot Security Flaws Before You Commit?
arXiv:2509.13650
2025AI 리뷰어가 SQLi/XSS/역직렬화 같은 치명적 취약점을 자주 놓치며 낮은 심각도로 편향됨.
AI-Assisted Fixes to Code Review Comments at Scale
arXiv:2507.13499
2025대규모 AI 지원 코드 리뷰 코멘트 수정의 실증 연구.
Using an LLM to Help With Code Understanding
arXiv:2307.08177
2024LLM 설명이 코드 리뷰 중 개발자 이해도에 미치는 영향 (ICSE 2024).

Official Guides

Full Specification

Show full SKILL.md content

Dev-Code-Reviewer — Code Review Guide

> C0/C1 work (small local patches): See dev §0.0 Work Classifier + §0.1 Patch Fast-Path before reading references.

> Always read dev/SKILL.md first for project-wide conventions before applying review rules.

Systematic code review patterns for finding real issues, not bikeshedding.

Review Posture (REVIEW-POSTURE-01)

Review as a skeptical, independent outsider. Executor claims, passing tests, AI summaries, and user-facing "done" prose are untrusted until you confirm them yourself. Inspect artifacts before believing them; a green run you did not read is not evidence.

When to Activate

  • Reviewing code changes (own or others')
  • Receiving code review feedback
  • Assessing code quality before merge
  • Evaluating pull requests or diffs
  • Pre-refactoring quality baseline check

---

Modular References

FileWhen to ReadWhat It Covers
references/tech-debt.mdTech debt inventory or paydownDebt quadrant, inventory template, review integration, paydown budget
references/ai-assisted-review.mdUsing AI review tools in PR workflowAI review workflow, severity classification, re-review policy, exclusions, metrics

External/current review evidence

For dependency CVEs, release-note claims, package maintainer/source checks,

provider behavior, or other current/public evidence used in a review, read the

active search skill and follow its query-rewrite, source-fetch, and

evidence-status rules. Browser fetch/open/text/get-dom/snapshot is downstream

verification after candidate URLs exist, not a raw-query search substitute.

---

1. Code Review Process

Pre-Review Checklist

Before reviewing any code, verify:

  • [ ] Build passes (no compile/type errors)
  • [ ] Tests pass (all green)
  • [ ] PR/diff description explains what changed and why
  • [ ] Diff is reasonable size (<500 changed lines — split larger PRs)

Automated Pre-Scan (Run Before Manual Review)

Before reading a single line of code, run automated tools on changed files:

Run project-native linters, type checker, and tests before reviewing.

Pre-Scan Rules:

  1. Critical/error findings → block review. Don't waste human review cycles on machine-detectable problems.
  2. Warnings → note for review, don't block. Mention in review but don't make them blocking.
  3. Tool findings go first in review output, before manual findings.
  4. No tool available? Skip gracefully — pre-scan is additive, not a gate.
ToolCatchesMissesKey Rules
ESLint/RuffStyle, simple bugs, import issuesArchitecture, business logicimport/no-cycle, no-unused-vars, no-floating-promises, complexity
tsc/mypyType errors, null safetyRuntime behavior, performancestrict, noImplicitAny, strictNullChecks
SemgrepInjection, auth bypass, SSRFComplex multi-step vulnerabilitiesjavascript.lang.security.audit.sqli
npm audit/pip-auditKnown CVEs in depsZero-day, license issues

Separation of concerns: Tools catch patterns; humans catch intent. Focus manual review on architecture, correctness, and business logic that tools cannot evaluate.

Review Order (by impact, not preference)

  1. Architecture — Does the approach make sense? Right layer? Right abstraction? Is this the right place for this code?
  2. Correctness — Logic errors, edge cases, off-by-one, null/undefined handling, error paths
  3. Security — Input validation, injection risks, auth checks, secrets exposure
  4. Performance — N+1 queries, unbounded collections, missing indexes, unnecessary computation
  5. Maintainability — Naming, structure, complexity, test coverage, documentation
  6. Style — Last priority. Don't bikeshed formatting when there are real issues.

Delegation: coupling classification belongs to dev-architecture §3; boundary and validation-location findings belong to dev-architecture §4.

Review Mindset

  • Be specific. "This could fail" → "This throws if user is null on line 42"
  • Suggest, don't demand. Unless it's a security or correctness issue.
  • Explain why. Not just "change X to Y" but "X causes N+1 queries because..."
  • Acknowledge good work. If a complex problem is solved elegantly, say so briefly.

Output Contract (REVIEW-OUTPUT-01)

Tool findings go first; then manual findings sorted Critical > High > Medium > Low > Style; then a dedicated blocking_issues block; verdict last. Every finding carries a concrete trigger, impact, and path:line (FAMILY-CITE-01). Do not file pre-existing debt unless the patch worsened it. When a change introduces a value/type/message crossing a module boundary, trace the consumer side before declaring it correct.

Regression & false-confidence tests (REVIEW-REGRESS-01)

Run a dedicated pass: what previously-working behavior can now break, and do the tests cover that surface? Flag deletion-only "fixes", tautological tests, tests that merely mirror the implementation, and scope-drift abstractions added beyond the request.

---

2. Quality Thresholds

Flag these during review:

IssueThresholdSeverity
Long function>50 linesMedium
Large file>400 linesMedium; apply dev-architecture §1 canonical split rule
God class>20 methodsHigh
Too many parameters>5Medium
Deep nesting>4 levelsMedium
High cyclomatic complexity>10 branchesHigh
Missing error handlingany unhandled asyncHigh
Hardcoded secretsAPI keys, passwords in sourceCritical
SQL injectionstring concatenation in queriesCritical
Debug statementsconsole.log, debugger left inLow
TODO/FIXMEunresolved in production codeLow
TypeScript anybypassing type safetyMedium

File Size Guidance

Canonical rule imported from dev-architecture §1: >400 LOC -> split (DEFAULT).

RangeInterpretation 200-400 linesHealthy — easy to navigate and review
400-500 linesShould split unless the author states a concrete reason
>500 linesBlocking review finding unless already being split in this diff

Review Verdict

IndicatorVerdictAction No high/critical issues✅ ApproveMerge
Only Medium/Low/Style issues🔧 Approve with suggestionsFix non-blocking items before/after merge
Any unresolved High issue⚠️ Request changesAuthor must address before merge
Any critical issue🚫 BlockCannot merge until resolved

Deterministic blocker semantics (REVIEW-BLOCK-01): any unresolved Critical or High blocks the merge. Medium may pass only when explicitly judged non-blocking; Style never affects the verdict.

---

3. Common Antipatterns

Structural

PatternSymptomFix
God classOne class does everythingSplit by single responsibility
Long methodFunction does 5+ distinct thingsExtract named helper functions
Deep nesting4+ levels of if/for/tryGuard clauses, early returns, extraction
Feature envyMethod uses another object's data more than its ownMove method to the data owner
Shotgun surgeryOne change requires edits in 10+ filesConsolidate related logic

Dead Code

PatternDetectionFix
Unreachable code after return/throwno-unreachable, compiler warningsDelete the dead branch
Unused imports / variablesno-unused-vars, @typescript-eslint/no-unused-varsRemove
Commented-out code blocksManual reviewDelete — use version control history
Unused exportsts-prune, knip, grep for import sitesRemove export; delete if no internal use
Stale feature-flagged codeCheck flag status in flag serviceRemove dead branch and the flag check

Dead code is a maintenance tax — remove rather than comment out.

Logic

PatternSymptomFix
Boolean blindnessdoThing(true, false, true)Named options object or enum
Stringly typedstatus === 'actve' (typo = silent bug)Define enum or union type
Magic numbersif (retries > 3)Named constant: MAX_RETRIES = 3
Primitive obsessionPassing 5 related strings aroundCreate a data object/type
Direct mutationuser.name = 'x', arr.push(y)Immutable: {...obj, name: 'x'}, [...arr, y]
Missing boundary validationBusiness logic handles raw user inputDelegate placement to dev-architecture §4; schema/content depth to dev-security

Security

Security review items are canonical in §3.5. Use that checklist for hardcoded

secrets, injection, validation, auth, authorization, and logging findings.

Performance

PatternSymptomFix
N+1 queriesLoop → query per itemBatch fetch with WHERE IN (...)
Unbounded collections.all() without LIMITAlways paginate or set max
Missing indexSlow repeated lookups on same columnAdd database index
Premature optimizationComplex caching for 10 rowsProfile first, optimize second

Async

PatternSymptomFix
Floating promisedoAsync() without awaitAlways await or handle rejection
Callback hell4+ nested callbacksRefactor to async/await
Missing timeoutExternal call can hang foreverSet timeout on all network calls

---

3.5 Security Review Quick-Check

For every review, scan for these OWASP-aligned red flags. Delegate to dev-security/SKILL.md for deep analysis.

Must-Check (Every PR)

CheckRed FlagSeverity
Hardcoded secretsapiKey = "sk-...", DB URLs in sourceCritical
SQL/NoSQL injectionString concatenation in queriesCritical
Missing input validationUser input passed to logic without schema checkHigh
Missing auth checkEndpoint accessible without authenticationHigh
BOLA (Broken Object Auth)No ownership check on object access (/users/:id without verifying caller owns resource)High
Secrets in logsconsole.log(req.body) leaking tokens/passwordsHigh

Check When Relevant

CheckWhenRed Flag SSRFExternal URL from user inputNo URL allowlist, no domain validation Path traversalFile path from user inputNo path sanitization, ../ not blocked
Mass assignmentObject spread into DB modelObject.assign(model, req.body) without allowlist
Dep vulnerabilitiesNew dependencies addedNo npm audit/pip-audit run
Lockfile changespackage-lock.json modifiedUnexpected dependency resolution changes

> Deep security analysis → invoke dev-security/SKILL.md. This checklist catches surface-level issues during code review; dev-security provides OWASP Top 10 depth, ASVS checklists, and static analysis integration.

---

3.6 Performance Review Quick-Check

Scan every PR for these common performance pitfalls:

Database & API

CheckRed FlagFix
N+1 queriesLoop containing DB call or API fetchBatch with WHERE IN (...) or DataLoader
Missing pagination.findAll() or SELECT * without LIMITAdd cursor-based or offset pagination
Missing indexNew WHERE/JOIN column without indexCREATE INDEX on filtered/joined columns
Unbounded queryNo LIMIT on user-facing list endpointsAlways set max page size

Frontend-Specific

CheckRed FlagFix
Unnecessary re-rendersState updates in parent causing child re-render cascadeReact.memo, useMemo, extract state down
Bundle size impactNew large dependency (>50KB gzipped)Check bundlephobia.com, consider alternatives or lazy loading
Missing key propList rendering without stable keysUse unique ID, never array index for dynamic lists
Unoptimized imagesLarge images without next/image, loading="lazy", or srcsetUse framework image optimization

General

CheckRed FlagFix
Missing timeoutExternal HTTP call without timeoutSet timeout on all network requests
Sync blockingCPU-intensive work on main thread/event loopOffload to worker/queue
Memory leakEvent listeners/subscriptions without cleanupAdd cleanup in useEffect return / finally block

---

4. Receiving Code Review

The Response Pattern

When receiving review feedback:

  1. READ — Complete feedback without reacting immediately
  2. UNDERSTAND — Restate the technical requirement in your own words
  3. VERIFY — Check the suggestion against codebase reality (does it apply here?)
  4. EVALUATE — Is it technically sound for THIS codebase, not just in theory?
  5. RESPOND — Technical acknowledgment or reasoned pushback
  6. IMPLEMENT — One item at a time, test each change

When to Push Back

Push back when:

  • Suggestion breaks existing functionality (test it)
  • Reviewer lacks full context of the current architecture
  • Violates YAGNI — feature is unused (grep the codebase to verify)
  • Technically incorrect for this technology stack
  • Conflicts with established architectural decisions

How: Use technical reasoning. Reference working tests, existing code, or documented decisions. Never push back emotionally — always with evidence.

Implementation Order (multi-item feedback)

  1. Clarify ALL unclear items FIRST — don't implement based on partial understanding
  2. Blocking issues (security, data loss, broken functionality)
  3. Simple fixes (typos, missing imports, naming)
  4. Complex fixes (refactoring, logic changes)
  5. Test EACH fix individually. Verify no regressions after each.

Acknowledging Feedback

✅ "Fixed. Changed X to use parameterized query."
✅ "Good catch — the null check was missing. Added guard on line 42."
✅ Just fix it and show the result in code.

❌ "You're absolutely right!"
❌ "Great point! Thanks for catching that!"
❌ Any performative agreement without verification

---

5. Requesting Code Review

When to Request

SituationPriority
Before merge to mainMandatory
After major feature completionMandatory
Before large refactoringMandatory
After complex bug fixRecommended
When stuck on approachRecommended
Small config/docs changesSkip unless impactful

How to Request

  1. Ensure build passes and all tests are green
  2. Identify the diff range (base commit → head commit)
  3. Provide a summary: what was implemented, what it should do, areas to focus on
  4. Keep the diff <500 lines. Split larger changes into reviewable chunks.

Acting on Feedback

SeverityAction
CriticalFix immediately, re-request review
HighFix before proceeding to next task
MediumFix before merge, can continue other work
LowNote for later, apply if trivial
StyleApply if trivial, otherwise defer to team conventions

---

6. Sub-Agent Review Mode

Parallelize review only when domain breadth exceeds one reviewer's context (e.g., frontend + backend + infra in a single diff, or when the diff spans too many unrelated domains for a single pass). Each sub-agent receives its file subset, the review process from sections 1-5, and outputs structured findings. The orchestrator deduplicates, normalizes severity, and presents a unified review.

AI Tool Integration Awareness (verified 2026-07-02)

When external AI review tools are available, coordinate — don't duplicate:

ToolStrengthsUse WhenAgent Focus Shifts To
GitHub Copilot Code ReviewFull repo context, multi-model, auto-fix PRsPR review on GitHubArchitecture, business logic, domain correctness
CodeRabbit40+ linters, learnable preferences, low false-positiveTeam with .coderabbit.yml configuredCross-service impact, subtle logic errors
Cursor BugbotDiff-focused bug hunting in Cursor PR flowCursor-based teamsIntent, architecture, exploitability
Graphite AI Reviews (Diamond)Stacked-PR-aware AI reviewGraphite stacked workflowCross-stack consistency
SonarQube (+AI capabilities)Enterprise SAST, tech debt tracking, security depthRegulated environments, existing setupReview findings, add context tools miss
Manual agent reviewFull codebase understanding, intent verificationNo external tools, offline, sensitive codeEverything — full §1-5 process

Coordination rules:

  • If an external AI tool already reviewed the PR, read its findings first, then focus

manual review on what tools cannot do: architectural fit, business intent, cross-system impact.

  • STRICT (REVIEW-AI-EVIDENCE-01): AI review findings are evidence to inspect, not

authority — de-duplicate, reproduce, and severity-normalize them before inclusion.

Published evaluation of AI reviewers shows frequent misses on critical vulnerabilities

(SQLi/XSS/deserialization) with low-severity skew, so AI output never replaces the

§3.5 security pass (source: arXiv:2509.13650, checked 2026-07-02).

---

7. Reviewing AI-Generated Code

AI-authored diffs have distinct failure modes. Run this pass IN ADDITION to §1-3 when

the diff is substantially AI-generated (agent commits, Copilot/Cursor bulk changes):

CheckAI failure modeAction
Invented APIsPlausible-but-nonexistent methods/optionsVerify each unfamiliar API against the installed version's docs
Hallucinated dependenciesPackage names that don't exist (slopsquatting attack surface)Verify existence/maintainer/provenance before install — gate owned by dev-security §6.5
Missing authz edgesHappy-path handlers without ownership checksTrace every new endpoint against §3.5 BOLA check
Shallow/mirroring testsTests restating the implementation, tautologiesApply REVIEW-REGRESS-01; require behavior-level assertions
Test-induced defenseProduction guards added to satisfy unrealistic testsDelegate to dev-testing §6.7 detection table
Scope driftAbstractions/refactors beyond the requestFlag; one logical change per PR (dev §1)

Agentic/security review trigger (DEFAULT): if a PR adds MCP servers, tools, agents,

RAG components, persistent memory, delegated credentials, or autonomous actions, invoke

dev-security and map risks to the OWASP LLM Top 10 (2025) and the OWASP Top 10 for

Agentic Applications 2026.

---