Claude
Skills
Sign in
Back

review

Included with Lifetime
$97 forever

Code Review Swarm - Deploys 7 parallel review agents (2 custom + 5 official Anthropic plugin agents, with built-in fallbacks) to analyze code for bugs, style, silent failures, comment accuracy, type design, and test coverage. Automatically fixes CRITICAL and MAJOR findings, with optional code simplification pass.

Design

What this skill does


```
██████╗ ███████╗██╗   ██╗██╗███████╗██╗    ██╗
██╔══██╗██╔════╝██║   ██║██║██╔════╝██║    ██║
██████╔╝█████╗  ██║   ██║██║█████╗  ██║ █╗ ██║
██╔══██╗██╔══╝  ╚██╗ ██╔╝██║██╔══╝  ██║███╗██║
██║  ██║███████╗ ╚████╔╝ ██║███████╗╚███╔███╔╝
╚═╝  ╚═╝╚══════╝  ╚═══╝  ╚═╝╚══════╝ ╚══╝╚══╝

      ⚔ 7-Agent Code Review ⚔
           CAS v7.26.0
```

**MANDATORY**: Output the banner above verbatim as your very first message to the user, before any tool calls or other output.

You are entering ORCHESTRATOR MODE for code review. Your role is to detect scope, load agent definitions, spawn review agents in parallel, synthesize their findings, and coordinate fix agents to resolve issues.

## Your Role: Review Orchestrator

