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

code-polish — скилл для Claude Code: упрощение и ревью кода

Скилл проходит по изменённым файлам, упрощает код без смены поведения и разбирает дефекты по уровням риска. Полезен после крупной правки, когда надо прибраться и проверить результат.

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

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

Скилл работает в двух режимах: --simplify только упрощает, --review только проверяет и чинит. Если не указать ни один или указать оба, сначала идёт упрощение, потом ревью уже упрощённого кода. Профили ревью добавляются через --with-profile <name> и отключаются через --skip-profile <name>; при конфликте побеждает пропуск.

Область работы фиксируется один раз и дальше не расширяется. Нужен Git-репозиторий. Пути, паттерны, диапазоны или готовый блок resolved-scope берутся как есть, иначе в дело идут файлы, изменённые в текущей сессии, а при недоступной истории — все незакоммиченные отслеживаемые и новые файлы. Локфайлы, сгенерированный код, вендорные каталоги, минифицированные бандлы и большие снимки данных из ручного ревью исключаются, если их не запросили явно. Пустой набор — стоп.

Упрощение сохраняет публичные контракты, входы и выходы, побочные эффекты, поведение ошибок и операционные защиты. Правится только то, что даёт выигрыш в понятности или снижает риск дефекта: вложенность, невнятные имена, настоящее дублирование, локальные типы. Делить код по числу строк, чистить архитектуру, менять sync/async API и добавлять конфигурируемость на будущее скилл не станет. Ничего не сделать — нормальный итог. Профили лежат в references/profiles/<name>.md, и отсутствие выбранного профиля останавливает работу: это повод проверить, что каталог references скопирован целиком.

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

  • убрать лишнюю вложенность в только что написанной функции
  • найти дефекты в диффе и починить их по возрастанию риска
  • проверить изменённые файлы на утечки ресурсов и дыры в тестах
  • разобрать Go или Rust код с учётом профиля языка
  • получить отчёт с доказательствами по каждому найденному месту

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

  • /code-polish --simplify src/
  • /code-polish --review --with-profile security
  • /code-polish src/api src/db --skip-profile naming

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

1Через Skills CLI (Vercel)

npx skills add PaulRBerg/agent-skills --skill code-polish -a claude-code

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

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

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

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

Вопросы о code-polish

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

Выполните npx skills add PaulRBerg/agent-skills --skill code-polish -a claude-code. Скилл окажется в ~/.claude/skills/code-polish/SKILL.md.

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

Упрощает изменённый код и проводит ревью с починкой дефектов, оценивая их по уровням от CRITICAL до LOW. В конце запускает форматтер, точечные тесты и проверки инвариантов.

Что нужно для работы скилла?

Git-репозиторий и выбранные профили ревью в references/profiles/<name>.md. Если профиль из списка не найден, скилл останавливается.

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

SKILL.md · MIT
---
argument-hint: "[paths] [--simplify] [--review] [--with-profile <name>] [--skip-profile <name>]"
name: code-polish
description:
  "Polish changed code when the user explicitly asks, or when an active workflow requests post-implementation
  simplification and risk-profiled review over a fixed file scope."
---

# Code Polish

Resolve scope once. Make only high-confidence simplifications. Fix defects supported by evidence according to their
risk. Verify the final state.

## Modes

- `--simplify`: simplify only.
- `--review`: review and fix only.
- Neither or both: simplify, then review the simplified result.
- `--with-profile <name>` / `--skip-profile <name>`: add or suppress review profiles. Skip wins.

## Fixed Scope

1. Require a Git repository.
2. Use explicit paths, patterns, ranges, natural-language targets, or a supplied `resolved-scope` block when present.
   Otherwise, use only files modified in this session. If session history is unavailable, use all uncommitted tracked
   and untracked files.
3. Exclude lockfiles, generated outputs, vendored code, minified bundles, and large data snapshots from manual review
   unless explicitly requested. Validate relevant excluded outputs through their generator, schema, or invariants.
4. Resolve and retain one authoritative scope set and optional exclusions for execution. Do not broaden or recompute
   scope later. Stop if it is empty.

## Simplify

Preserve public contracts, inputs, outputs, side effects, error behavior, performance-sensitive characteristics,
telemetry, and operational guards. Apply only changes with a concrete comprehension or defect-risk benefit:

- flatten avoidable control-flow nesting.
- clarify misleading names or dense transforms.
- remove real duplication when the abstraction reduces total complexity.
- tighten local types and contracts without broad churn.
- remove only dead code caused by this session's edits.

Do not split by line count, perform architecture cleanup, convert sync/async APIs, add speculative configurability, or
replace readable duplication with a one-use abstraction. A no-op is a valid result.

## Review and Fix

Judge the diff against the user's request. Prioritize `CRITICAL → HIGH → MEDIUM → LOW`:

