{"id":"af919d17-e2c8-428e-a102-661681e3b629","shortId":"Cvpfxc","kind":"skill","title":"polish-code","tagline":"Stage, format, lint, test, review, smoke test, and re-run itself until stable. Use when the user asks to \"polish code\", \"refine code\", \"iterate on code quality\", \"review loop\", \"clean up, test, and review loop\", or \"run the polish loop\".","description":"# Polish Code\n\n## Task Tracking\n\nAt the start of every invocation (including re-runs from Step 7), use `TaskCreate` to create a task for each step:\n\n1. Run `/stage` skill\n2. Deterministic cleanup\n3. Run `/review-code` skill\n4. Run `/evaluate-findings` skill\n5. Run `/apply-findings` skill\n6. Run `/smoke-test` skill\n7. Re-run `/polish-code` skill if changed\n\n## Step 1: Run `/stage` Skill\n\nRun the `/stage` skill.\n\n## Step 2: Deterministic Cleanup\n\nRun the project's formatter first, then the linter. Fix any lint errors or warnings that the formatter did not resolve. If the project has a combined format+lint script, use that.\n\nRun the project's test suite to confirm nothing is broken. If tests fail, run the `/investigate` skill to diagnose the root cause, apply the suggested fix, and re-run tests. If investigation cannot identify a root cause, stop and report with investigation findings.\n\nStage all changes made in this step before continuing.\n\n## Step 3: Run `/review-code` Skill\n\nRun the `/review-code` skill on the staged changes. The diff command is `git diff --cached`.\n\n## Step 4: Run `/evaluate-findings` Skill\n\nRun the `/evaluate-findings` skill on the results from Step 3.\n\n## Step 5: Run `/apply-findings` Skill\n\nRun the `/apply-findings` skill on the evaluated results.\n\nStage all changes made in this step before continuing.\n\n## Step 6: Run `/smoke-test` Skill\n\nRun the `/smoke-test` skill to produce the smoke test plan. Delegate test execution to a subagent using the Agent tool (`model: \"opus\"`, do not set `run_in_background`). Pass the plan and the diff command (`git diff --cached`) to the subagent.\n\nIf any test fails, fix the issues and stage the fixes.\n\n## Step 7: Re-run `/polish-code` Skill if Changed\n\nCheck whether any file was edited during Steps 5-6. Any edit counts.\n\nThe iteration number below refers to the `/polish-code` run currently executing Step 7. It is not the iteration number of a prospective re-run. Iteration 1 is the initial run; iteration 2 is the first auto-re-run; iteration 3 is the second auto-re-run; iteration 4 and beyond exist only when the user opts in at the hard-cap ask. Iterations 1 and 2 always follow the classification gate (they never trigger the hard cap at their own Step 7, even when the auto-re-run they spawn would be iteration 3). The hard cap fires at the end of iteration 3 and every iteration thereafter.\n\n**Iterations 1 and 2, if changes were made**, classify what Steps 5-6 edited:\n\n- **Structural edits** (fixed bugs, new or removed functions, changed function signatures, moved code between files, changed control flow, added or removed dependencies, corrected a stale or wrong comment that was itself a documentation bug) — run `/polish-code` again using the Skill tool. Scope the diff command to only the files modified in Steps 5-6: use `git diff --cached -- <file1> <file2> ...` as the diff command for `/review-code`. Smoke test scope remains unchanged (full feature scope, not file-narrowed). If the round contains both structural and in-place edits, treat it as structural and re-run automatically.\n- **In-place edits only** (renamed local variables without changing behavior, reformatted, adjusted whitespace, edited neutral comments) — output a summary of what changed, then use `AskUserQuestion` to ask whether to run one more round or stop here. Do not silently continue or silently stop.\n\n**Iterations 1 and 2, if changes were made but you believe re-running is unnecessary**, use `AskUserQuestion` to ask for skip permission. Do not skip silently.\n\n**Iteration 3 or later, if Steps 5-6 of this run made changes**, the hard cap is reached. This replaces the classification gate above for iteration 3 and every iteration after it. Output a summary of what is still changing and whether it is structural or in-place. Then use `AskUserQuestion` to offer three options: continue for another iteration, stop here and accept the current state, or escalate to `/consult-oracle` for a different perspective on the remaining issues.\n\nThe re-invocation is a full, fresh run of this skill. Every step (1-7) executes with its own task tracking and skill invocations. \"Scoped to modified files\" only affects the diff command passed to `/review-code`. It does not affect which steps run or whether skills are invoked.\n\nThen use the TaskList tool and proceed to any remaining task.\n\n## Rules\n\n- Every step must run in every iteration. `/review-code` covers correctness, security, consistency, API usage, coverage, and simplicity across parallel internal reviewers plus peer review. `/evaluate-findings` is a judgment gate that must run before `/apply-findings`.\n- Each step must invoke its designated skill via the Skill tool, not be replaced by inline reasoning or agent calls.\n- Re-invocations from Step 7 are full runs with fresh task tracking and complete skill invocations.","tags":["polish","code","turbo","tobihagemann","agent-skills","claude-code","claude-skills","developer-tools","skills"],"capabilities":["skill","source-tobihagemann","skill-polish-code","topic-agent-skills","topic-claude-code","topic-claude-skills","topic-developer-tools","topic-skills"],"categories":["turbo"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/tobihagemann/turbo/polish-code","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add tobihagemann/turbo","source_repo":"https://github.com/tobihagemann/turbo","install_from":"skills.sh"}},"qualityScore":"0.590","qualityRationale":"deterministic score 0.59 from registry signals: · indexed on github topic:agent-skills · 280 github stars · SKILL.md body (4,856 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T00:54:11.001Z","embedding":null,"createdAt":"2026-04-18T22:03:57.139Z","updatedAt":"2026-04-22T00:54:11.001Z","lastSeenAt":"2026-04-22T00:54:11.001Z","tsv":"'-6':333,462,517,638 '-7':725 '/apply-findings':88,239,243,804 '/consult-oracle':701 '/evaluate-findings':84,224,228,795 '/investigate':163 '/polish-code':98,320,344,499 '/review-code':80,204,208,527,746,778 '/smoke-test':92,261,265 '/stage':73,105,109 '1':71,103,363,404,451,605,724 '2':75,112,369,406,453,607 '3':78,202,235,378,435,445,632,657 '4':82,222,387 '5':86,237,332,461,516,637 '6':90,259 '7':61,94,316,349,422,830 'accept':694 'across':788 'ad':482 'adjust':572 'affect':740,750 'agent':281,823 'alway':407 'anoth':689 'api':783 'appli':170 'ask':22,402,587,623 'askuserquest':585,621,682 'auto':374,383,427 'auto-re-run':373,382,426 'automat':559 'background':290 'behavior':570 'believ':614 'beyond':389 'broken':157 'bug':467,497 'cach':220,300,521 'call':824 'cannot':181 'cap':401,417,438,646 'caus':169,185 'chang':101,194,213,251,323,455,472,479,569,582,609,643,670 'check':324 'classif':410,652 'classifi':458 'clean':34 'cleanup':77,114 'code':3,25,27,30,46,476 'combin':141 'command':216,297,508,525,743 'comment':491,576 'complet':839 'confirm':154 'consist':782 'contain':543 'continu':200,257,600,687 'control':480 'correct':486,780 'count':336 'cover':779 'coverag':785 'creat':65 'current':346,696 'deleg':273 'depend':485 'design':810 'determinist':76,113 'diagnos':166 'diff':215,219,296,299,507,520,524,742 'differ':704 'document':496 'edit':329,335,463,465,550,563,574 'end':442 'error':127 'escal':699 'evalu':247 'even':423 'everi':53,447,659,722,771,776 'execut':275,347,726 'exist':390 'fail':160,307 'featur':534 'file':327,478,512,538,738 'file-narrow':537 'find':191 'fire':439 'first':120,372 'fix':124,173,308,314,466 'flow':481 'follow':408 'format':5,142 'formatt':119,132 'fresh':717,835 'full':533,716,832 'function':471,473 'gate':411,653,799 'git':218,298,519 'hard':400,416,437,645 'hard-cap':399 'identifi':182 'in-plac':547,560,677 'includ':55 'initi':366 'inlin':820 'intern':790 'investig':180,190 'invoc':54,713,734,827,841 'invok':758,808 'issu':310,709 'iter':28,338,354,362,368,377,386,403,434,444,448,450,604,631,656,660,690,777 'judgment':798 'later':634 'lint':6,126,143 'linter':123 'local':566 'loop':33,39,44 'made':195,252,457,611,642 'model':283 'modifi':513,737 'move':475 'must':773,801,807 'narrow':539 'neutral':575 'never':413 'new':468 'noth':155 'number':339,355 'offer':684 'one':591 'opt':395 'option':686 'opus':284 'output':577,663 'parallel':789 'pass':291,744 'peer':793 'permiss':626 'perspect':705 'place':549,562,679 'plan':272,293 'plus':792 'polish':2,24,43,45 'polish-cod':1 'proceed':765 'produc':268 'project':117,138,149 'prospect':358 'qualiti':31 're':13,57,96,176,318,360,375,384,428,557,616,712,826 're-invoc':711,825 're-run':12,56,95,175,317,359,556,615 'reach':648 'reason':821 'refer':341 'refin':26 'reformat':571 'remain':531,708,768 'remov':470,484 'renam':565 'replac':650,818 'report':188 'resolv':135 'result':232,248 'review':8,32,38,791,794 'root':168,184 'round':542,593 'rule':770 'run':14,41,58,72,79,83,87,91,97,104,107,115,147,161,177,203,206,223,226,238,241,260,263,288,319,345,361,367,376,385,429,498,558,590,617,641,718,753,774,802,833 'scope':505,530,535,735 'script':144 'second':381 'secur':781 'set':287 'signatur':474 'silent':599,602,630 'simplic':787 'skill':74,81,85,89,93,99,106,110,164,205,209,225,229,240,244,262,266,321,503,721,733,756,811,814,840 'skill-polish-code' 'skip':625,629 'smoke':9,270,528 'source-tobihagemann' 'spawn':431 'stabl':17 'stage':4,192,212,249,312 'stale':488 'start':51 'state':697 'step':60,70,102,111,198,201,221,234,236,255,258,315,331,348,421,460,515,636,723,752,772,806,829 'still':669 'stop':186,595,603,691 'structur':464,545,554,675 'subag':278,303 'suggest':172 'suit':152 'summari':579,665 'task':47,67,730,769,836 'taskcreat':63 'tasklist':762 'test':7,10,36,151,159,178,271,274,306,529 'thereaft':449 'three':685 'tool':282,504,763,815 'topic-agent-skills' 'topic-claude-code' 'topic-claude-skills' 'topic-developer-tools' 'topic-skills' 'track':48,731,837 'treat':551 'trigger':414 'unchang':532 'unnecessari':619 'usag':784 'use':18,62,145,279,501,518,584,620,681,760 'user':21,394 'variabl':567 'via':812 'warn':129 'whether':325,588,672,755 'whitespac':573 'without':568 'would':432 'wrong':490","prices":[{"id":"35ae0cd0-05d5-4097-8e0d-479fcf784e8a","listingId":"af919d17-e2c8-428e-a102-661681e3b629","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"tobihagemann","category":"turbo","install_from":"skills.sh"},"createdAt":"2026-04-18T22:03:57.139Z"}],"sources":[{"listingId":"af919d17-e2c8-428e-a102-661681e3b629","source":"github","sourceId":"tobihagemann/turbo/polish-code","sourceUrl":"https://github.com/tobihagemann/turbo/tree/main/skills/polish-code","isPrimary":false,"firstSeenAt":"2026-04-18T22:03:57.139Z","lastSeenAt":"2026-04-22T00:54:11.001Z"}],"details":{"listingId":"af919d17-e2c8-428e-a102-661681e3b629","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"tobihagemann","slug":"polish-code","github":{"repo":"tobihagemann/turbo","stars":280,"topics":["agent-skills","claude-code","claude-skills","developer-tools","skills"],"license":"mit","html_url":"https://github.com/tobihagemann/turbo","pushed_at":"2026-04-21T12:22:12Z","description":"A composable dev process for Claude Code, packaged as modular skills.","skill_md_sha":"4d82a6355bc768bb19786bdd08eeda3e93dfdfac","skill_md_path":"skills/polish-code/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/tobihagemann/turbo/tree/main/skills/polish-code"},"layout":"multi","source":"github","category":"turbo","frontmatter":{"name":"polish-code","description":"Stage, format, lint, test, review, smoke test, and re-run itself until stable. Use when the user asks to \"polish code\", \"refine code\", \"iterate on code quality\", \"review loop\", \"clean up, test, and review loop\", or \"run the polish loop\"."},"skills_sh_url":"https://skills.sh/tobihagemann/turbo/polish-code"},"updatedAt":"2026-04-22T00:54:11.001Z"}}