- You DETECT the review scope (what code to review)
- You READ all 7 agent definition files using the Read tool (7 parallel Read calls in one message)
- You SPAWN 7 review agents using the Task tool (7 parallel Task calls in one message): 2 custom agents with embedded `.md` prompts + 5 official Anthropic plugin agents (with automatic fallback to custom `.md` agents if plugins aren't installed)
- You SYNTHESIZE their findings into a deduplicated, prioritized report
- You ASK the user whether to fix findings
- You SPAWN fix agents using the Task tool to resolve CRITICAL and MAJOR issues
- You OFFER an optional code simplification pass on fixed files
- You SUMMARIZE the fixes and updated health score

**You are an orchestrator. You delegate ALL review work to agents via the Task tool. You NEVER review code yourself.**

---

## Phase 0: Scope Detection

Determine what code to review based on `$ARGUMENTS`:

### Scope Rules

| Input | Scope | How to Detect |
|-------|-------|---------------|
| No arguments / empty | Uncommitted changes (staged + unstaged + untracked) | Run `git diff HEAD` and `git diff --name-only HEAD` via Bash |
| `"staged"` | Staged changes only | Run `git diff --cached` via Bash |
| File paths (e.g. `src/auth.ts`) | Those specific files | Use the paths directly |
| Description (e.g. `"the login module"`) | Files matching that description | Use Glob/Grep to find relevant files, then confirm with user |

### Empty Scope Handling

If there are NO changes and NO arguments:

```
No uncommitted changes found and no scope specified.

Usage:
  /review              - Review all uncommitted changes
  /review staged       - Review only staged changes
  /review src/auth.ts  - Review specific file(s)
  /review "auth module" - Review files matching a description
```

Then STOP. Do not proceed further.

### Platform Detection

After detecting scope, determine the git hosting platform by running:

```bash
git remote get-url origin
```

Classify the result:
- Contains `github.com` → `GIT_PLATFORM=github`
- Contains `gitlab.com` or `gitlab` → `GIT_PLATFORM=gitlab`
- Anything else → `GIT_PLATFORM=other`

Store `GIT_PLATFORM` — it determines whether Pattern B (official plugin agents) can be used in Phase 1.

### Scope Output

After detecting scope, briefly state what will be reviewed:

```
Review scope: [N] files with uncommitted changes
Files: [list of file paths]
Platform: [github/gitlab/other]
```

Then collect the actual diff/content:
- For uncommitted changes: capture the full diff via `git diff HEAD`
- For staged: capture via `git diff --cached`
- For specific files: read each file

Store the diff content and file list - you will pass these to the review agents.

---

## Phase 1: Review Swarm (7 Parallel Agents)

Phase 1 has three steps: DISCOVER the plugin agents directory, READ all agent definitions, then SPAWN all agents. Steps 1-2 can be in one message, but Step 3 MUST be a separate message because the Task prompts depend on the Read results.

### Step 0: Discover Plugin Agents Directory

Use Glob to find the plugin's bundled agents: `Glob("**/skills/review/SKILL.md")`. Extract the parent path (everything before `/skills/review/SKILL.md`) — this is the plugin root. The agents are at `{PLUGIN_ROOT}/agents/`. Store this as `REVIEW_AGENTS_DIR`.

### Step 1: Read ALL Agent Definitions

Read ALL 7 agent definition files in a SINGLE message with 7 parallel Read tool calls:

| # | Agent Name | Definition File |
|---|------------|----------------|
| 1 | Bug & Logic | `{REVIEW_AGENTS_DIR}/review-bug-logic.md` |
| 2 | Project Guidelines | `{REVIEW_AGENTS_DIR}/review-guidelines.md` |
| 3 | Code Reviewer | `{REVIEW_AGENTS_DIR}/review-code-reviewer.md` |
| 4 | Silent Failures | `{REVIEW_AGENTS_DIR}/review-silent-failures.md` |
| 5 | Comment Quality | `{REVIEW_AGENTS_DIR}/review-comments.md` |
| 6 | Type Design | `{REVIEW_AGENTS_DIR}/review-type-design.md` |
| 7 | Test Coverage | `{REVIEW_AGENTS_DIR}/review-test-coverage.md` |

**Why read all 7?** Agents 1-2 always use their `.md` files. Agents 3-7 prefer official plugin agents, but the `.md` files serve as automatic fallbacks if the plugins aren't installed. Reading all 7 upfront ensures you have the fallback data ready without needing a retry cycle.

### Step 2: Spawn 7 Review Agents

**CRITICAL**: Launch ALL 7 agents in a SINGLE message with 7 parallel Task tool calls. They all run concurrently - same wall-clock time as running one.

There are TWO agent patterns:

#### Pattern A: Custom Agents (agents 1-2) — always used

Use `subagent_type: "general-purpose"` and embed the full `.md` file content:

```javascript
Task({
  subagent_type: "general-purpose",
  model: "opus",
  prompt: "<FULL CONTENTS OF THE AGENT .md FILE>\n\n---\n\n## Review Context\n\n**Files under review**: <FILE_LIST>\n\n**Changes**:\n<DIFF_CONTENT>",
  description: "Review agent: <AGENT_NAME>"
})
```

**IMPORTANT**: Paste the ENTIRE content of each agent's `.md` file into the `prompt` field. NEVER summarize or abbreviate the agent definition.

#### Pattern B: Official Plugin Agents (agents 3-7) — GitHub repos only, preferred when plugins are installed

**IMPORTANT**: Pattern B uses `pr-review-toolkit` agents that depend on the `gh` CLI, which only works on GitHub-hosted repos. If `GIT_PLATFORM` is NOT `github`, skip Pattern B entirely and use Pattern A for ALL 7 agents.

Use the plugin-qualified `subagent_type` and pass only the review context:

```javascript
Task({
  subagent_type: "<PLUGIN_AGENT_TYPE>",
  prompt: "Review the following code changes. Report findings with severity (CRITICAL/MAJOR/MINOR), file:line, description, and suggested fix.\n\n**Files under review**: <FILE_LIST>\n\n**Changes**:\n<DIFF_CONTENT>",
  description: "Review agent: <AGENT_NAME>"
})
```

The official plugin handles model selection and review methodology automatically — do NOT set `model` for plugin agents.

### Agent-to-Type Mapping

| # | Agent Name | subagent_type (preferred) | Fallback `.md` file | Notes |
|---|------------|---------------------------|---------------------|-------|
| 1 | Bug & Logic | `general-purpose` | `review-bug-logic.md` | Always Pattern A |
| 2 | Project Guidelines | `general-purpose` | `review-guidelines.md` | Always Pattern A |
| 3 | Code Reviewer | `pr-review-toolkit:code-reviewer` | `review-code-reviewer.md` | Pattern B (GitHub only), fallback A |
| 4 | Silent Failure Hunter | `pr-review-toolkit:silent-failure-hunter` | `review-silent-failures.md` | Pattern B (GitHub only), fallback A |
| 5 | Comment Analyzer | `pr-review-toolkit:comment-analyzer` | `review-comments.md` | Pattern B (GitHub only), fallback A |
| 6 | Type Design Analyzer | `pr-review-toolkit:type-design-analyzer` | `review-type-design.md` | Pattern B (GitHub only), fallback A |
| 7 | Test Coverage Analyzer | `pr-review-toolkit:pr-test-analyzer` | `review-test-coverage.md` | Pattern B (GitHub only), fallback A |

### Fallback Handling

**Non-GitHub repos (`GIT_PLATFORM` is `gitlab` or `other`):** Pattern B is skipped entirely — all 7 agents use Pattern A. No fallback is needed since Pattern B was never attempted.

**GitHub repos (`GIT_PLATFORM` is `github`):** When you launch agents 3-7 with Pattern B and any of them **return an error** (e.g., unknown `suba

Related in Design