code-polish
by @tenequm
Pre-release code review - runs lint/type checks, then launches 3 parallel review agents (cleanliness, design, efficiency) to analyze the diff, synthesizes a...
clawhub install code-polishπ About This Skill
name: polish description: Pre-release code review - runs lint/type checks, then launches 3 parallel review agents (cleanliness, design, efficiency) to analyze the diff, synthesizes a unified report, and fixes with approval. Use before committing, pushing, or releasing changes. Triggers on "review code", "check before commit", "cleanup before release", "review changes", "is this ready to ship", "polish before release", "simplify". metadata: version: "2.2.1" disable-model-invocation: true
Pre-Release Polish
Current branch: !git rev-parse --abbrev-ref HEAD
Uncommitted changes: !git diff --stat 2>/dev/null | tail -1
Rules
logger.info, logger.error) from debug leftovers (console.log, console.debug)Phase 1: Automated Checks
Run the project's lint + type-check command. Check CLAUDE.md for the correct validation command (commonly pnpm check, just check, cargo clippy, uv run ruff check, etc.).
If checks fail: 1. Fix all errors 2. Re-run checks until clean 3. Then proceed to Phase 2
If no validation command is found in CLAUDE.md, ask the user what to run.
Phase 2: Diff Analysis
Determine what changed:
1. Check for uncommitted changes: git diff + git diff --cached
2. If no uncommitted changes, diff against main: git diff main...HEAD
3. If no changes at all, report "nothing to review" and stop
Read every changed file fully. Understand what each change does and why.
Phase 3: Parallel Review
Use the Agent tool to launch all three agents concurrently in a single message. Pass each agent the full diff and the list of changed files so it has the complete context.
Agent 1: Cleanliness
Fast, mechanical, high-confidence. Looks for junk that should be removed.
console.log, console.debug, console.warn added during development; temporary debug variables, hardcoded test values. NOT structured logger calls (logger.info, logger.error, c.var.logger)TODO/FIXME/HACK markers left by Claude (not by the user); unnecessary type annotations where the language infers correctly; emoji in code or comments (unless the project uses them)0, 1, true, HTTP status codesAgent 2: Design & Reuse
Requires codebase exploration beyond the diff. Looks for structural and design issues.
Agent 3: Efficiency
Looks for runtime performance and resource issues.
r.ok), unhandled promise rejections on external calls, missing error handling at I/O boundariesPhase 4: Validate Findings
Before presenting anything, verify every finding from the agents against actual code. Drop any finding that fails validation.
For each finding:
logger.*, c.var.logger.*)Only findings that survive validation proceed to the report.
Phase 5: Report
Synthesize validated findings into a single deduplicated report. If multiple agents flagged the same code, merge into one finding. Group by category:
## Review FindingsCleanliness (N issues)
1. path/to/file.ts:42 - console.log("debug response")
2. ...Design (N issues)
1. path/to/file.ts:15-18 - hand-rolled path join, use existing resolveAssetPath from shared/utils
2. ...Efficiency (N issues)
1. path/to/file.ts:30-45 - sequential awaits on independent API calls, use Promise.all
2. ...Total: X issues across Y categories
Awaiting approval before proceeding with fixes.
If zero issues found, report "Clean - no issues found" and stop.
The report MUST end with the line "Awaiting approval before proceeding with fixes." (or "Clean - no issues found"). Do not proceed to Phase 6 until the user explicitly approves.
Phase 6: Fix and Verify
After user approves: 1. Fix all reported issues with minimal targeted edits 2. Re-run the project's validation command 3. If new errors appear, fix them 4. Show summary: what was fixed, final check status
π Constraints
logger.info, logger.error) from debug leftovers (console.log, console.debug)