К основному содержанию
плагин официальный · Anthropic

code-review — плагин для Claude Code: что делает и как установить

Автоматизирует ревью пуллреквестов в Claude Code с помощью четырёх параллельных субагентов и отсекает ложные срабатывания по порогу уверенности 80.

Установить в Claude Code · Через маркетплейс плагинов Все способы и платформы ↓
/plugin install code-review@claude-plugins-official
/plugin marketplace add anthropics/claude-plugins-official
Открыть на GitHub

Что делает code-review

Плагин запускает команду /code-review, оценивает состояние пуллреквеста и распределяет аудит изменений по четырём независимым агентам. Первые два проверяют соответствие кода инструкциям из файлов CLAUDE.md. Третий агент ищет явные баги в добавленных строках, а четвёртый проверяет историю правок через git blame.

Каждое замечание получает оценку уверенности от 0 до 100 баллов. Проблемы с оценкой ниже 80 отбрасываются, поэтому плагин не спамит придирками линтера или старыми ошибками проекта. Итоговый комментарий в GitHub содержит только проверенные дефекты со ссылками на полный SHA коммита и номера строк.

Без установленной и авторизованной консольной утилиты gh инструмент не сможет отправить отчёт в GitHub. Если пуллреквест помечен как черновик, уже проверен или закрыт, плагин автоматически пропустит аудит.

Какие задачи решает

  • проверить код пуллреквеста на соблюдение правил из CLAUDE.md
  • найти новые баги в изменённых строках без учёта старого кода
  • отфильтровать ложные срабатывания и мелкие придирки линтера
  • опубликовать комментарий к PR со ссылками на строки и полный хэш коммита

Примеры запросов агенту

  • /code-review
  • Запусти ревью текущего пуллреквеста через /code-review
  • Проверь ветку с изменениями командой /code-review перед слиянием

Как установить code-review

Через маркетплейс плагинов

/plugin install code-review@claude-plugins-official
/plugin marketplace add anthropics/claude-plugins-official

По шагам, с командами для каждой платформы: Плагины Claude Code: маркетплейсы, установка и как собрать свой

Из того же набора123

Весь набор →
csharp-lsp Подключает языковой сервер C# к Claude: подсказки по коду и диагностика прямо в работе агента. Нужен, если проект на C#. ★ 44 635звёзд репо context7 Плагин подключает Claude Code к удалённому MCP-серверу Context7, подтягивая актуальную документацию библиотек и примеры кода напрямую из репозиториев. ★ 44 635звёзд репо commit-commands Три слэш-команды для git: собрать коммит по изменениям, довести ветку до пул-реквеста, вычистить локальные ветки, удалённые с сервера. ★ 44 635звёзд репо code-simplifier Субагент приводит недавно изменённый код к более простому и единообразному виду, не меняя поведение программы. ★ 44 635звёзд репо code-modernization Ведёт перенос легаси-кода по шагам: разбор, план, сборка и доказательство, что новое поведение совпадает со старым. ★ 44 635звёзд репо claude-security Ищет уязвимости в вашем коде прямо в сессии Claude, проверяет каждую находку и по желанию готовит патчи. ★ 44 635звёзд репо claude-md-management Поддерживает файлы CLAUDE.md в актуальном состоянии: проверяет соответствие кодовой базе и сохраняет выводы текущей сессии в память проекта. ★ 44 635звёзд репо claude-code-setup Сканирует проект и советует, какие хуки, скиллы, MCP-серверы и субагенты стоит подключить. Пригодится, когда неясно, с чего начать настройку Claude. ★ 44 635звёзд репо

Похожие

Рядом в теме «Код-ревью и рефакторинг»

Все плагины по теме «Код-ревью и рефакторинг» →

Вопросы о code-review

Как установить code-review в Claude Code?

Сначала подключите каталог плагинов командой /plugin marketplace add anthropics/claude-plugins-official, затем выполните установку: /plugin install code-review@claude-plugins-official.

Что делает плагин code-review?

Он запускает параллельный анализ пуллреквеста четырьмя агентами, сверяет изменения с CLAUDE.md, оценивает найденные проблемы и публикует комментарии с оценкой уверенности от 80 баллов.

Что нужно настроить перед запуском /code-review?

Требуется Git-репозиторий с привязкой к GitHub и установленный GitHub CLI с выполненной авторизацией через gh auth login.

Исходный текст

code-review · Apache-2.0
# Code Review Plugin

Automated code review for pull requests using multiple specialized agents with confidence-based scoring to filter false positives.

## Overview

The Code Review Plugin automates pull request review by launching multiple agents in parallel to independently audit changes from different perspectives. It uses confidence scoring to filter out false positives, ensuring only high-quality, actionable feedback is posted.

## Commands

### `/code-review`

Performs automated code review on a pull request using multiple specialized agents.

**What it does:**
1. Checks if review is needed (skips closed, draft, trivial, or already-reviewed PRs)
2. Gathers relevant CLAUDE.md guideline files from the repository
3. Summarizes the pull request changes
4. Launches 4 parallel agents to independently review:
   - **Agents #1 & #2**: Audit for CLAUDE.md compliance
   - **Agent #3**: Scan for obvious bugs in changes
   - **Agent #4**: Analyze git blame/history for context-based issues
5. Scores each issue 0-100 for confidence level
6. Filters out issues below 80 confidence threshold
7. Posts review comment with high-confidence issues only

**Usage:**
```bash
/code-review
```

**Example workflow:**
```bash
# On a PR branch, run:
/code-review

# Claude will:
# - Launch 4 review agents in parallel
# - Score each issue for confidence
# - Post comment with issues ≥80 confidence
# - Skip posting if no high-confidence issues found
```

