К основному содержанию
скилл CX Codex

code-review · llama-farm — скилл для Claude Code: ревью диффов и поиск уязвимостей

Разбирает изменённый код в диффе: ищет утечки секретов, инъекции, пустые catch и заглушки. Сам определяет домен по путям файлов.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add llama-farm/llamafarm --skill code-review -a claude-code
Открыть на GitHub

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

Скилл ждёт готовый дифф в контексте — его готовит вызывающая сторона. Можно вставить дифф из пул-реквеста и позвать команду, можно дать агенту выполнить git diff HEAD~1 и передать результат скиллу. Если диффа нет, скилл попросит его предоставить или предложит сгенерировать.

Дальше он разбирает изменённые строки по чек-листам. Домен выбирается по путям: designer/ — фронтенд, server/, rag/, runtimes/universal/ — бэкенд, для cli/ и config/ только общие проверки. Если дифф задевает несколько доменов, подгружаются все нужные чек-листы. Отчёт складывается в /tmp/claude/<путь>/reviews/code-review-<дата>.md со сводной таблицей и разбором каждой находки: файл, строки, severity, рекомендация.

Отдельный шаг — анализ влияния: скилл ищет, где ещё используются изменённые экспорты, сигнатуры API и схемы конфигов, и помечает неучтённые последствия. Замечания он ставит только по строкам диффа, а полный файл читает для контекста — потому что вне диффа правки не ваши. Для работы нужны инструменты Bash, Read, Edit, Write, Grep, Glob, Task.

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

  • найти захардкоженные ключи и пароли в изменениях
  • проверить, не сломает ли правка экспортов чужие вызовы
  • отловить пустые catch и заглушки вместо реализации
  • собрать отчёт ревью в markdown-файл с severity по каждой находке
  • подобрать чек-лист под фронтенд или бэкенд по путям файлов

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

  • Вот дифф из PR, прогони code-review
  • Сделай git diff main..HEAD и проверь изменения на инъекции и секреты
  • Проверь этот дифф и сохрани отчёт со списком находок

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

1Через Skills CLI (Vercel)

npx skills add llama-farm/llamafarm --skill code-review -a claude-code

2Вручную: положить файлы

~/.claude/skills/code-review/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/code-review/

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

Вопросы о code-review

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

Выполните npx skills add llama-farm/llamafarm --skill code-review -a claude-code. Скилл встанет в ~/.claude/skills/code-review/SKILL.md.

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

Разбирает дифф по чек-листам безопасности, качества и заглушек, а затем проверяет, не задел ли он другие части кодовой базы. Результат — markdown-отчёт с severity и рекомендациями.

Что нужно, чтобы скилл заработал?

Дифф в контексте перед вызовом. Если его нет, скилл попросит предоставить изменения или предложит сгенерировать их через git diff.

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

SKILL.md · Apache-2.0
---
name: code-review
description: Comprehensive code review for diffs. Analyzes changed code for security vulnerabilities, anti-patterns, and quality issues. Auto-detects domain (frontend/backend) from file paths.
allowed-tools: Bash, Read, Edit, Write, Grep, Glob, Task
---

# Code Review Skill

You are performing a comprehensive code review on a diff. Your task is to analyze the changed code for security vulnerabilities, anti-patterns, and quality issues.

## Input Model

This skill expects a **diff** to be provided in context before invocation. The caller is responsible for generating the diff.

**Example invocations:**
- User pastes PR diff, then runs `/code-review`
- Agent runs `git diff HEAD~1`, then invokes this skill
- CI tool provides diff content for review

If no diff is present in context, ask the user to provide one or offer to generate one (e.g., `git diff`, `git diff main..HEAD`).

---

## Domain Detection

Auto-detect which checklists to apply based on directory paths in the diff:

| Directory | Domain | Checklist |
|-----------|--------|-----------|
| `designer/` | Frontend | Read `frontend.md` |
| `server/` | Backend | Read `backend.md` |
| `rag/` | Backend | Read `backend.md` |
| `runtimes/universal/` | Backend | Read `backend.md` |
| `cli/` | CLI/Go | Generic checks only |
| `config/` | Config | Generic checks only |

If the diff spans multiple domains, load all relevant checklists.

---

## Review Process

### Step 1: Parse the Diff

Extract from the diff:
- List of changed files
- Changed lines (additions and modifications)
- Detected domains based on file paths

### Step 2: Initialize the Review Document

Create a review document using the **temp-files pattern**:

```bash
SANITIZED_PATH=$(echo "$PWD" | tr '/' '-')
REPORT_DIR="/tmp/claude/${SANITIZED_PATH}/reviews"
mkdir -p "$REPORT_DIR"
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
FILEPATH="${REPORT_DIR}/code-review-${TIMESTAMP}.md"
```

Initialize with this schema:

