next-code-simplifier
Simplify code for clarity, consistency, and maintainability while preserving all functionality. Use after completing a coding task or after passing code review to polish the implementation.
When & Why to Use This Skill
The next-code-simplifier is a professional development tool designed to enhance code quality through automated refactoring and simplification. It focuses on improving readability, consistency, and maintainability by eliminating redundant logic and enforcing project-specific standards without altering functional behavior. This skill is ideal for technical debt reduction and ensuring clean code practices in collaborative environments.
Use Cases
- Post-Development Polishing: Use this skill after completing a coding task to clean up temporary logic, optimize variable naming, and ensure the implementation is concise before submission.
- Code Review Remediation: Quickly address reviewer feedback regarding code complexity by automatically flattening nested structures and consolidating redundant abstractions.
- Legacy Code Modernization: Simplify older code modules to align with current project standards, such as updating import patterns or enforcing explicit type annotations.
- Standardizing Team Contributions: Ensuring that code written by different developers follows a unified style guide and architectural pattern as defined in project documentation like CLAUDE.md.
| name | next-code-simplifier |
|---|---|
| description | Simplify code for clarity, consistency, and maintainability while preserving all functionality. Use after completing a coding task or after passing code review to polish the implementation. |
This skill simplifies code for clarity, consistency, and maintainability while preserving exact functionality. It applies project-specific best practices and prioritizes readable, explicit code over overly compact solutions.
Context to Gather
Before simplifying, read:
AGENTS.mdorCLAUDE.md- Project coding standards~/.agents/docs/development/coding-directives.md- Coding standards- Related code to understand existing patterns
Core Responsibilities
1. Preserve Functionality
Never change what the code does - only how it does it. All original features, outputs, and behaviors must remain intact.
2. Apply Project Standards
Follow the established coding standards including:
- Proper import sorting and module patterns
- Function declaration conventions
- Explicit return type annotations
- Proper component patterns with explicit types
- Error handling patterns
- Consistent naming conventions
3. Enhance Clarity
Simplify code structure by:
- Reducing unnecessary complexity and nesting
- Eliminating redundant code and abstractions
- Improving readability through clear variable and function names
- Consolidating related logic
- Removing unnecessary comments that describe obvious code
- Avoiding nested ternary operators - prefer switch statements or if/else chains
- Choosing clarity over brevity - explicit code is often better than compact code
4. Maintain Balance
Avoid over-simplification that could:
- Reduce code clarity or maintainability
- Create overly clever solutions that are hard to understand
- Combine too many concerns into single functions or components
- Remove helpful abstractions that improve code organization
- Prioritize "fewer lines" over readability
- Make the code harder to debug or extend
5. Focus Scope
Only refine code that has been recently modified or touched in the current session, unless explicitly instructed to review a broader scope.
Refinement Process
- Identify the recently modified code sections
- Analyze for opportunities to improve clarity and consistency
- Apply project-specific best practices and coding standards
- Ensure all functionality remains unchanged
- Verify the refined code is simpler and more maintainable
- Document only significant changes that affect understanding
Output Format
For each simplification:
- Location: File path and line range
- Issue: What makes the current code complex or unclear
- Change: The simplified version
- Rationale: Why this improves clarity/maintainability
Group changes by file. Prioritize high-impact simplifications.
Ensure all code meets the highest standards of clarity and maintainability while preserving complete functionality.