kramme-cc-workflow/skills/kramme:code:refactor-pass/SKILL.md
Perform a refactor pass focused on simplicity after recent changes. Use when the user asks for a refactor/cleanup pass, simplification, or dead-code removal on a narrow scope and expects build/tests to verify behavior. Applies Chesterton's Fence before removing code, rejects simplifications that require modifying tests, and works one slice at a time.
npx skillsauth add abildtoft/kramme-cc-workflow kramme:code:refactor-passInstall 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.
Perform a simplification pass on recent changes: remove dead code, straighten logic, drop excessive parameters, and verify with build/tests after each change. One simplification at a time, preserving behavior exactly.
This skill edits files and commits each verified slice, so it runs only after explicit user invocation.
kramme:code:refactor-opportunities for that).Before starting, check that simplification is actually warranted. Do not proceed if:
If any of these apply to the whole scope, stop and tell the user why. If they apply to specific sections, skip those sections.
Before picking simplifications, decide what "recent changes" means for this invocation:
git diff origin/main...HEAD), plus uncommitted working-tree changes.Record the scope before starting the loop. Every simplification must fall inside it; observations outside it become NOTICED BUT NOT TOUCHING markers, not new work.
This skill emits two markers. Use these exact formats so a calling agent can parse them.
SIMPLICITY CHECK — the minimum change you intend to make for the current slice:
SIMPLICITY CHECK: <one-line summary of the minimum change>
If the change ends up larger than that minimum, add a second line naming the concrete requirement that forced the expansion.
NOTICED BUT NOT TOUCHING — anything adjacent you saw while editing but are intentionally leaving alone:
NOTICED BUT NOT TOUCHING: <what you saw>
Why skipping: out-of-scope for this simplification
Log; do not silently resolve. A future pass can address it as its own slice.
Before removing or substantially changing any piece of code, verify you understand why it exists. Answer all five:
git log -L or git blame on the lines. A named bug in the commit message is load-bearing context.)If you can't answer all five, you haven't earned the right to remove it. Either read more, or emit NOTICED BUT NOT TOUCHING and move on.
Each simplification is one pass through this loop. One simplification at a time — verify after each. Do not batch.
From the resolved scope, pick exactly one target. Candidates:
State the minimum change that accomplishes the simplification (see Markers).
Apply only that one change. Keep the diff small. If the diff grows past a few files or a few dozen lines, you are probably doing more than one thing — split the slice.
If you notice something adjacent that also wants fixing, do not fix it — emit a NOTICED BUT NOT TOUCHING marker and continue.
Run the project's verification battery via kramme:verify:run — build, typecheck, lint, and existing tests must all pass. Tests must pass unmodified. If a test fails, you changed behavior: revert the slice (git restore the touched files) and either re-plan or reclassify it as a behavior change handled outside this skill.
If kramme:verify:run cannot run (no test/lint/build configured, tool errors, etc.), stop and surface the gap. Do not declare the slice verified.
When verification passes, commit the slice on its own. The committed state becomes the baseline for the next iteration.
Return to step 1 with the new committed baseline. Do not accumulate simplifications into one large diff.
kramme:verify:run.kramme:code:incremental applies the same one-thing-at-a-time rule to feature work. Refactor passes obey the same six rules; this skill is the refactor-flavored loop.kramme:deslop-reviewer agent, use kramme:code:cleanup-ai.kramme:code:rewrite-clean instead. A mediocre implementation is sometimes best scrapped rather than patched.kramme:code:refactor-opportunities for a codebase-wide scan.These are the lies you will tell yourself to justify going past the scope of the pass. Each has a correct response:
NOTICED BUT NOT TOUCHING. Rename is its own slice — often its own PR.Ways a simplification pass turns into damage. If any of these happen, reject the slice and revert:
try/catch wrapping a library call may be absorbing a known failure mode; a null check that "can't happen" must be proven unreachable (via types, invariants, or caller analysis) before removal.The loop enforces most invariants per-iteration; this is the residual check:
NOTICED BUT NOT TOUCHING marker; none were silently fixed.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