Dead code detection, over-abstraction identification, complexity reduction, and YAGNI enforcement
Code Simplification identifies unnecessary complexity in the codebase and recommends concrete simplifications. It detects dead code (defined but never called), over-abstraction (abstractions serving a single use case), excessive indirection (wrappers that add no value), and violations of YAGNI (You Ain't Gonna Need It). The goal is to reduce the cognitive load of understanding and maintaining the codebase by removing everything that does not earn its complexity. Simpler code has fewer bugs, is easier to test, and is cheaper to maintain.
| Parameter | Type | Required | Description |
|---|
| code | string | Yes | Code to analyze for simplification opportunities |
| mode | string | No | "simplification" (default) |
| context | dict | No | Usage data, call graph, module dependencies |
| focus_areas | list[string] | No | Specific areas: "dead_code", "over_abstraction", "complexity" |
| thinking_mode | string | No | Thinking budget tier |
Dead code detection -- Identify code that is defined but never used:
Over-abstraction identification -- Find abstractions that serve only one use case:
Indirection analysis -- Map call chains and identify unnecessary intermediaries:
Complexity measurement -- Quantify code complexity:
YAGNI assessment -- Identify features that were built "just in case":
Simplification proposal -- For each finding, propose a specific simplification:
Impact assessment -- For each proposal, assess:
Prioritization -- Rank simplifications by value (maintenance savings / effort):
The skill produces a simplification analysis report:
{
"passed": true,
"grade": "B",
"score": 0.75,
"issues": [
{
"severity": "medium",
"category": "dead_code",
"description": "Function _legacy_plan_format() defined on line 234 but never called from anywhere in the codebase",
"file": "vetinari/orchestration/plan_generator.py",
"line": 234,
"suggestion": "Delete the function -- git history preserves it if needed later"
},
{
"severity": "medium",
"category": "over_abstraction",
"description": "AbstractPlanValidator has only one implementation (DefaultPlanValidator). The abstraction adds complexity without benefit.",
"file": "vetinari/validation/plan_validator.py",
"line": 12,
"suggestion": "Inline DefaultPlanValidator logic into the single caller, remove the ABC"
},
{
"severity": "low",
"category": "complexity",
"description": "Function process_plan_step has cyclomatic complexity of 14 (target: <10)",
"file": "vetinari/orchestration/two_layer.py",
"line": 89,
"suggestion": "Extract the error classification logic into a separate function, use early returns to flatten conditions"
}
],
"metrics": {
"dead_code_functions": 3,
"over_abstractions": 1,
"high_complexity_functions": 2,
"total_lines_removable": 145,
"simplification_effort": "M"
},
"suggestions": [
"Consider merging plan_generator.py and plan_validator.py -- they are tightly coupled and always used together"
]
}
This skill is governed by the following standards from the skill registry:
Input: