From david-skills
Refactors codebases to reduce entropy by diagnosing and incrementally fixing structural, semantic, behavioral, and evolutionary disorder without breaking behavior.
How this skill is triggered — by the user, by Claude, or both
Slash command
/david-skills:entropy-reductionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Systematically reduce codebase disorder without breaking existing behavior. Your job is not to add features — it is to identify high-entropy areas and make them lower-entropy through safe, incremental refactoring.
Systematically reduce codebase disorder without breaking existing behavior. Your job is not to add features — it is to identify high-entropy areas and make them lower-entropy through safe, incremental refactoring.
Entropy in a codebase is the accumulation of inconsistency, unnecessary complexity, and structural disorder that makes future changes harder. It comes from four axes:
| Axis | What it means | Typical symptoms |
|---|---|---|
| Structural | Layering, dependencies, topology | Oversized files/functions, util black holes, circular deps, layer violations |
| Semantic | Naming, concepts, state representation | Same concept with multiple names, scattered state machines, ad-hoc data models |
| Behavioral | API contracts, error handling, boundary behavior | Inconsistent error responses, different status codes for the same error class, env-dependent behavior |
| Evolutionary | Change patterns, ownership, understandability | Giant mixed-purpose PRs, no clear module ownership, design intent buried in chat history |
Prioritize: obviously high-entropy areas >> minor style issues. Never rewrite stable, well-functioning code just for aesthetics.
When given a codebase scope (file, directory, module, or repo), follow these four phases:
Scan the target scope and identify high-entropy symptoms. For each finding, note:
Concrete things to look for:
Structural entropy
util/, common/, helpers/ directories that have become catch-all dumping grounds with business logic mixed inSemantic entropy
user / member / account / customer / profile all meaning the same thing)Behavioral entropy
Evolutionary entropy
Present findings as a concise list — developer-readable, no jargon overload.
Design an incremental entropy reduction plan:
Propose 1–3 small, safe changes that can be done immediately. For each:
Prioritize by: highest entropy reduction per unit of risk. Do the safe, high-impact changes first.
Flag anything that needs human input — if you're unsure about a naming convention, an architectural boundary, or whether a behavior change is acceptable, ask rather than guess.
Execute the planned changes:
After making changes:
These are hard rules — do not violate them:
user, don't introduce member or account as an alternative name for the same concept.Structure your output as:
Keep the diagnosis and plan sections concise. The code changes are the main deliverable.
npx claudepluginhub thedavidweng/skillsIdentifies code smells, assesses refactoring risk, and builds incremental execution plans with rollback strategies. Activates on refactoring, code cleanup, tech debt, or duplication reduction requests.
Applies disciplined refactoring in small, verifiable steps to improve code structure without changing behavior: extract functions, rename, move code.
Reviews code for smells, complexity, and design issues; applies SOLID principles and clean code heuristics during refactoring. Language-agnostic.