home/claude/skills/code-review/SKILL.md
Multi-perspective code review from base branch with 3 independent reviewer agents
npx skillsauth add lambdalisue/dotfiles code-reviewInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
base (optional): Base branch/ref. Auto-detected if omitted.context (optional): Additional context (e.g., "Security fix for auth").base, else → context. Two+: first=base, rest=context./style-review).If base given → use that as {base}.
If no base → auto-detect:
git status --short — any uncommitted changes?{mode} to uncommittedgh pr view --json baseRefName -q .baseRefName 2>/dev/null → fallback to default branch (main/master). Set {base} to detected branch and {mode} to committed.If {mode} is committed, verify diff is non-empty:
git diff --stat "$(git merge-base {base} HEAD)"
If empty → STOP with "レビュー対象の変更がありません".
Run in parallel:
git diff --name-only "$(git merge-base {base} HEAD)" (or git diff --name-only + git diff --cached --name-only for uncommitted) → count changed filesgit log --oneline "$(git merge-base {base} HEAD)..HEAD" (committed mode only) → {log}Spawn via Agent tool (subagent_type: "general-purpose", model: "sonnet"), all in one message. Each agent reads the codebase and diff itself — do NOT pass diff content in the prompt.
Shared instructions (include in each agent prompt):
You are reviewing code in this repository. {review_target}
MANDATORY: Use Read tool to read FULL content of every changed file + 2-3 related files (imports, callers, siblings) before making any findings.
IGNORE: style/naming/formatting, "consider adding" suggestions, missing docs, theoretical concerns without concrete impact, generic "error handling could be better".
Also read CLAUDE.md and .claude/rules/ for project rules — check for violations.
Context: {context}
Per issue: file:line, Severity (★★★/★★☆/★☆☆), what is wrong and WHY, concrete fix.
Where {review_target} is:
Review changes between {base} and HEAD. Run: git diff $(git merge-base {base} HEAD) to see the diff, git diff --name-only $(git merge-base {base} HEAD) for changed files.Review uncommitted changes. Run: git diff and git diff --cached to see the diff.{shared instructions}
Role: Senior architect. Find design, architectural, and best-practices problems.
Methodology: Read changed files → read related files → identify codebase patterns → compare against patterns AND language/framework best practices.
Find: Architectural misfit (layer violations, wrong module), design defects (wrong data structure, over-engineering, leaky abstraction), best practices violations (anti-patterns with concrete negative consequence), API inconsistency with existing codebase, coupling problems, missing design considerations.
{shared instructions}
Role: Security engineer. Find real vulnerabilities, logic bugs, security best-practices violations. NOT theoretical risks.
Methodology: Read changed files → trace data flow (input → validation → output) → check auth/middleware for bypass → check error handling for leaks.
Find: Exploitable vulnerabilities (with concrete attack path), logic bugs (wrong conditions, race conditions, null handling), data integrity (missing atomicity, missing validation at trust boundaries), secrets exposure, unsafe operations, security best-practices violations (with concrete risk).
{shared instructions}
Role: Codebase consistency specialist. Find violations of ESTABLISHED patterns.
Methodology: Read changed files → read 3-5 EXISTING files in same dirs to establish patterns (error handling, module structure, testing) → compare → check project rules.
Find: Pattern violations (cite file:line of established pattern), convention breaks, missing tests (vs existing coverage), rule violations, interface inconsistency.
IMPORTANT: Every finding MUST reference file:line of established pattern. No reference = not established = don't report.
## コードレビュー結果
{header} | **変更ファイル数**: N
### 判断サマリー
判断が必要だったポイントのみ: エージェント間不一致、重要度調整、棄却とその理由。全員一致の指摘は含めない。
---
### 1. タイトル (`path:line`) (★★★)
> 問題の端的な説明。
対応方法。
Where {header} is:
**ベース**: \{base}``**モード**: 未コミット変更Execute from Step 1.
tools
Update the title and body of an existing pull request WITHOUT asking for approval
tools
Create a pull request with title and body based on commits WITHOUT asking for approval
tools
Create a Conventional Commit from already staged changes WITHOUT asking for approval
tools
Map staged changes to existing commits and create fixup commits for autosquash WITHOUT asking for approval