```markdown
# Code Review Report

**Date**: {current date}
**Reviewer**: Code Review Agent
**Source**: {e.g., "PR diff", "unstaged changes", "main..HEAD"}
**Files Changed**: {count}
**Domains Detected**: {list}
**Status**: In Progress

## Summary

| Category | Items Checked | Passed | Failed | Findings |
|----------|---------------|--------|--------|----------|
| Security | 0 | 0 | 0 | 0 |
| Code Quality | 0 | 0 | 0 | 0 |
| LLM Code Smells | 0 | 0 | 0 | 0 |
| Impact Analysis | 0 | 0 | 0 | 0 |
| Simplification | 0 | 0 | 0 | 0 |
{domain-specific categories added based on detected domains}

## Detailed Findings

{findings added here as review progresses}
```

### Step 3: Review Changed Code

For EACH checklist item:

1. **Scope feedback to diff lines only** - Only flag issues in the changed code
2. **Use file context** - Read full file content to understand surrounding code
3. **Apply relevant checks** - Use domain-appropriate checklist items
4. **Document findings** - Record each violation found in changed code

**Key principle**: The diff is what gets reviewed. The rest of the file provides context to make that review accurate.

### Step 4: Impact Analysis

Check if the diff might affect other parts of the codebase:

- **Changed exports/interfaces** - Search for usages elsewhere that may break
- **Modified API signatures** - Check for callers that need updating
- **Altered shared utilities** - Look for consumers that may be affected
- **Config/schema changes** - Find code that depends on old structure

Report any unaccounted-for impacts as findings with severity based on risk.

### Step 5: Document Each Finding

For each issue found, add an entry:

```markdown
### [{CATEGORY}] {Item Name}

**Status**: FAIL
**Severity**: Critical | High | Medium | Low
**Scope**: Changed code | Impact analysis

#### Violation

- **File**: `path/to/file.ext`
- **Line(s)**: 42-48 (from diff)
- **Code**:
```
// problematic code snippet from diff
```
- **Issue**: {explanation of what's wrong}
- **Recommendation**: {how to fix it}
```

### Step 6: Finalize the Report

After completing all checks:

1. Update the summary table with final counts
2. Add an executive summary:
   - Total issues found
   - Critical issues requiring immediate attention
   - Impact analysis results
   - Recommended priority order for fixes
3. Update status to "Complete"
4. Inform the user of the report location

---

## Generic Review Categories

These checks apply to ALL changed code regardless of domain.

---

## Category: Security Fundamentals

### Hardcoded Secrets

**Check diff for**:
- API keys, passwords, secrets in changed code
- Patterns: `api_key`, `apiKey`, `password`, `secret`, `token`, `credential` with literal values

**Pass criteria**: No hardcoded secrets in diff (should use environment variables)
**Severity**: Critical

---

### Eval and Dynamic Code Execution

**Check diff for**:
- JavaScript/TypeScript: `eval(`, `new Function(`, `setTimeout("`, `setInterval("`
- Python: `eval(`, `exec(`, `compile(`

**Pass criteria**: No dynamic code execution in changed lines
**Severity**: Critical

---

### Command Injection

**Check diff for**:
- Python: `subprocess` with `shell=True`, `os.system(`
- Go: `exec.Command(` with unsanitized input

**Pass criteria**: No unvalidated user input in shell commands
**Severity**: Critical

---

## Category: Code Quality

### Console/Print Statements

**Check diff for**:
- JavaScript/TypeScript: `console.log`, `console.debug`, `console.info`
- Python: `print(` statements

**Pass criteria**: No debug statements in production code changes
**Severity**: Low

---

### TODO/FIXME Comments

**Check diff for**:
- `TODO:`, `FIXME:`, `HACK:`, `XXX:` comments

**Pass criteria**: New TODOs should be tracked in issues
**Severity**: Low

---

### Empty Catch/Except Blocks

**Check diff for**:
- JavaScript/TypeScript: `catch { }` or `catch(e) { }`
- Python: `except: pass` or empty except blocks

**Pass criteria**: All error handlers log or rethrow
**Severity**: High

---

## Category: LLM Code Smells

### Placeholder Implementations

**Check diff for**:
- `TODO`, `PLACEHOLDER`, `IMPLEMENT`, `NotImplemented`
- Functions that just `return None`, `return []`, `return {}`

**Pass criteria**: No placeholder implementations in production code
**Severity**: High

---

### Overly Generic Abstractions

**Check diff for**:
- New classes/functions with names like `GenericHandler`, `BaseManager`, `AbstractFactory`
- Abstractions without clear reuse justification

**Pass criteria**: Abstractions are justified by actual reuse
**Severity**: Low

---

## Category: Impact Analysis

### Breaking Changes

**Check if diff modifies**:
- Exported functions/classes - search for imports elsewhere
- API endpoints - search for callers
- Shared types/interfaces - search for usages
- Config schemas - search for consumers

