Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

review-diff

БесплатноБез исполняемых скриптовНе проверен

Review and auto-fix code changes against project conventions by diffing the current branch against the default branch (main). Use when: (1) asked to review…

abyssparanoiaот abyssparanoia★ 20 звёзд на GitHub

Об этом скилле

Diff Review & Auto-Fix (Parallel Agent Edition)

Review current branch changes against main/master using 6 specialized parallel agents (including the adversarial reviewer), then automatically fix all issues found.

Workflow

1. Detect Default Branch  → find main or master
2. Gather Changes         → git diff, changed files, classify
3. Parallel Agent Review  → launch 6 agents simultaneously (incl. adversarial-reviewer)
4. Aggregate Findings     → collect, deduplicate, sort
5. Auto-Fix Issues        → edit files to fix all found problems
6. Verify Fixes           → lint, tests, code generation
7. Report                 → summary with agent-level breakdown

Step 1: Detect Default Branch

git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||'

If that fails, try origin/main first, then origin/master. Store the result as $BASE.

Step 2: Gather Changes + Classify

BASE=origin/main  # or origin/master

# Changed files list
git diff --name-only $BASE...HEAD

# Check if test files are included
git diff --name-only $BASE...HEAD | grep '_test\.go$'

# Commit history for spec-reviewer context
git log $BASE...HEAD --oneline

Note the changed file list — this is passed to agents in their prompts.

Determine which agents to launch:

  • spec-reviewer: Always (spec compliance)
  • convention-reviewer: Always (convention & rules compliance)
  • bug-reviewer: Always (bug & anti-pattern detection)
  • security-perf-reviewer: Always (security & performance)
  • test-reviewer: Only if *_test.go files exist in the diff (test quality)
  • adversarial-reviewer: Always (adversarial verification across 設計 / 理解容易性 / 命名 / テスト / 機能・性能, limited to concerns the other agents do not own — see .claude/skills/adversarial-review/SKILL.md)

Step 3: Parallel Agent Review

Launch all applicable agents in a single message using the Agent tool. All agents run with run_in_background: true for parallel execution.

CRITICAL: Use subagent_type, Do NOT Embed the Agent Definition

Each agent is registered as a subagent_type via its frontmatter in .claude/agents/{name}.md. When you specify subagent_type: "{name}", Claude Code automatically applies:

  • The model field (e.g., sonnet) — prevents cost overruns from running on the parent's model
  • The tools allow-list (e.g., [Read, Glob, Grep, Bash]) — enforces read-only, preventing unintended edits
  • The agent's full body as its system prompt

Never read the .claude/agents/{name}.md file and embed its contents in the prompt. Doing so:

  • Causes the agent to launch as general-purpose (all tools, including Edit/Write/Bash unrestricted) — breaks the read-only guarantee
  • Bypasses the model: sonnet declaration — may run on an expensive model
  • Duplicates the definition between the agent file and SKILL.md, causing drift

Prompt Content (review context only)

The prompt argument should contain only the review context. The agent already has its role from the frontmatter/body.

Template:

Target diff: HEAD vs {$BASE}

Changed files:
{changed_files}

Follow your role definition exactly. Report findings in the format you define, including the Semantic Category field on every finding.

For spec-reviewer, also append:

Commit history:
{git log output}

For test-reviewer, filter {changed_files} to *_test.go only.

For adversarial-reviewer, pass all changed files (tests included — mutation analysis needs them). No commit history or PR body — spec-reviewer owns those.

Agent Tool Call Pattern

Launch all applicable agents in one message:

Agent(
  description: "Spec compliance review",
  subagent_type: "spec-reviewer",
  run_in_background: true,
  prompt: "<review context only>"
)
Agent(
  description: "Convention & rules review",
  subagent_type: "convention-reviewer",
  run_in_background: true,
  prompt: "<review context only>"
)
Agent(
  description: "Bug & anti-pattern review",
  subagent_type: "bug-reviewer",
  run_in_background: true,
  prompt: "<review context only>"
)
Agent(
  description: "Security & performance review",
  subagent_type: "security-perf-reviewer",
  run_in_background: true,
  prompt: "<review context only>"
)
Agent(                                    # only if test files exist
  description: "Test quality review",
  subagent_type: "test-reviewer",
  run_in_background: true,
  prompt: "<review context only>"
)
Agent(
  description: "Adversarial verification",
  subagent_type: "adversarial-reviewer",
  run_in_background: true,
  prompt: "<review context only>"
)

Wait for all agents to complete. You will be notified as each finishes.

Step 4: Aggregate Findings

After all agents complete:

  1. Collect all findings from agent responses (each finding now carries semantic_category)
  2. Deduplicate by (file, line, semantic_category) — see dedup rationale below
  3. Sort by severity: error
Полный SKILL.md на GitHub

Установить review-diff в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/ai-antipatterns.mdreferences/checklists.md

FAQ

Что делает скилл review-diff?

Review and auto-fix code changes against project conventions by diffing the current branch against the default branch (main). Use when: (1) asked to review current changes, (2) running '/review-diff', (3) after completing a feature implementation and wanting to catch issues before creating a PR. Reviews all changed files against .claude/rules/, detects common AI coding mistakes (gomock.Any() misuse, missing ForUpdate, missing Preload, direct field assignment, wrong method ordering, etc.), and automatically fixes all issues found. Does NOT require an existing PR.

Как установить скилл review-diff?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл review-diff запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить review-diff с