kramme-cc-workflow/skills/kramme:code:rewrite-clean/SKILL.md
Scrap a working-but-mediocre fix and reimplement elegantly. Use after making a fix that works but feels hacky. Applies Chesterton's Fence before scrapping, emits SIMPLICITY CHECK at design time, and rejects rewrites that require modifying tests to pass.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:code:rewrite-cleanInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Knowing everything you know now, scrap this and implement the elegant solution.
Before proceeding, review the current conversation to confirm:
If any of these are missing, STOP and explain:
Only proceed if all three conditions are met.
Even when Step 0 passes, do not proceed if any of these apply:
First implementations often solve the problem but in a hacky way. Having solved the problem once, you now understand it deeply enough to implement it properly from scratch.
Do not preserve the mediocre code. The whole point is to start fresh.
Before touching any code, apply Chesterton's Fence to the mediocre version. You wrote it; that does not mean you remember every decision inside it. Verify you understand why each non-trivial piece exists:
If you cannot answer all five for a given piece, you haven't earned the right to scrap it. Read more first.
Then articulate:
Be specific about what's wrong with the current solution:
Think before coding. Emit a SIMPLICITY CHECK marker stating the minimum shape of the elegant solution:
SIMPLICITY CHECK: <one-line summary of the simplest elegant form that handles all discovered cases>
Then answer:
If the design expands beyond the SIMPLICITY CHECK, write a second line explaining what forced the expansion. If there is no forcing requirement, stay at the simpler form.
git switch -c rewrite-baseline && git commit -am "baseline: pre-rewrite") or stash with a labeled message (git stash push -u -m "pre-rewrite baseline"). State the exact recovery command before continuing.kramme:verify:run for the project's verification battery. If a test fails, the rewrite changed behavior — restore the recovery point or reclassify as a behavior change."Existing tests" in this skill includes any tests written or modified during the current session. The rewrite must satisfy them unchanged.
These are the lies you will tell yourself to justify scrapping code that should stand. Each has a correct response:
Rejection criteria. If any of these are true, revert the rewrite:
Before declaring the rewrite done, self-check:
SIMPLICITY CHECK marker was emitted at design time; any expansion beyond it has a documented forcing requirement.If any box is unchecked, finish the gap or revert before declaring done.
tools
Requires Linear MCP. Implements one Linear issue end to end, selects applicable code-review, convention, and PR-refactor gates, runs them to bounded convergence, verifies, and optionally opens the PR and iterates on CI and review feedback until green. Use when the user wants a single Linear issue taken from implementation through a clean Pull Request. Not for implementation-only work, SIW-tracked issues, stacked PRs, existing PR updates, or post-merge rollout.
development
Reviews PR and local changes for convention drift and overcaution against documented rules and mined peer-file practice. Use for new patterns, dependencies, abstractions, or defensive complexity that departs from established practice; every finding cites evidence. Supports --inline. Not for general code quality (use kramme:pr:code-review) or spec review (use kramme:siw:spec-audit --team).
testing
Charts huge or foggy initiatives into a local `.context` decision map and resolves one typed frontier ticket per session until the work is ready for SIW or another execution workflow. Use when the route to a destination cannot fit in one agent session or parallel workspaces need coordinated planning state. Not for clear specs, ordinary issue decomposition, implementation, or Linear-native tracking.
development
Investigates a question against primary sources and saves one cited Markdown artifact. Use for reading legwork: official docs/API facts, source-code or spec checks, standards, and first-party service behavior before planning or implementation. Not for making product or architecture decisions, implementing code, broad web search, secondary blog summaries, or uncited answers.