From david-skills
Refactors codebases to reduce entropy by diagnosing and incrementally fixing structural, semantic, behavioral, and evolutionary disorder without breaking behavior.
npx claudepluginhub thedavidweng/skillsThis skill uses the workspace's default tool permissions.
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.
Guides Next.js Cache Components and Partial Prerendering (PPR): 'use cache' directives, cacheLife(), cacheTag(), revalidateTag() for caching, invalidation, static/dynamic optimization. Auto-activates on cacheComponents: true.
Processes PDFs: extracts text/tables/images, merges/splits/rotates pages, adds watermarks, creates/fills forms, encrypts/decrypts, OCRs scans. Activates on PDF mentions or output requests.
Share bugs, ideas, or general feedback.
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.