simplify-and-refactor-code-isomorphically
Made by JeffShrink and unify code without changing behavior. Use when: simplify, refactor, reduce duplication, remove lines, extract helper, reuse component, DRY, collapse, better abstraction.
From Jeffrey's Skills.md: professionally crafted skills for any AI agent, installed and kept in sync by the jsm CLI. Subscription only, $20/month.
Works With
Quality and Utility come from canonical skill metadata. Community ratings appear separately as stars when subscriber reviews exist.
Subscribe to download
Public previews are available, but downloads, CLI sync, and premium content require an active subscription.
Sign In to Subscribe- Full skill content with deterministic versioning
- CLI sync + local search index
- Access to Jeffrey’s premium library
Save to your account
Saved skills live in your cloud list. Run jsm sync on each machine to pull them locally.
What's New with this Skill
2Updates, enhancements, and release notes for this skill.
Enhanced: simplify-and-refactor-code-isomorphically, the swarm script spawns real sessions
The multi-agent swarm script called ntm spawn <name> --dir <path>, and NTM has no --dir flag, so every worker spawn failed and the script was left with nothing but warnings. It now derives the project name, spawns one labeled single-agent session per worker with --verify-boot, and sends marching orders to the <project>--<label> sessions NTM actually creates.
- Workers spawn as ntm spawn "$PROJECT_NAME" --label refactor-worker-NN --cc=1 --no-user --verify-boot
- Marching orders go to the <project>--refactor-worker-NN session names that ntm spawn --label actually creates
simplify-and-refactor-code-isomorphically: prove behavior identical, then remove lines. A seven-phase Loop that gates every net-negative LOC change on proof.
Most refactors land because they 'feel cleaner.' This skill refuses to delete a line without a proof: every candidate passes through a scored matrix, an isomorphism card, and a verify gate where goldens stay bit-identical. Net-negative LOC ships with a ledger row and a rejection log.
- Seven-phase Loop: Baseline → Map → Matrix → Prove → Collapse → Verify → Ledger. Each phase writes a named artifact under refactor/artifacts/<run-id>/, such as loc_before.json, duplication_map.json, isomorphism_card.md, and ledger.md. No artifact, phase isn't done.
- The One Rule: prove behavior identical, then remove lines. Verify gate is mechanical: tests green, goldens bit-identical by sha256, typecheck clean, lint delta ≤ 0. 'Looks cleaner' never reaches main without an isomorphism card.
- Opportunity Matrix scores each candidate (LOC_saved × Confidence) / Risk ≥ 2.0. Sub-threshold rows go to the rejection log with a named reason, so a future pass over the same repo doesn't re-propose the collapse that already failed its proof.
- Five subagents, each with a defined output: duplication-scanner (dup_scan.sh with jscpd and similarity-*, plus the AI-slop scan), isomorphism-auditor (stress-tests a filled isomorphism card before editing), refactor-extractor, refactor-reviewer, and dead-code-checker.
- Twenty-five runnable scripts drive the Loop: baseline.sh, dup_scan.sh, callsite_census.sh, isomorphism_card.sh, property_test_scaffold.sh, verify_isomorphism.sh, ledger_row.sh, ai_slop_detector.sh, dead_code_safety_check.sh, plus sixteen more.
- Clone taxonomy runs from Type I (exact) to Type V (accidental rhyme): Type IV needs a proof of equivalence before merging, and Type V is never merged. AI-slop pathologies such as pass-through wrappers, over-defensive try/catch, and dead feature flags get named detection and collapse recipes.
- Language deep-dives for Rust, React, Python, Go, C++. Each names idiomatic collapse targets: enum dispatch over send_* families, generic helpers over instantiated siblings, trait objects over boxed closures, Protocol vs ABC for Python duck typing.
- Mirror of extreme-software-optimization: that skill picks hot paths to speed up; this skill picks cold paths to simplify. Artifacts compose under one run-id: profile, optimize, simplify, ledger.
- Rescue missions for vibe-coded codebases: RESCUE-MISSIONS.md fixes red tests, broken builds, and loud lints before the main loop. In the Map phase, ai_slop_detector.sh flags nullish-chain sprawl, pass-through wrappers, feature flags, and orphan _v2 files.
- Per-commit discipline matches AGENTS.md: no v2/_new/_improved names, no regex codemods (manual Edit or parallel subagents only), no file deletion without permission. A helper that becomes empty gets an ask-before-remove artifact for human sign-off.
Most 'clean this up' PRs ship because somebody squinted at the diff and decided it was better. This skill reverses that. The One Rule is prove behavior identical, then remove lines; no proof, no delete. A seven-phase Loop (Baseline → Map → Matrix → Prove → Collapse → Verify → Ledger) runs on every candidate, and each phase writes a named artifact under refactor/artifacts//. A candidate that skips a phase isn't refactored; a commit without a ledger row didn't happen.