/dedene-skills:untangle-codebasefrom dedene-skills
Audits or refactors a codebase to reduce hidden coupling, scattered business rules, and unnecessary abstractions while preserving behavior. Use for de-spaghettifying, architecture cleanup, or broad structural refactors.
Ships in dedene-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Make future changes easier to locate, reason about, and verify. Improve boundaries where code demonstrates a problem; leave healthy structure alone. Fewer files, fewer branches, and more abstractions are not success criteria. Success looks like this: one rule has one owner, a change that used to touch five files now touches one, and a reader can find where a behavior lives without tracing callbacks across the tree.
Infer the mode from the request: an audit or assessment produces findings without changing application code; a request to untangle or refactor includes implementation and verification. A requested area limits the work. For a whole-codebase request, inventory the whole first-party system and work through its supported findings in coherent increments; report any areas not inspected deeply.
Carry existing authorization forward. Do not add an approval checkpoint for routine local refactoring. Ask only when an unresolved behavior or compatibility decision materially changes the outcome. Toolchain upgrades, architecture migrations, unrelated bug fixes, bulk comment/test deletion, publication, and production changes are not implied by this skill.
Read applicable repository instructions, status, manifests, build definitions, CI configuration, and relevant documentation. Identify:
Read only the profiles for the affected components:
| Component | Reference |
|---|---|
| Ruby on Rails | Rails |
| Go services, CLIs, and libraries | Go |
| Swift macOS apps and packages | Swift/macOS |
| JavaScript/TypeScript frontends and backends | JavaScript/TypeScript |
| Python web apps, tools, and pipelines | Python |
| PHP applications and extensions | PHP |
| Java/Kotlin backend applications | JVM/Spring |
| C#/.NET applications and workers | .NET |
| Rust services, CLIs, and libraries | Rust |
Profiles are conditional guidance, not instructions to migrate to their named frameworks. Use the general workflow for other stacks, consult version-matched primary documentation when necessary, and state what could not be verified.
Trace representative operations from entrypoint through state changes and effects. Use symbol navigation, targeted searches, and existing tooling before building new analyzers. Import graphs show only part of the system: also follow callbacks, events, reflection, generated bindings, schemas, queues, configuration, and process boundaries. If making an outline, do it in scratch space; never strip bodies from working source files.
On a large system where delegation is available and allowed, map components in parallel: give each agent one component and this section's questions, require file-level evidence, then combine the results yourself. Cross-component links are where the important findings usually are, so look for them in the combined map rather than in any single report.
Ask one question of each relationship: should these pieces change together? A finding is a place where the code answers it wrong:
Treat special cases (an if for one value, a parameter for one caller, a swallowed exception) as clues to a requirement the design never modeled. Name that requirement before deciding whether to keep, generalize, or remove the case.
Use recent Git history to test hypotheses about what changes together. This counts file pairs that co-changed in commits of at most 20 files; scope the pathspec to the area under review:
git log --since=12.months --no-merges --name-only --format=format:@ -- . |
awk 'function flush(){ if (n > 1 && n <= 20) for (i = 1; i < n; i++) for (j = i + 1; j <= n; j++) c[f[i] < f[j] ? f[i] " " f[j] : f[j] " " f[i]]++; n = 0 }
/^@/ { flush(); next } NF { f[++n] = $0 }
END { flush(); for (p in c) if (c[p] > 2) print c[p], p }' | sort -rn | head -30
Exclude lockfiles, generated files, mechanical renames, and formatting commits from the inference. Pairs across components with no visible dependency are the most interesting. Similar code or frequent co-change alone does not prove shared responsibility; a test and its subject, or a manifest and its README, are expected to move together.
For each proposed finding, record:
Example:
### Refund eligibility is decided in three places
- **Evidence:** `app/models/order.rb:88` (`refundable?`, 30 days), `app/controllers/refunds_controller.rb:24` (inline 30-day check), `app/jobs/auto_refund_job.rb:12` (31-day check). Commits `a1b2c3d` and `e4f5a6b` changed the window in two of the three.
- **Consequence:** changing the refund window takes three coordinated edits; the job already disagrees by a day.
- **Correction:** make `Order#refundable?` the owner and call it from the controller and job. Tradeoff: the job loads each order instead of filtering in one query.
- **Preservation:** refund responses and job results for orders aged 29, 30, and 31 days. Add characterization tests first; ask whether day 31 is intended before choosing which behavior survives.
Rank by demonstrated impact and frequency, confidence, and change risk. Separate supported findings from questions. A long file, a one-implementation interface, a retry, or a framework convention is not a finding by itself.
Prefer an existing idiomatic boundary over introducing a new architecture. Bring one rule under one owner where that reduces coordination; keep distinct rules separate even when their code currently matches. Logical ownership can span conventional folders. Do not force every feature into a single directory or every dependency behind an interface.
Group findings when one correction removes their shared cause. Explain which relationships it fixes and verify each affected consumer; avoid separate patches that preserve the same underlying coordination problem.
Before removing an apparent exception, identify the requirement it serves: retries, compatibility branches, locks, caches, availability checks, and adapters may be essential. Before removing apparently unused code, check exports, reflection, framework discovery, configuration, generated callers, platform variants, and consumers outside the repository. An empty search result is insufficient evidence.
Preserve contracts appropriate to the application:
| Application | Contracts to trace through a refactor |
|---|---|
| Libraries/SDKs | Public symbols, import paths, serialization, error behavior, supported versions, external consumers |
| CLIs/automation | Flags, stdout/stderr, exit codes, configuration precedence, signals, cleanup |
| Web/services | Routes, authorization, middleware order, transaction boundaries, response/event schemas |
| UI/native apps | State identity, lifecycle, focus, navigation, accessibility, thread/actor and process boundaries |
| Workers/pipelines | Ordering, delivery semantics, idempotency, retries, cancellation, checkpoints, data formats |
For mixed stacks, follow contracts across the boundary: a Rails endpoint and its TS caller, or a Rust component and its Swift consumer, belong in the same analysis when the change crosses them. Update generators and their inputs rather than editing generated output as the source of truth.
Keep decisions beside findings in the conversation or the repository's existing task document. Use scratch space for temporary inventories and tool output. Do not invent a persistent ledger or add repository documentation unless the task needs it.
In audit mode, stop with the ranked findings, proposed corrections, and coverage limits. In refactor mode, complete the supported in-scope corrections:
Fix regressions introduced by the refactor. Record unrelated baseline failures without expanding scope. If a required check is unavailable, continue independent safe work, state the exact blocker, and do not claim the affected behavior is verified. Do not run an unverified high-risk transformation through the rest of the codebase.
Review the final diff against the findings and preservation requirements. Revisit affected dependency and registration paths, and check whether the proposed correction actually reduced the original coordination burden. Do not replace a small problem with a general framework.
For broad changes, an independent review can help when delegation is available and allowed. Give reviewers bounded areas and require file-level evidence; review their findings rather than treating consensus as proof. A single-agent run remains valid.
Finish when supported findings within scope are resolved or explicitly deferred with reasons, required relevant checks have passed or their concrete blockers are reported, and no regression introduced by the work remains unexplained. Do not search indefinitely for architectural perfection or silently declare a partially inspected repository clean.
Report what became easier to change, the key corrections with file references, actual verification results, and retained exceptions or limitations. For an audit with no supported findings, say so without inventing work.
Adapted from caldoai/skills: untangle-codebase (MIT).
agents/openai.yaml (opens in a new tab)references/dotnet.md (opens in a new tab)references/go.md (opens in a new tab)references/javascript-typescript.md (opens in a new tab)references/jvm-spring.md (opens in a new tab)references/php.md (opens in a new tab)references/python.md (opens in a new tab)references/rails.md (opens in a new tab)references/rust.md (opens in a new tab)references/swift-macos.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub dedene/skills --plugin dedene-skills14 skills in this plugin
/architect-loopRun an explicitly requested architect/builder loop using a project handoff and user-defined acceptance gates./autopilot-interviewInterview or stress-test a plan when the user requests it. Resolve routine choices and surface consequential unresolved decisions./go-cli-builderBuild or extend a Go CLI with explicit command, auth, configuration, and output contracts./idea-to-visualThis skill should be used when turning an idea, quote, insight, book chapter, post, or talk section into a simple explanatory visual (concept sketch, visual metaphor, comparison, diagram-style illustration) and when prompting image generators for it — Higgsfield (via mcporter), Gemini / Nano Banana, ChatGPT image, or any other image tool, with or without reference images. Covers visual/element brainstorming, concept critique and captions, generator-ready prompts, style transfer of rough sketches, tracing-friendly metaphor objects, and a consistent house style. Triggers on "visualize this idea", "make a visual for", "illustrate this concept", "run VB / EB / CB" (visual, element, caption brainstorm), "style transfer my sketch", "caption for this visual"./last30days-localResearch recent community discussion across supported social sources when the user requests a recent-reaction or last-30-days sweep./smooth-shadowsGenerate layered box-shadow CSS or Tailwind values when the requested design needs smooth elevation.Other plugins' skills for the same job