{"data":{"slug":"discovered-8efe305d2cfdbff61ba03b7b35deeb4663aabc935c193fac","title":"Code Review Methodology","summary":"A multi-dimensional code review framework that audits complex software modules across 18 quality dimensions in three passes \u2014 execution\/integration, architecture\/systems, and reliability\/correctness. Includes E2E-test review angles, migration review angles, and derived rules. Use when reviewing a module, pull request, or code change for bugs, architecture, or security issues.","url":"https:\/\/skillshunter.net\/skills\/discovered-8efe305d2cfdbff61ba03b7b35deeb4663aabc935c193fac","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-8efe305d2cfdbff61ba03b7b35deeb4663aabc935c193fac","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-8efe305d2cfdbff61ba03b7b35deeb4663aabc935c193fac.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-8efe305d2cfdbff61ba03b7b35deeb4663aabc935c193fac\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before starting the review, ensure that all files in the module boundary are listed and verified. For every new or changed public symbol, grep the whole repo for all callers and verify each one with at least 8 lines of context. The first deliverable is a review log with findings, severity, exact location (file:line), and impact description.","instructions":"---\nname: code-review-methodology\ndescription: Multi-dimensional review framework for auditing complex software modules across 18 quality dimensions in three passes \u2014 execution\/integration, architecture\/systems, reliability\/correctness. Includes multi-angle iterative review, E2E-test review angles, migration review angles, and derived rules. Use when reviewing a module, pull request, or code change for bugs, architecture, or security issues. \u591a\u7ef4\u5ea6\u4ee3\u7801\u5ba1\u67e5\u6846\u67b6\uff1a\u4e09\u904d\u626b\u63cf\u8986\u76d6 18 \u4e2a\u8d28\u91cf\u7ef4\u5ea6\uff08\u6267\u884c\/\u96c6\u6210\u3001\u67b6\u6784\/\u7cfb\u7edf\u3001\u53ef\u9760\u6027\/\u6b63\u786e\u6027\uff09\uff0c\u542b\u591a\u89d2\u5ea6\u8fed\u4ee3\u5ba1\u67e5\u3001E2E \u6d4b\u8bd5\u5ba1\u67e5\u4e0e\u8fc1\u79fb\u5ba1\u67e5\u3002\u5ba1\u67e5\u6a21\u5757\u3001PR \u6216\u4ee3\u7801\u53d8\u66f4\u7684 bug\u3001\u67b6\u6784\u4e0e\u5b89\u5168\u95ee\u9898\uff08\u542b\u4e2d\u6587\uff09\u65f6\u4f7f\u7528\u3002\nkeywords: [review, audit, code, pr, diff, lint, \"pull request\", check, \u8bc4\u5ba1, \u4ee3\u7801\u5ba1\u67e5, \u5ba1\u6838]\n---\n# Systematic Code Review Methodology\n\nMulti-dimensional review framework for auditing complex software modules. Covers 18 quality dimensions across three review passes, plus multi-angle iterative review for cross-cutting features.\n\n## Review Passes\n\n### Pass 1 \u2014 Execution & Integration (7 dimensions)\n\nFocus on what's broken *right now* \u2014 bugs, gaps, missing wiring.\n\n| Dimension | Key Questions |\n|-----------|---------------|\n| **Task Lifecycle** | Are all states (PENDING\u2192QUEUED\u2192RUNNING\u2192COMPLETED\/FAILED\/BLOCKED) handled? Are transitions validated? Is BLOCKED visible? |\n| **Tool Calling** | Does every code path that needs tools have them? Are tools injected at the right layer? Are dynamic extensions missing tool handlers? |\n| **Streaming** | Are SSE\/websocket events real-time or batched? Are callbacks bridging async\u2192generator correctly? Is backpressure handled? |\n| **Memory** | Do worker outputs flow back into shared context? Do downstream steps see upstream results? Is memory compressed\/saved at boundaries? |\n| **Retries \/ Failure** | Is the escalation chain complete (retry\u2192downgrade\u2192re-decompose\u2192report)? Are retries bounded? Do failed upstream steps block\/unblock downstream correctly? |\n| **Logging** | Are critical paths logged at info level? Are debug logs hiding in production? Are audit events logged? |\n| **Governance** | Is approval wiring end-to-end? Do workers gate on approvals? Are permission checks performed before execution? |\n\n### Pass 2 \u2014 Architecture & Systems (6 dimensions)\n\nFocus on *how* the system runs, scales, and breaks.\n\n| Dimension | Key Questions |\n|-----------|---------------|\n| **Distributed Systems** | Is state shared across workers? Are there module-level mutable globals? Is the task queue persistent or in-memory? Are there distributed locks? |\n| **Runtime Architecture** | Are resources (connections, agents) pooled or leaked? Are there dual implementations of the same concept? Is there connection reuse? |\n| **Async Systems** | Are async primitives used correctly? Is publish() sequential or parallel? Are there sync IO calls in async paths? Is backpressure implemented? |\n| **Security Engineering** | Are shell\/file operations gated on every path? Is user input sanitized before prompt injection? Is there rate limiting? Are secrets ever exposed in logs? |\n| **Observability** | Can you trace a single request end-to-end? Are session ids consistent across layers? Are metrics exported? Is log rotation configured? |\n| **Workflow Orchestration** | Are dependency types (HARD\/SOFT\/DATA) enforced? Is there cycle detection in the DAG? Are step timeouts configured? Is there pause\/resume\/checkpoint? |\n\n### Pass 3 \u2014 Reliability & Correctness (5 dimensions)\n\nFocus on *what happens when things go wrong*.\n\n| Dimension | Key Questions |\n|-----------|---------------|\n| **Governance** | Is governance unified or split across layers? Are cost quotas enforced per-step? Are permission states persisted or in-memory? |\n| **Validation** | Are step ids checked for uniqueness? Are dependency references validated against existing ids? Are self-references detected? Are lengths bounded? |\n| **Schema Enforcement** | Are there duplicate model definitions? Are enum-like strings typed? Are registries consistent across layers? Do all models carry the same fields across boundaries? |\n| **Retries** | Is the backoff strategy exponential with jitter? Are retry budgets layered (HTTP \u00d7 task \u00d7 DAG)? Are side-effect operations idempotent under retry? |\n| **Fallback** | Is there a model\/provider downgrade path? Is there tool-level recovery? Is there a checkpoint\/restore mechanism? |\n\n## Priority Tiers\n\n| Tier | Label | Criteria | Examples |\n|------|-------|----------|----------|\n| **P0** | Fix now | Crash, infinite loop, security vacuum, data corruption | Missing approval gate, cycle in DAG, no step timeout |\n| **P1** | Fix soon | Feature broken in common path, observability gap, leak | Resource leak, broken trace id, no exponential backoff |\n| **P2** | Should fix | Design debt, missing feature, non-critical edge case | Unsupported dependency type, no rollback, dual governance |\n| **P3** | Nice to have | Polish, nice-to-have, rare edge case | Log format, deadlock detail logging, sync IO cleanup |\n\n## Review Workflow\n\n```\n1. SCOPE         \u2192 List all files in the module boundary (list dir, grep)\n2. READ          \u2192 Read every file in the critical path (don't skip)\n3. TRACE         \u2192 Follow the data flow: API \u2192 Service \u2192 Engine \u2192 Worker\n4. SCAN-PUBLIC   \u2192 For every new\/changed public symbol (enum value, class, function),\n                    grep the whole repo for all callers and verify each one with\n                    at least 8 lines of context. Include:\n                    - Enum additions: check all `if x == Enum` comparisons and\n                      `x in {...}` set membership checks for breakage\n                    - Function signature changes: verify every call site still\n                      works with new params\n                    - Type additions: verify serialization\/deserialization paths\n5. FIND          \u2192 For each dimension, ask the standard questions\n6. DOCUMENT      \u2192 Write findings with: severity, exact location (file:line), impact description\n7. CROSS-REFERENCE \u2192 Note findings that appear in multiple dimensions (highest priority)\n8. PRIORITIZE    \u2192 Assign P0-P3 with estimated effort\n9. PUBLISH       \u2192 Write the review to your repo's review log with date + module\n```\n\n## Output Format\n\nEach finding:\n\n```\n| Severity | Issue | `file:line` | Impact |\n```\n\nMaster aggregation should include:\n- Deduplication across review passes\n- Cross-reference tracking (which passes found the same issue)\n- Heatmap of dimensions vs priority tiers\n- Fixed\/unfixed status tracking\n\n## Cross-Dimension Correlation\n\nFindings that appear in multiple dimensions signal architectural flaws, not isolated bugs:\n\n| Pattern | Dimensions | Meaning |\n|---------|-----------|---------|\n| Approval gap | Security + Governance + Runtime | A governance design exists but doesn't reach the execution path |\n| Dual implementations | Architecture + Schema + Orchestration | Two code paths evolved separately, will diverge further |\n| Missing fallback chain | Retries + Fallback + Architecture | Resilience was designed but not wired through |\n| Capability promise gap | Security + Tool Calling + Governance | A role\/agent card promises read-only but its tool registry exposes destructive tools \u2014 safety relies on prompt discipline instead of toolset enforcement. Check both the registry layer and the posture\/permission layer \u2014 fixing only one leaves the other exposed |\n\n## Library \/ Utility Module Review\n\nWhen reviewing a non-runtime library module, the dimensions shift from runtime concerns to **correctness, integration, and hygiene**.\n\n**Pass 1 \u2014 Code Quality**: data model correctness (field validation, enum\u2192string coercion, lossless serialization roundtrips), edge cases (empty inputs, None, missing files, corrupted data), accurate type hints, docstrings matching behavior, dead code.\n\n**Pass 2 \u2014 Integration & Consistency**: cross-module wiring (does data flow correctly between modules?), naming consistency, paired-dictionary key alignment (e.g. LANGUAGE_MAP vs FILE_TYPE_MAP keys must match), `__init__.py` exports, design-doc alignment.\n\n**Pass 3 \u2014 Safety & Performance**: SQL injection (parameterized queries), path traversal (`resolve()` + containment check, symlinks off by default), memory (large files read in chunks), error handling (OSError\/JSONDecodeError caught, actionable messages).\n\n**Tool-assisted review notes**:\n1. `ruff check <path>` (project rules) \u2014 import hygiene, trailing commas\n2. `ruff check --select=ALL <path>` \u2014 broader issues; respect project config (many violations may be intentional)\n3. `git diff --stat HEAD` after auto-fix \u2014 verify the fixer only touched what you expected\n4. Run the full test suite after any fix \u2014 no matter how trivial\n5. `python -c \"import module\"` \u2014 verify no import errors after `__init__.py` changes\n6. **Don't trust project-rules-only lint config**: if `pyproject.toml` selects only a few rules, running all rules reveals far more issues (many auto-fixable). Check the config before deciding what to fix.\n\n## Multi-Angle Iterative Review\n\nWhen reviewing a cross-cutting feature that touches multiple layers (API, UI, persistence, tests), a single-pass review finds at most ~30% of real bugs. The remaining 70% surface only when you deliberately switch angles.\n\n### The pattern: Review \u2192 Fix \u2192 Repeat \u00d7 N\n\nEach round picks ONE family of angles. Don't mix families \u2014 the brain optimizes for the first pattern it recognizes and becomes blind to others.\n\n**Core insight**: Early rounds find bugs in *what was built*. Later rounds find bugs in *how it connects to everything else*. Cross-module issues are invisible until the core implementation stabilizes \u2014 that's why you need multiple passes.\n\n### 8 angle families\n\n| Family | What it catches | Example questions |\n|--------|-----------------|-------------------|\n| **Architecture & Design** | Model mismatch, missing routes, DRY violations | Do all layers agree on field names and types? Is every endpoint registered? |\n| **Data Flow** | Write paths without persistence, broken roundtrips | If I mutate state, does it survive a restart? Do all consumers receive updates? |\n| **Security** | Injection, unauthorized execution, prompt leaks | Is every user input validated before reaching the runtime? Is there a whitelist? |\n| **Concurrency & Async** | Deadlocks, event-loop blocking, race conditions | What's the lock acquisition order? Any sync I\/O in async functions? |\n| **Backward Compatibility** | Breaking existing data, event contract changes | Does old data load without errors? Do existing consumers understand new fields? |\n| **Error Handling** | Missing 4xx\/5xx, silent failures, missing fallbacks | What happens when the external dependency is down? Does the UI close the modal? |\n| **Test Quality** | Selector mismatches, missing coverage, unrealistic mocks | Does every UI test selector exist in the component? Are edge cases covered? |\n| **Code Quality** | Unused code, type errors, coercion bugs | Any imports that nothing uses? Bytes vs string mismatches? |\n\n### Rules\n\n1. **One family per pass.** Checking security and data flow in the same pass guarantees you'll miss subtle issues in both.\n2. **Grep test selectors against source before writing tests.** For every selector or identifier used in a test file, verify the corresponding attribute\/element exists in the production code. A 10-second grep prevents a wasted review round.\n3. **Assume every async\/sync boundary is wrong until proven correct.** Static tools rarely catch sync functions calling async methods without `await`, or blocking I\/O inside an event loop.\n4. **Trace every state mutation to its persistence call.** \"In-memory only\" is the most common data-loss bug in stateful backends.\n5. **Cross-module issues are invisible in single-file review.** When two files implement parallel versions of the same logic, review them side-by-side in the same pass.\n6. **Commit per fix, not per review round.** Keeps `git bisect` functional.\n7. **Verify after every edit.** A 3-second syntax check catches broken commits before they land.\n8. **New enum variant \u2192 full-codebase grep.** Adding a value to an enum\/union\/dict key-set without grepping all consumers is the most common silent-gap bug. Grep the type name AND every existing variant value (raw strings) \u2014 mapping dicts, switch cases, match arms, if-elif chains, serialization round-trips. Pay special attention to `.get(x, default)` \u2014 it masks the gap.\n9. **Dual-module consistency check.** When the same event\/concept is projected by two modules, verify they agree on output shape. Neither module is individually wrong, but their outputs diverge silently.\n10. **Snapshot payload \u2260 state.** When a system writes snapshots, verify the snapshot content is the accumulated state, not the triggering event's payload (the implementation defaults to the data at hand).\n11. **Real integration smoke test before sign-off.** Start the actual server and hit the changed endpoint. Mock-only testing cannot catch import errors, route registration failures, middleware misconfiguration, or key-resolution bugs.\n12. **Warning\/error pattern precision.** Test that warnings fire for the RIGHT imports\/paths and not unrelated ones \u2014 a `DeprecationWarning` in a package `__init__` can fire on every import of any symbol from that package.\n\n### When to use which strategy\n\n| Scope | Strategy |\n|-------|----------|\n| Single-file bug fix | 1 family (usually Data Flow or Error Handling) |\n| New module (< 200 lines) | 2 families: Architecture + Data Flow |\n| Full-stack feature (FE+BE+tests) | 3\u20135 families minimum |\n| Security-critical path | All 8 families |\n| Refactor touching > 5 files | All 8 families |\n\n### Universal verification checklist\n\nRun after *every* review round, regardless of language or stack:\n\n- [ ] Compile\/parse check for every changed file\n- [ ] Type-check if the language has a type checker\n- [ ] Grep all test selectors\/identifiers against source code\n- [ ] `git diff --stat` \u2014 verify the file list matches intent\n- [ ] Manual trace: pick one user action, follow it from entry point to persistence and back\n- [ ] Audit every I\/O call for async\/sync correctness\n- [ ] For every state change in memory, verify a corresponding persistence call exists\n- [ ] If enum\/type-union changed: grep all consumers of that type name + every existing variant value\n\n## E2E + LLM-Driven Test Review Angles\n\nWhen reviewing persona-driven, LLM-as-Judge, or multi-layer E2E tests, the standard angles miss test-infrastructure bugs that only surface at runtime:\n\n| # | Angle | What it catches |\n|---|-------|-----------------|\n| 19 | **DOM Selector Fidelity** | Selectors in test JSON\/TS that don't match actual `data-testid` attributes or DOM structure |\n| 20 | **Behavioral Flag Defaults** | Test steps that assume a component flag is on but the source defaults it to off \u2014 the test exercises a different code path than intended |\n| 21 | **Response Collection Correctness** | Element-type mismatches: collecting `.first()` when multi-turn\/multi-element scenarios need all elements; page-type-specific selectors (chat vs plan) |\n| 22 | **LLM-as-Judge Safety** | Judge API calls that flood the backend, miss fallbacks, or use wrong request shapes |\n| 23 | **Cross-Page State Isolation** | Scenarios that navigate between pages while quality-check selectors only work on the origin page |\n| 24 | **Test Environment Dependencies** | Missing env vars, port conflicts, concurrent-test safety, timeout stacking |\n\n**Rules for E2E test review:**\n1. Grep every test selector against source before trusting it \u2014 a selector that silently matches nothing wastes a whole round.\n2. Every behavioral toggle in the source has a default \u2014 find it. If the test needs the toggle ON but never clicks it, the test is exercising a different path.\n3. Response-text extraction must be page-aware, not hard-coded to one selector.\n4. LLM-as-Judge must degrade gracefully in 3 failure modes: backend unreachable \u2192 skip; API timeout \u2192 heuristic fallback; malformed response \u2192 text-based heuristic. All three paths must be exercised in review.\n\n## Data Migration Review\n\nWhen reviewing a data migration (format upgrade, schema change, file conversion), the standard angles miss **data-integrity bugs** that only surface in the target dataset:\n\n| # | Angle | What it catches | Example |\n|---|-------|-----------------|---------|\n| 25 | **Source-Target Cardinality** | File\/record count mismatch between source and target | 187 source files vs 152 target \u2014 35 missing, source grew after migration |\n| 26 | **Field Completeness Across Code Paths** | New fields added to one function but not its sibling | One search path extracts the new dict, the other never passes it |\n| 27 | **Idempotency Under Re-run** | Non-idempotent transforms that corrupt data on second pass | Re-running the migration should skip everything; any non-skip is a bug |\n| 28 | **Path Traversal in Resolver Functions** | `Path(user_input)` without `resolve()` + containment check | `_resolve(\"..\/..\/..\/etc\/passwd\")` escapes the target directory |\n\n**Migration review workflow:**\n\n```\n1. COUNT          \u2192 Compare counts: source vs target (mismatch = bug)\n2. RE-RUN         \u2192 Execute migration again; verify ALL skip (idempotency)\n3. SAMPLE         \u2192 Random-sample 3-5 target files; verify new + old fields\n4. DIFF-BODY      \u2192 For one file, verify body unchanged (only metadata modified)\n5. CROSS-PATH     \u2192 For every output constructor, verify fields appear in ALL paths\n6. VALIDATE       \u2192 Run the target validator on the full directory\n7. SECURITY-SCAN  \u2192 Audit every Path(user_input) for traversal\n```\n\n**Derived rules:**\n1. Count before trusting. `len(source) == len(target)` catches 100% of stale-target bugs.\n2. Re-run proves idempotency. Second run with all skips = correct.\n3. Cross-path field audit: a new field in constructor A but not B is a bug, not a TODO.\n4. Every user-input path needs a fence: `resolve()` + `relative_to` containment check.\n\n## Pre-deletion safety (refactor reviews)\n\nBefore deleting any file: grep the full project for its path, imports, and exported symbols. Archive references are acceptable \u2014 active code references are NOT. Auto-generated reference docs (route indexes, README tables, endpoint counts) drift from actual code \u2014 re-check the doc's claim against the code before trusting a \"0 endpoints\" report.\n\nAlso check for unreachable code after `return`\/`raise`\/`sys.exit`: read the 5 lines after each at function scope; code after a return statement is dead code \u2014 the most common round-2 discovery.\n","use_cases":["Reviewing a module for bugs, architecture, or security issues","Auditing a pull request or code change for quality and correctness","Ensuring consistency in naming, data flow, and integration across modules"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/chenyinrusi\/dsh-engineering-skills\/blob\/86d622bfbebb228269ad2b906c44069fd492397f\/skills\/code-review-methodology\/SKILL.md","source_commit":"86d622bfbebb228269ad2b906c44069fd492397f","license":null,"version":null,"listing_approved_at":"2026-11-28","created_at":"2026-11-28T07:59:16.000000Z","updated_at":"2026-11-28T18:37:41.000000Z","seo_title":"Systematic Code Review Framework for Software Modules","seo_description":"A comprehensive code review methodology covering 18 quality dimensions across three passes, including execution\/integration, architecture\/systems, and reliability\/correct","seo_keywords":["code review","audit","software development","pull request","code quality","security review","module review","code analysis"]}}