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.
development
Runs kramme:pr:code-review as a closeout review loop for local or PR branch changes before commit, ship, or final response. Use when the user asks for autoreview, second-model review, or a final code-review pass after non-trivial edits. Not for UX, visual, accessibility, or product review.
development
Guides topic-level understanding verification for a PR, branch, feature, document, spec, design decision, bug fix, or other concrete subject. Use when the user asks to confirm, quiz, drill, teach-and-check, or verify that they understand a topic. Maintains a topic-specific checklist artifact and requires demonstrated understanding before marking the topic complete. Not for ordinary explanations without verification, end-of-session summaries, or code/test correctness checks.
testing
Design a CI/CD pipeline with quality gates, a <10-minute budget, feature-flag lifecycle, and an exit checklist. Use when adding a new CI pipeline, changing gate configuration, or planning a rollout for a new service. Complementary to kramme:pr:fix-ci (which fixes failures in an existing pipeline). Covers gate ordering, secrets storage, branch protection, rollback mechanism, and staged-rollout guardrails — not a rollout-execution runbook.
tools
--- name: kramme:visual:demo-reel description: Capture local demo evidence for observable product behavior: screenshots, before/after image sets, browser reels, terminal recordings, and short GIF/video proof. Use when shipping UI changes, CLI features, or any change where PR reviewers would benefit from visual or behavioral evidence. argument-hint: "[what to capture] [--url <url>|auto] [--tier static|before-after|browser-reel|terminal-recording]" disable-model-invocation: true user-invocable: tr