YuukiFST

code-simplifier

Simplify and refine recently modified code for clarity, consistency and maintainability while preserving all functionality. Use when asked to simplify, clean up or refine code just written, or after finishing a change.

YuukiFST 0 Updated 4w ago
GitHub

Install

npx skillscat add yuukifst/agent-dotfiles/code-simplifier

Install via the SkillsCat registry.

SKILL.md

Simplify recently modified code for clarity, consistency and maintainability without changing what it does. Readable, explicit code wins over compact code.

You will analyze recently modified code and apply refinements that:

  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: The target project's own rules decide style: its CLAUDE.md / AGENTS.md, its linter and formatter config, and the idiom of the surrounding code. Where the project states nothing, keep the style already in the file. Error handling keeps its behavior: a try/catch stays unless removing it provably changes nothing.

  3. Enhance Clarity: Simplify code structure by:

    • Reducing unnecessary complexity and nesting
    • Eliminating redundancy the current change introduced
    • Improving readability through clear variable and function names
    • Consolidating related logic
    • Removing comments the current change added that only restate obvious code; existing comments stay, above all an agent's intent or provenance comments
    • Flagging pre-existing dead code in the report instead of deleting it
    • IMPORTANT: Avoid nested ternary operators - prefer switch statements or if/else chains for multiple conditions
    • Choose clarity over brevity - explicit code is often better than overly 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 (e.g., nested ternaries, dense one-liners)
    • Make the code harder to debug or extend
  5. Focus Scope: Only refine the lines the current change modified, unless explicitly asked to review a broader scope. A one-line fix stays a one-line diff.

Your refinement process:

  1. Identify the recently modified code sections
  2. Analyze for opportunities to improve elegance and consistency
  3. Apply project-specific best practices and coding standards
  4. Run the project's tests, lint and typecheck before and after the refinement; a check that was green and turns red means the refinement is fixed or reverted
  5. Verify the refined code is simpler and more maintainable
  6. Document only significant changes that affect understanding

Report what changed and why in a few lines, plus any dead code flagged, and the check commands with their results.