**Pass criteria**: All impacted code identified and accounted for
**Severity**: High (if unaccounted impacts found)

---

## Category: Simplification

### Duplicate Logic

**Check diff for**:
- Repeated code patterns (not just syntactic similarity)
- Copy-pasted code with minor variations
- Similar validation, transformation, or formatting logic

**Pass criteria**: No obvious duplication in changed code
**Severity**: Medium
**Suggestion**: Extract shared logic into reusable functions

---

### Unnecessary Complexity

**Check diff for**:
- Deeply nested conditionals (more than 3 levels)
- Functions doing multiple unrelated things
- Overly complex control flow

**Pass criteria**: Code is reasonably flat and focused
**Severity**: Medium
**Suggestion**: Use early returns, extract helper functions

---

### Verbose Patterns

**Check diff for**:
- Patterns that have simpler alternatives in the language
- Redundant null checks or type assertions
- Unnecessary intermediate variables

**Pass criteria**: Code uses idiomatic patterns
**Severity**: Low
**Suggestion**: Simplify using language built-ins

---

## Domain-Specific Review Items

Based on detected domains, read and apply the appropriate checklists:

- **Frontend detected** (`designer/`): Read `frontend.md` and apply those checks to changed code
- **Backend detected** (`server/`, `rag/`, `runtimes/`): Read `backend.md` and apply those checks to changed code

---

## Final Summary Template

```markdown
## Executive Summary

**Review completed**: {timestamp}
**Total findings**: {count}

### Critical Issues (Must Fix)
1. {issue 1}
2. {issue 2}

### Impact Analysis Results
- {summary of any breaking changes or unaccounted impacts}

### High Priority (Should Fix)
1. {issue 1}
2. {issue 2}

### Recommendations
{Overall recommendations based on the changes reviewed}
```

---

## Notes for the Agent

1. **Scope to diff**: Only flag issues in the changed lines. Don't review unchanged code.

2. **Use context**: Read full files to understand the changes, but feedback targets the diff only.

3. **Check impacts**: When changes touch exports, APIs, or shared code, search for affected consumers.

4. **Be specific**: Include file paths, line numbers (from diff), and code snippets for every finding.

5. **Prioritize**: Flag critical security issues immediately.

6. **Provide solutions**: Each finding should include a recommendation for how to fix it.

7. **Update incrementally**: Update the review document after each category, not at the end.

© llama-farm · Apache-2.0 · llama-farm/llamafarm

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

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

Сначала — code-review от других авторов.

code-review Matt Pocock Проверяет изменения от выбранной точки по стандартам репозитория и требованиям задачи. Нужен для ревью ветки, PR или незавершённой работы. 789 521установок code-review официальный anthropics Скилл проверяет диффы и пул-реквесты на безопасность, производительность и корректность. Пригодится, когда правки нужно просмотреть до слияния. CX Codex +1 9 900установок code-review agno-team Автоматическая проверка кода на стиль, ошибки и нарушения best practices. Скилл запускает линтер, ищет баги и уязвимости, даёт структурированный feedback с уровнями критичности. CX Codex +1 472установок code-review coderabbitai Запускает проверку кода через утилиту CodeRabbit CLI и помогает агенту исправлять найденные замечания. Пригодится для поиска багов и уязвимостей перед коммитом или PR. CX Codex +1 14 800установок code-review getsentry Скилл для ревью пул-реквестов и правок кода по инженерным практикам Sentry: безопасность, производительность, тесты, дизайн. CX Codex +1 5 500установок code-review-pro OneWave-AI Разбирает файлы, модуль, диф или ветку и выдаёт находки по критичности: уязвимости, баги, узкие места, проблемы поддержки. С доказательствами и готовыми правками. CX Codex +1 2 600установок trailmark-review-gate trailofbits Скилл запускает структурный контроль изменений веток и коммитов через анализ графов Trailmark. Он выявляет удаление проверок доступа, рост радиуса атаки и новые пути передачи опасных данных. CX Codex +1 1 300установок caveman-review JuliusBrussee Пишет замечания к коду одной строкой: место, проблема, исправление. Пригодится, когда ревью диффа или PR надо пройти быстро и без воды. CX Codex +1 411 800установок open-code-review-delegate alibaba Скилл поручает проверку кода самому агенту, а утилиту OCR использует только для фильтрации файлов и поиска правил. Пригодится, когда нужно локальное ревью без внешних LLM-эндпоинтов для OCR. CX Codex +1 3 600установок difit-review yoshiko-pg Запускает локальный веб-интерфейс difit для просмотра diff и крепит замечания код-ревью к нужным строкам. Срабатывает только по прямому запросу. CX Codex +1 1 900установок hunk-review modem-dev Управляет запущенной TUI-сессией Hunk через CLI: переходит по дифам, оставляет инлайн-комментарии и обновляет просматриваемые ветки. CX Codex +1 1 800установок

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

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