Install
$ agentstack add skill-kreek-consult-refactoring ✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
Verified badge
Passed review? Show it. Paste this badge into your README, it links to the public security report.
Reliability & compatibility
Declared compatibility
Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.
We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.
How agent discovery & health will work →About
Refactoring
Iron Law
GREEN BEFORE THE REFACTOR. GREEN AFTER EACH STEP. NEVER MIX STRUCTURE AND BEHAVIOR IN ONE COMMIT.
When to Use
- Changing structure while preserving behavior: legacy refactors, large
renames, extractions, migrations, branch by abstraction, strangler fig, Mikado planning, characterization tests, or big-bang rewrite avoidance.
When NOT to Use
- Behavior-first feature work; use
proof. - Commit grouping or git history surgery after changes already exist;
use git-workflow.
Core Ideas
- Preserve behavior first; add characterization tests where coverage
is missing. Separate structural from behavior changes: every commit is one or the other, never both.
- Name the coupling before changing structure: data shape, side effect,
module boundary, ownership, time, transport, persistence, or compatibility.
- Make every step small, reversible, and shippable.
- Validate the target shape before moving large amounts of code.
- For public interfaces, use parallel change: expand, migrate callers, then
contract. Ask which callers, data, and releases must keep working before adding shims, dual paths, or migration complexity.
- Delete old paths only when traffic/callers have moved and
verification proves it.
- Simplification is refactoring: remove accidental complexity only after
naming the behavior preserved and the coupling reduced.
Workflow
- Define the current behavior that must not change. Add or identify
tests that catch regressions at the public boundary.
- Name the concern being separated and its current coupling point.
- Pick the smallest safe pattern: rename, extract, move, parallel
change, branch by abstraction, or strangler. For broad renames, write a rename map first: separate private symbols, file paths, runtime/public keys, persisted names, docs, and compatibility cleanup.
- Record a preservation Proof Contract: unchanged behavior claim,
relevant invariant, public boundary, before/after check, evidence.
- For simplification, remove only complexity that has a named cost:
hidden mutable state, unnecessary layer, broad helper, scattered behavior, compatibility shim, dead flag, or duplicated rule with divergent meaning.
- Make one structural step, run focused tests, commit. Track any old
path left behind with owner and removal condition.
Verification
- [ ] Tests were green before the refactor; characterization coverage
exists for legacy behavior touched.
- [ ] The coupling being separated was named before code moved.
- [ ] Each commit is structural or behavioral, not both; the system is
shippable at every commit.
- [ ] Public interface changes use expand-contract or compatibility
shims; old and new paths both work during migration.
- [ ] Backward compatibility expectations were confirmed or inherited
from an explicit public contract before compatibility machinery was added.
- [ ] Simplification claims name the removed complexity and the preserved
behavior; behavior preservation has before/after evidence.
- [ ] Deleted tests were replaced by equal or stronger behavior
coverage.
- [ ] Leftover migration/deletion work has owner and deadline.
- [ ] Every behavior-preservation claim has before/after proof
evidence, or the refactor is reported as unproven.
Tripwires
Use these when the shortcut thought appears:
- Name behavior-preservation proof and add characterization where coverage is
missing.
- Split structural and behavioral changes before committing.
- Extract a helper/layer only after naming the behavior, state, effect, or
boundary being separated.
- Treat shorter code as simpler only when it does not hide state, effects,
compatibility, ownership, or independent behavior.
- Commit renames separately from extractions when possible.
- Put opportunistic tweaks in separate behavior commits or leave them out.
- Prove no callers remain before deleting old paths, or use expand-contract
migration.
- Replace big-bang rewrites with the next safe slice or branch-by-abstraction
path.
Handoffs
proof: preservation evidence, characterization, boundary tests.git-workflow: clean change grouping.domain-modeling: effects or domain shape.architecture: module boundaries, locality, layering, DDD patterns.- Workflow
references/simple-not-easy.md: real coupling vs local ease.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: kreek
- Source: kreek/consult
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet, be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.