Code review
Stack-agnostic code review using a 4-phase pattern - parallel specialist reviewers, adversarial false-positive verification, synthesized verdict (APPROVE / REQUEST CHANGES / NEEDS CLARIFICATION). Use when reviewing a PR, a branch, or the current working diff before pushing. Do not use for plan/design review (plan-review), post-implementation checks against a plan (task-verification), or when the project has its own dedicated review skill.From its SKILL.md
npx -y skills add Marycka9/oh-my-claude-obsidian --skill code-reviewAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
15.8 KB, as published. Nobody here has run it
code-review
Reviews a diff with five parallel specialist reviewers, then adversarially verifies every finding before it reaches the user. Only verified findings survive.
Shared references: config-resolution, verification, vault-structure, obsidian-format, handoff.
CRITICAL: Runs autonomously. Do not ask the user questions during the review. If a tool is unavailable, skip silently and use fallbacks. Verification (Phase 3) is mandatory — never skip the false-positive filter.
Arguments
Optional PR reference:
/code-review 42 (PR number)
/code-review feature/auth-migration (branch)
/code-review (current branch vs main/master)
Step -1 — Detect local override
Check for a project-local review skill: ./.claude/skills/review-pr/, ./.claude/skills/code-review/, and {base_path}/_skills/ (project skills in the vault, per vault-structure). If found:
Local review skill detected: <path>
Recommend using it instead for project-specific checks.
Continue with generic code-review anyway? (y/n)
Default: defer to local. Continue only if the user confirms. (This is the single allowed question — everything after it is autonomous.)
Step 0 — Resolve paths and worktree
- Resolve the project per config-resolution: registry lookup by cwd. If the project is not in the registry, continue in standalone mode — no review profile, no vault save offer; everything else works. Never read or write the code repo's CLAUDE.md.
- Run
pwdto captureworktree_pathas an absolute path; rungit worktree listto check whether the current directory is a worktree. All subsequent file reads use absolute paths prefixed withworktree_path.
Step 1 — Get the diff
Try in order:
- PR number/URL provided:
gh pr diff <ref> - Branch provided:
git diff main...<branch>(fall back tomaster) - Nothing provided:
git diff main...HEAD(fall back tomaster)
If none produce a diff, stop: "Could not retrieve a diff. Provide a PR number, branch, or ensure you have commits ahead of main."
Step 2 — Load the review profile
If the project resolved, read {base_path}/guides/review-profile.md (may not exist — that is fine). The profile is the project's review memory and may contain:
- Stack — languages, frameworks, services
- Project-specific checks — things this team always wants verified
- Known anti-patterns — mistakes that recur in this codebase
- Generated-file patterns — project-specific globs to exclude
- Language tools — semantic navigation (gopls/pyright/tsserver), test runner, linter
If the profile exists, its full content is injected into every reviewer's context (Step 6). If it does not exist, fall back to auto-detection (Steps 3-4 defaults) and note in the final report: No review profile found — consider creating guides/review-profile.md (project-onboarding can seed it).
Step 3 — File classification
Generated-file patterns: from the review profile if present, plus common defaults:
*.lock,package-lock.json,yarn.lock,Gemfile.lock,poetry.lock,go.sumvendor/,node_modules/,.venv/- Files with
// Code generatedor// DO NOT EDITheaders *_generated.go,*.pb.go,*_gen.go,*.min.js,*.min.css
Classify each file in the diff as authored (review target) or generated (excluded). Count authored lines changed (additions + deletions in authored files only). If only generated files changed: note that no authored code requires review and stop.
Step 4 — Size gate and tool detection
| Authored lines | Reviewer file reads | Key files | History files |
|---|---|---|---|
| <=800 | up to 8 | max 8 | max 3 |
| 801-2000 | up to 10 | max 10 | max 3 |
| >2000 | up to 6 (risk-focused) | max 6 | max 2 |
If >2000 authored lines, warn: Large change (>2000 authored lines). Review will focus on risk-tagged files. Coverage may be incomplete. Consider splitting into smaller PRs.
Language tools: from the review profile if present; otherwise detect from stack (go.mod -> gopls MCP if available; pyproject.toml/requirements.txt -> pyright; tsconfig.json -> tsserver; default Grep + Read). Never fail if a tool is missing — fall back silently to Grep + Read.
Step 5 — Extract metadata
From the diff and PR info (gh pr view if available):
- Change type: feature / bugfix / refactor / migration / config / docs
- Scope: single-service / cross-service / infrastructure
- Risk tags:
[api-change][migration][hot-path][auth][config][cross-service][data-integrity] - Services/modules touched (from file paths), key files (limited by size gate)
- PR description: purpose, what, how to test. If unavailable, work with inferred requirements from the diff and commit messages.
Step 6 — Build shared context
context:
mode: code_review
worktree_path: "<absolute>"
pr:
ref: "<pr number, branch, or 'local diff'>"
base: "<base branch>"
title: "<if available>"
url: "<if available>"
change:
type: "<type>"
scope: "<scope>"
risk_tags: [<tags>]
files:
authored_lines: <count>
key_files:
- path: "<path>"
why: "<why it matters>"
risk_tags: [<tags>]
generated_excluded: [<paths>]
tools:
semantic_nav: "<gopls|pyright|tsserver|grep-only>"
constraints:
- Focus on changed code only
- Use absolute paths prefixed with worktree_path
- If semantic tools unavailable, use Grep + Read silently
- Output findings in structured format
review_profile: |
<full content of guides/review-profile.md, or "NOT PROVIDED — infer conventions from the codebase">
diff: |
<full diff>
pr_description: |
<PR body if available, or "NOT PROVIDED">
Phase 2 — Parallel reviewers
Spawn reviewers in parallel via the Agent tool. Each receives the YAML context verbatim, its own focus (below), and the reviewer-side rules block, verbatim, in its prompt:
EVIDENCE DISCIPLINE (mandatory — see _shared/verification.md):
- Read enough code to be sure. Before flagging anything, read the WHOLE
enclosing function/method plus the call sites or definitions it depends on.
Never judge from the diff hunk alone.
- Not sure = QUESTION, not finding. If you did not trace enough context to
stake the claim, output severity QUESTION ("does X handle Y? I could not
verify") — never CRITICAL or IMPORTANT.
- Fix suggestions must use project patterns. Before suggesting a fix that
relies on a helper, library, idiom, or pattern, grep the project to confirm
it actually exists here. If it does not, label the suggestion
"(new pattern — not currently used in this project)" and frame it as optional.
- Every finding cites file:line plus the relevant code snippet. No vague findings.
- If a review_profile is provided, apply its project-specific checks and
known anti-patterns as first-class review criteria.
Each reviewer outputs:
agent: <name>
verdict: CLEAR | FINDINGS
findings:
- id: <PREFIX>-<N>
severity: CRITICAL | IMPORTANT | MINOR | QUESTION
title: "<title>"
file: "<path:line>"
evidence: "<code snippet or description>"
context_read: "<functions/files actually read in full>"
issue: "<what's wrong>"
impact: "<consequence>"
suggestion: "<fix — grep-confirmed pattern, or labeled '(new pattern — not currently used in this project)'>"
Agent 1: intent-reviewer (prefix: I)
Does the change match its stated purpose?
- Read PR description / commit messages; compare against what the diff actually does
- Flag scope drift (doing more/less than stated) and missing requirements (described but not implemented)
- If no PR description: mark requirements source as "NOT PROVIDED" and review based on commit messages
Agent 2: risk-reviewer (prefix: R)
What could break in production?
- Data integrity risks (incorrect writes, missing validations)
- Auth/security risks (bypassed checks, exposed data)
- Performance issues in hot paths (N+1 queries, unbounded loops, missing pagination)
- Migration reversibility (can this be rolled back?)
- Cross-service impact (breaking changes to shared APIs)
- Error handling gaps (swallowed errors, missing retries for transient failures)
Agent 3: architecture-reviewer (prefix: A)
Does it fit the system?
- Follows existing patterns and conventions (from the review profile, or inferred from the codebase)
- Appropriate layer boundaries (handler does not talk to DB directly, etc.)
- No coupling violations (service A importing service B internals)
- Consistent with architectural decisions on record (review profile / vault decisions if provided)
Agent 4: implementation-reviewer (prefix: M)
Code quality in the small:
- Error handling correctness and completeness
- Edge cases (nil/null, empty collections, boundary values)
- Readability (naming, structure, complexity)
- Testing adequacy (new code has tests, edge cases covered)
- Comments for non-obvious logic (not excessive, not missing)
- Resource management (connections closed, files closed, goroutines terminated)
Agent 5: ui-reviewer (prefix: U) — CONDITIONAL
Only spawn if changes touch frontend files. Detect from the review profile or defaults: web/, ui/, frontend/, src/components/, src/pages/; .tsx, .jsx, .vue, .svelte, .css, .scss.
- UX consistency with existing patterns
- Accessibility basics (alt text, ARIA, keyboard nav)
- Responsive considerations
- State management correctness
Phase 3 — Verification (adversarial, mandatory)
Spawn a single verification agent whose stance is refutation (verifier-side rules in verification): for each finding, actively try to prove it wrong. A finding survives only if the refutation attempt fails. The agent receives the diff, worktree_path, and all findings.
For each finding:
- Diff coverage — is the flagged file in the diff, and the flagged line a changed (
+) line? Pre-existing code ->false_positive("out of scope for a change review"). - Read the full context — open
<worktree_path>/<file>and read the entire enclosing function plus whatever it calls or is called by, as needed to trace the claimed failure path end to end. Do not stop at the flagged line. If the file does not exist, keep the finding asverifiedwith note "could not confirm — file not found at worktree path." - Trace the failure concretely — name the input/state that triggers the claimed bug and follow it to the wrong outcome. If the path is interrupted (a guard upstream, a validated invariant, an unreachable branch), mark
false_positivewith the specific reason. - Check the suggestion — if the finding proposes a fix, grep the project to verify the proposed pattern exists. Nonexistent pattern -> strip or downgrade the suggestion (relabel
(new pattern — not currently used in this project)); the finding may survive but the fix must not mislead. - Verdict —
verified(refutation failed; one line on why the failure path is real) orfalse_positive(the specific evidence that refutes it). "Probably fine" is not a verdict — read more code until it is one of the two.
Findings without a file: reference pass through as verified but are labeled observation and can never be CRITICAL. QUESTION items skip refutation; they surface in synthesis as open questions.
Output:
verification:
- finding_id: I-1
status: verified
reason: "<one line: why the failure path is real>"
- finding_id: R-2
status: false_positive
reason: "<specific refuting evidence, e.g. 'guard at handler.go:88 makes nil path unreachable'>"
- finding_id: M-3
status: verified
suggestion_adjusted: "proposed helper does not exist in project — relabeled as new pattern"
Phase 4 — Synthesis
Rules
- Only verified findings reach the user. Drop false positives silently from the issue list; count them in stats.
- Report verification stats honestly:
X findings raised, Y verified, Z refuted. - Compute verdict: any verified CRITICAL -> REQUEST CHANGES; verified intent gaps/drift -> NEEDS CLARIFICATION; only IMPORTANT/MINOR -> APPROVE (with notes); no verified findings -> APPROVE.
- Separate strengths from issues. Never mix positive and negative.
- Group issues by severity, not by reviewer. Deduplicate aggressively — same issue from multiple reviewers -> merge, show agreement count.
- QUESTION items go into an
## Open Questionssection — honest uncertainty, never dressed up as findings.
Severity labels
CRITICAL Must address — correctness, security, data integrity, failed requirements
IMPORTANT Should address — performance, maintainability, test gaps, scope drift
MINOR Optional — style, alternatives, future considerations
QUESTION Reviewer could not verify — needs a human answer, not a fix
Output format
# Code Review: <title or branch>
## Verdict: APPROVE | REQUEST CHANGES | NEEDS CLARIFICATION
## Strengths
- **<strength>** — <detail text> _(from: <agents>)_
## Tradeoffs
| Topic | Tradeoff | Decision |
|---|---|---|
| <topic> | <gain> vs <cost> | Accept / Reconsider |
## Coverage
Reviewed: <N> authored files (<M> lines). Excluded: <K> generated.
Size tier: Standard / Medium / Large
Verification: <X> findings raised, <Y> verified, <Z> refuted
Profile: guides/review-profile.md applied | none found (auto-detected stack)
## Reviewers
Intent: <status> | Risk: <status> | Architecture: <status> | Implementation: <status> | UI: <status or N/A>
## CRITICAL
<verified issues — file, issue, impact, action>
## IMPORTANT
<verified issues>
## MINOR
- **<issue>** — <detail text> _(from: <agent>)_
## Open Questions
- <QUESTION items — what could not be verified and why>
Omit empty sections. If all reviewers are CLEAR, show Strengths + Coverage + Reviewers + ## Verdict: APPROVE.
Step 7 — Save to vault (optional)
If the project resolved via config-resolution, offer after showing the review:
Save review to vault? (y/n)
If yes: write the full review to {base_path}/research/reviews/PR-<ref>-<YYYY-MM-DD>.md with frontmatter type: review, project, created, tags: [review], verdict — per obsidian-format. Update Last touched in the registry. In standalone mode, skip this step silently.
End with the handoff block (verdict line first). Phase 3 is the self-check — no separate structural checklist.
Rules
- Autonomous. Do not ask the user during review phases.
- Stack-agnostic core. No hardcoded language patterns; stack specifics come from
guides/review-profile.mdin the vault, never from the code repo's CLAUDE.md. - Defer to local skills. If the project has its own review skill, recommend it first.
- Fail silently on missing tools. Fall back to Grep + Read without comment.
- Verification is mandatory. Reviewers frequently flag pre-existing code, misread context, and invent fix patterns — the adversarial filter exists because of real false positives.
- Worktree-aware. Always use absolute paths prefixed with
worktree_path. - Evidence required. Every finding cites file:line plus code. Uncertainty is a QUESTION, never a finding.