**Features:**
- Multiple independent agents for comprehensive review
- Confidence-based scoring reduces false positives (threshold: 80)
- CLAUDE.md compliance checking with explicit guideline verification
- Bug detection focused on changes (not pre-existing issues)
- Historical context analysis via git blame
- Automatic skipping of closed, draft, or already-reviewed PRs
- Links directly to code with full SHA and line ranges

**Review comment format:**
```markdown
## Code review

Found 3 issues:

1. Missing error handling for OAuth callback (CLAUDE.md says "Always handle OAuth errors")

https://github.com/owner/repo/blob/abc123.../src/auth.ts#L67-L72

2. Memory leak: OAuth state not cleaned up (bug due to missing cleanup in finally block)

https://github.com/owner/repo/blob/abc123.../src/auth.ts#L88-L95

3. Inconsistent naming pattern (src/conventions/CLAUDE.md says "Use camelCase for functions")

https://github.com/owner/repo/blob/abc123.../src/utils.ts#L23-L28
```

**Confidence scoring:**
- **0**: Not confident, false positive
- **25**: Somewhat confident, might be real
- **50**: Moderately confident, real but minor
- **75**: Highly confident, real and important
- **100**: Absolutely certain, definitely real

**False positives filtered:**
- Pre-existing issues not introduced in PR
- Code that looks like a bug but isn't
- Pedantic nitpicks
- Issues linters will catch
- General quality issues (unless in CLAUDE.md)
- Issues with lint ignore comments

## Installation

This plugin is included in the Claude Code repository. The command is automatically available when using Claude Code.

## Best Practices

### Using `/code-review`
- Maintain clear CLAUDE.md files for better compliance checking
- Trust the 80+ confidence threshold - false positives are filtered
- Run on all non-trivial pull requests
- Review agent findings as a starting point for human review
- Update CLAUDE.md based on recurring review patterns

### When to use
- All pull requests with meaningful changes
- PRs touching critical code paths
- PRs from multiple contributors
- PRs where guideline compliance matters

### When not to use
- Closed or draft PRs (automatically skipped anyway)
- Trivial automated PRs (automatically skipped)
- Urgent hotfixes requiring immediate merge
- PRs already reviewed (automatically skipped)

## Workflow Integration

### Standard PR review workflow:
```bash
# Create PR with changes
/code-review

# Review the automated feedback
# Make any necessary fixes
# Merge when ready
```

### As part of CI/CD:
```bash
# Trigger on PR creation or update
# Automatically posts review comments
# Skip if review already exists
```

## Requirements

- Git repository with GitHub integration
- GitHub CLI (`gh`) installed and authenticated
- CLAUDE.md files (optional but recommended for guideline checking)

## Troubleshooting

### Review takes too long

**Issue**: Agents are slow on large PRs

**Solution**:
- Normal for large changes - agents run in parallel
- 4 independent agents ensure thoroughness
- Consider splitting large PRs into smaller ones

### Too many false positives

**Issue**: Review flags issues that aren't real

**Solution**:
- Default threshold is 80 (already filters most false positives)
- Make CLAUDE.md more specific about what matters
- Consider if the flagged issue is actually valid

### No review comment posted

**Issue**: `/code-review` runs but no comment appears

**Solution**:
Check if:
- PR is closed (reviews skipped)
- PR is draft (reviews skipped)
- PR is trivial/automated (reviews skipped)
- PR already has review (reviews skipped)
- No issues scored ≥80 (no comment needed)

### Link formatting broken

**Issue**: Code links don't render correctly in GitHub

**Solution**:
Links must follow this exact format:
```
https://github.com/owner/repo/blob/[full-sha]/path/file.ext#L[start]-L[end]
```
- Must use full SHA (not abbreviated)
- Must use `#L` notation
- Must include line range with at least 1 line of context

### GitHub CLI not working

**Issue**: `gh` commands fail

**Solution**:
- Install GitHub CLI: `brew install gh` (macOS) or see [GitHub CLI installation](https://cli.github.com/)
- Authenticate: `gh auth login`
- Verify repository has GitHub remote

## Tips

- **Write specific CLAUDE.md files**: Clear guidelines = better reviews
- **Include context in PRs**: Helps agents understand intent
- **Use confidence scores**: Issues ≥80 are usually correct
- **Iterate on guidelines**: Update CLAUDE.md based on patterns
- **Review automatically**: Set up as part of PR workflow
- **Trust the filtering**: Threshold prevents noise

## Configuration

### Adjusting confidence threshold

The default threshold is 80. To adjust, modify the command file at `commands/code-review.md`:
```markdown
Filter out any issues with a score less than 80.
```

Change `80` to your preferred threshold (0-100).

### Customizing review focus

Edit `commands/code-review.md` to add or modify agent tasks:
- Add security-focused agents
- Add performance analysis agents
- Add accessibility checking agents
- Add documentation quality checks

## Technical Details

### Agent architecture
- **2x CLAUDE.md compliance agents**: Redundancy for guideline checks
- **1x bug detector**: Focused on obvious bugs in changes only
- **1x history analyzer**: Context from git blame and history
- **Nx confidence scorers**: One per issue for independent scoring

### Scoring system
- Each issue independently scored 0-100
- Scoring considers evidence strength and verification
- Threshold (default 80) filters low-confidence issues
- For CLAUDE.md issues: verifies guideline explicitly mentions it

### GitHub integration
Uses `gh` CLI for:
- Viewing PR details and diffs
- Fetching repository data
- Reading git blame and history
- Posting review comments

## Author

Boris Cherny ([email protected])

## Version

1.0.0

© Anthropic · Apache-2.0 · anthropics/claude-plugins-official

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой