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.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.