- **CRITICAL**: exploitable security, data loss, or critical outage path.
- **HIGH**: behavior, error-path, boundary, or performance defect affecting core behavior.
- **MEDIUM**: resource leak, complexity hotspot, test gap, over-scoped change, speculative complexity, or weak success
  criterion likely to cause defects.
- **LOW**: localized clarity or style issue with a real maintenance cost.

Every finding must cite a verified location, triggering input/state, failure mode, blast radius, and evidence in the
changed code. Merge duplicates and apply the smallest defensible fix. Resolve ambiguous intent from the request and
repository first. State routine assumptions. Ask only when the answer changes behavior or scope. While that item waits,
continue independent in-scope fixes.

Select every applicable profile and read it once. Read all selected profiles together in one parallel turn:

| Surface                                                       | Profile                 |
| ------------------------------------------------------------- | ----------------------- |
| auth, secrets, crypto, external input/network, unsafe parsing | `security`              |
| env, config, timeouts, retries, pools, limits                 | `configuration`         |
| Go behavior, concurrency, context, errors                     | `go`                    |
| Rust, Cargo/workspaces, async/concurrency, unsafe/FFI         | `rust`                  |
| TypeScript types, modules, packages, async behavior           | `typescript`            |
| Python services, scripts, async, packaging, data IO           | `python`                |
| shell, CI, deploy, installers, quoting                        | `shell`                 |
| CSV/JSON/YAML/binary, schemas, migrations, generated data     | `data-formats`          |
| naming and intent clarity                                     | `naming` unless skipped |

Profiles live at `references/profiles/<name>.md`. Missing selected profiles are a stop condition.

## Verification and Report

Run the narrowest formatter/lint, targeted tests, typecheck, and invariant checks that prove the final touched behavior.
Broaden only for shared contracts. Name skipped checks and why.

Summarize scope with the file count and smallest useful repository-relative roots, globs, ranges, or user-supplied
targets. Do not enumerate every file merely to prove scope. Name individual paths only for a small explicit scope or to
clarify exceptions and findings.

Findings include severity, location, impact, evidence, fix, and confidence. A residual risk states the assumption,
consequence if wrong, and how to check it.

Under `Issues and caveats`, group verified fixes with evidence as `Resolved`, and remaining problems, limitations, or
unverified assumptions as `Open`, with their impact and next step. Omit empty groups. Report each item once. Put neutral
context and agreed decisions under changes or scope.

Reserve `blocker` for something preventing required work and `risk` for a specific potential adverse outcome. A
workaround leaves an item open when the underlying issue still affects the result. Completion requires fixed scope,
traceable edits/findings, and validation evidence.

Lead a successful report with `### ✨ Code polish — ✅ complete`, then summarize scope, meaningful changes, and
verification. For small results, use short prose. Add tables or sections only when they clarify multiple changes or
findings. Honor the user's requested format.

When review ran and found no defects, state `✅ No verified review findings.` If a stop condition below prevents
completion, lead with `### ✨ Code polish — ⛔ blocked` and report the evidence and required decision. Keep severity
tokens, profile IDs, commands, locations, reproduction inputs, and security evidence exact and undecorated.

Stop when behavior parity or required high-risk validation cannot be established, or a fix requires an unrequested
public-contract change or larger redesign.

© PaulRBerg · MIT · PaulRBerg/agent-skills

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

Всё по теме «Код-ревью и рефакторинг» →
deslop brianlovin Скилл проходит по диффу ветки и убирает лишние комментарии, защитные проверки и приведение к any, которые оставил ИИ. CX Codex +1 5 500установок review-and-simplify-changes Dimillian Разбирает изменённый код на переиспользование, качество, эффективность и ясность, а потом по желанию вносит безопасные правки. Пригодится перед коммитом. CX Codex +1 794установок simplify-and-harden pskoett Пост-ревью кода сразу после завершения задачи: упрощение, харденинг, перепроверка и микродокументация. Пока агент ещё помнит замысел правок. CX Codex +1 535установок principle-sequence-verifiable-units backnotprop Скилл учит агента разбивать миграции и массовые правки на мелкие шаги с проверкой каждого. Помогает собирать понятные цепочки коммитов для ревью. CX Codex +1 5 100установок code-reviewer https://github.com/Jeffallan Анализирует дифы и файлы, ловит баги, уязвимости (SQL-injection, XSS), запахи кода и N+1 запросы, выдаёт структурированный отчёт с приоритетами. Нужен при ревью PR и аудитах качества. CX Codex +1 6 500установок ponytail-review DietrichGebert Скилл проверяет изменения глубже обычного diff: читает связанный код, ищет ошибки, риски, проблемы нагрузки и недостающие тесты. Пригодится для ревью PR и коммитов. CX Codex +1 57 000установок

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

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

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