Polishes recently changed code by simplifying for readability/maintainability and running a risk-profiled review that autonomously applies fixes. Useful for cleaning up uncommitted changes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/paulrberg-agent-skills:code-polish [paths] [--simplify] [--review] [--with-profile <name>] [--skip-profile <name>][paths] [--simplify] [--review] [--with-profile <name>] [--skip-profile <name>]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Polish recently changed code in one run: simplify for readability and maintainability, then run an exhaustive risk-profiled review that applies fixes autonomously. Resolve scope once, prioritize correctness/security/data-integrity over style, and produce one user-facing report. Run either pass alone with `--simplify` or `--review`.
Polish recently changed code in one run: simplify for readability and maintainability, then run an exhaustive risk-profiled review that applies fixes autonomously. Resolve scope once, prioritize correctness/security/data-integrity over style, and produce one user-facing report. Run either pass alone with --simplify or --review.
Passes are selected by flags and default to running both, in this fixed order:
--simplify only: run the Simplify Pass, then verify and report.--review only: run the Review Pass (always applies fixes), then verify and report.When both run, the review pass sees the simplified code: reuse file contents already loaded during simplify and only re-read files the simplify pass changed.
--simplify: Run the simplify pass only.--review: Run the review pass only. The review pass always applies fixes autonomously; there is no report-and-wait mode.--with-profile <name>: Force an optional review profile by stem or filename (e.g. --with-profile shell). Repeatable. Review pass only.--skip-profile <name>: Skip an optional review profile by stem or filename (e.g. --skip-profile naming). Repeatable. If both --with-profile and --skip-profile name the same profile, skip wins. Review pass only._lib.ts into smaller files"): executed during the simplify pass.Resolve scope once, then treat the result as fixed for the rest of the run.
git rev-parse --git-dir. If this fails, stop and tell the user to run from a git repository.resolved-scope fenced block with one repo-relative path per line — scope is exactly those targets. Map natural-language subsets to concrete paths before continuing.git --no-pager diff --name-only --diff-filter=ACMR; git --no-pager ls-files --others --exclude-standardexcluded-scope, one repo-relative path or glob per line, and cover them through verification or invariant checks.resolved-scope, one repo-relative path per line. The block is authoritative: do not re-run scope commands or revisit exclusions afterward.resolved-scope block.excluded-scope only when generated, vendored, bulk, or low-signal files are intentionally excluded but still relevant to verification.Skip unless the simplify pass is active. Otherwise apply the Simplify Pass section to the resolved scope, plus any extra cleanup instructions.
Skip unless the review pass is active. Otherwise apply the Review Pass section to the resolved scope (and any excluded-scope via verification). Build findings internally and apply fixes autonomously in severity order — no separate pre-fix report.
Run the Verification section once, after the active passes, over the final touched scope.
Produce the Report section. Include only the subsections for passes that ran.
Apply high-confidence simplifications that materially improve comprehension or reduce defect risk while preserving behavior, public contracts, and side effects. Default to no edit unless the change is high-confidence; skip no-op passes and report that the code is already clear rather than churning it.
Apply the full checklist in this order:
Find high-impact defects in changed code with evidence, then apply fixes autonomously. Prioritize correctness, security, data integrity, shell/config safety, and regressions over style nits. There is no dry-run: build findings internally, apply fixes in severity order (CRITICAL → HIGH → MEDIUM → LOW), and exercise judgment — smallest defensible fix, skip or down-rank low-value churn, and when behavior intent is ambiguous record a residual risk instead of guessing.
Treat the user's request as the boundary for judging the diff.
Apply on every review.
CORE-001 Behavior regression (HIGH): changed branch/state transition alters external behavior.CORE-002 Error-path safety (HIGH): failures can cascade, crash, or return unsafe defaults.CORE-003 Boundary handling (HIGH): null/empty/overflow/edge inputs are not handled.CORE-004 Resource hygiene (MEDIUM): leaked timers/listeners/handles/connections.CORE-005 Complexity hotspot (MEDIUM): change introduces avoidable coupling or hidden side effects.CORE-006 Test gap (MEDIUM): changed behavior has no targeted test coverage.CORE-007 Over-scoped change (MEDIUM): changed lines do not trace directly to the user's request or verified cleanup caused by the change.CORE-008 Speculative complexity (MEDIUM): new abstraction, configurability, flexibility, or impossible-case handling adds code without proven need.CORE-009 Weak success criteria (MEDIUM): implementation lacks a clear verification target for the behavior it claims to change.Profile dispatch is risk-triggered and exhaustive: select every profile whose risk surface the diff touches, not by file extension alone when core checks already cover the change.
| Touched surface | Profile |
|---|---|
| auth, external input, secrets, crypto, public network, unsafe parsing | security |
| env/config, timeouts, retries, pools, limits, resource tuning, rollout controls | configuration |
| Go services, CLIs, concurrency, context propagation, error handling, modules, tests | go |
| TypeScript behavior where type, module, package, generated type, or async semantics matter | typescript |
| Python services, scripts, async workloads, packaging, data processing, IO-heavy changes | python |
| shell scripts, CI/deploy/installer command blocks, command quoting | shell |
| CSV/JSON/YAML/binary ingestion/export/parsing, schemas, generated data, migrations, fixtures | data-formats |
every review (naming/intent clarity) unless --skip-profile naming | naming |
Honor --skip-profile exclusions first, then add --with-profile profiles. Read all selected profiles as parallel Read calls in a single message — one batch, each file once, never paged or re-read. Profiles live at references/profiles/<name>.md relative to this file.
Run the narrowest checks that validate touched behavior:
excluded-scope outputsIssue independent checks as parallel tool calls in a single message, preferring the project's task runner and the narrowest per-file/per-workspace scope over repo-wide commands. When scanning beyond the diff (call sites, usages), prefer fast tools (rg/fd/ast-grep) when available and batch independent searches and reads. Run broader checks only when risk warrants it, especially when changes touch shared contracts. Name every skipped check and why.
Use these section headings, in this order. Include only subsections for passes that ran. Omit sections that do not apply — do not number them and do not leave gaps or placeholders.
Files and functions touched, final state, and any excluded-scope entries with the validation strategy used for them.
Only if the simplify pass ran. One sentence per meaningful change, focused on the readability or maintainability gain. Confirm behavior-preservation assumptions explicitly.
Only if the review pass ran. Findings and applied fixes ordered CRITICAL → HIGH → MEDIUM → LOW. For each: [SEVERITY] Title — path/to/file.ext:line, concrete impact, evidence, the fix applied, and confidence (high | medium | low).
Commands run and outcomes, including skipped checks.
One line per risk: Assumed <assumption>; if wrong, <what breaks>; check via <command or inspection>. Plain language — expand or gloss domain-specific terms. Include questions that need a user decision, phrased directly. Write None. when there are none.
Stop and ask for direction when:
references/profiles/*.md) is missing.npx claudepluginhub paulrberg/agent-skillsReviews recent code changes in parallel using three subagents, then applies simplifications sequentially. Non-interactive, uses git diff to capture changes.
Simplifies recently changed code for clarity, reuse, quality, and efficiency while preserving behavior. Launches parallel review agents for code-reuse, code-quality, and efficiency.
Review a diff for clarity and safe simplifications, then optionally apply low-risk fixes.