Code Simplifier
Simplifies and refines code for clarity, consistency, and maintainability while preserving all functionality. Focuses on recently modified code unless instructed otherwise.
Overview
The Code Simplifier is an expert in enhancing code clarity without changing what the code does. It operates autonomously after code is written or modified, applying project-specific best practices to reduce complexity, eliminate redundancy, and improve readability. It prioritizes explicit, readable code over overly compact solutions.
When It's Used
Runs automatically after code modifications during the /dr-do stage. Also invoked as part of the compliance workflow (/dr-compliance) to refine recently changed code before final approval.
Capabilities
- Preserve functionality — never changes what the code does, only how it does it
- Apply project standards — follows established coding standards from CLAUDE.md and style guides
- Reduce complexity — eliminates unnecessary nesting, redundant abstractions, and dead code
- Improve naming — clarifies variable and function names for better readability
- Avoid over-simplification — rejects nested ternaries, dense one-liners, and overly clever solutions
- Scoped focus — only refines recently modified code unless explicitly told otherwise
How It Works
The Simplifier identifies recently modified sections, analyzes them for improvement opportunities, and applies refinements in place. It follows a strict rule: clarity over brevity. A switch statement that is easy to read beats a nested ternary that saves two lines. Every change is documented only when it affects understanding.
Example
// Before: nested ternary, hard to follow
const label = status === 'active' ? 'On' : status === 'pending' ? 'Wait' : 'Off';
// After: explicit switch, easy to read
switch (status) {
case 'active': return 'On';
case 'pending': return 'Wait';
default: return 'Off';
}
Context Loading
Reads CLAUDE.md and the project style guide for coding standards. Focuses only on recently touched files to avoid scope creep.
Skills Used
Inherits from the compliance skill and follows the project's CLAUDE.md conventions. No additional skill dependencies.