Agent-skills code-polish
This skill should be used when the user asks to "polish code", "simplify and review", "clean up and review code", "full code polish", "simplify then review", "refactor and review", "simplify and fix", "clean up and fix", or wants a combined simplification and review workflow on recently changed code.
install
source · Clone the upstream repo
git clone https://github.com/PaulRBerg/agent-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/PaulRBerg/agent-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/code-polish" ~/.claude/skills/paulrberg-agent-skills-code-polish && rm -rf "$T"
manifest:
skills/code-polish/SKILL.mdsource content
Code Polish
Combined simplification and review pipeline. This skill orchestrates two sub-skills in sequence:
— simplify for readability and maintainabilitycode-simplify
— review for correctness, security, and quality, auto-applying all fixescode-review --fix
Optimize for one scope resolution, one user-facing report, and no redundant simplify verification.
Scope Resolution
- Verify repository context:
. If this fails, stop and tell the user to run from a git repository.git rev-parse --git-dir - If user provides file paths/patterns, a commit/range, or a
fenced block with one repo-relative path per line, scope is exactly those targets.Resolved scope - Otherwise, scope is only session-modified files. Do not include other uncommitted changes.
- If there are no session-modified files, fall back to all uncommitted tracked + untracked files:
- tracked:
git diff --name-only --diff-filter=ACMR - untracked:
git ls-files --others --exclude-standard - combine both lists and de-duplicate.
- tracked:
- Exclude generated/low-signal files unless requested: lockfiles, minified bundles, build outputs, vendored code.
- If scope still resolves to zero files, report and stop.
- Normalize the final scope into a
fenced block with one repo-relative path per line. Reuse that exact block for both sub-skills instead of asking them to rediscover scope.Resolved scope
Workflow
1) Resolve scope once
- Apply the "Scope Resolution" rules above.
- Treat the resulting
block as authoritative for all downstream work.Resolved scope - Forward user intent, constraints, and risk preferences, but do not forward raw duplicate scope selectors when the resolved block already captures them.
2) Run code-simplify
code-simplifyInvoke the
code-simplify skill with:
- the authoritative
blockResolved scope --no-verify--no-report- any non-scope user intent that still matters
Tell
code-simplify not to broaden or rediscover scope.
3) Run code-review --fix
code-review --fixInvoke the
code-review skill with:
- the same authoritative
blockResolved scope --fix- any non-scope user intent that still matters
If the user explicitly asks for a speed-first pass over maintainability coverage, you may also append
--skip-profile naming. Do not skip the naming profile by default.
4) Final verification
- Treat
's post-fix verification as the final verification summary when it already covers the final touched scope.code-review - If verification was skipped, partial, or no longer matches the final diff, run one narrow final verification pass across the final touched scope.
- Always report skipped checks explicitly.
5) Report
Combine the final state into one summary:
- Scope: Files and functions touched.
- Simplifications: Key changes from
, derived from the actual diff when needed becausecode-simplify
was used.--no-report - Review findings and fixes: Findings and applied fixes from
.code-review - Verification: Commands run and outcomes.
- Residual risks: Assumptions or items needing manual review.