code-simplification

Refactors code to reduce complexity while preserving exact behavior and passing existing tests.

2|Updated Jul 25, 2026
One-click install
npx skills add https://github.com/ankaboot-source/boucle --skill code-simplification-ankaboot-source
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-simplification
Source: https://github.com/ankaboot-source/boucle/tree/main/.jcode/skills/code-simplification
Command: npx skills add https://github.com/ankaboot-source/boucle --skill code-simplification-ankaboot-source

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working code often accumulates unnecessary complexity — deep nesting, long functions, unclear names, and duplicated logic — making it harder to read, maintain, and extend. This Skill provides a disciplined, behavior-preserving process for simplifying code without introducing regressions. ## Core Features & Use Cases - Behavior-Preserving Refactoring: Applies five principles (preserve behavior, follow project conventions, prefer clarity, maintain balance, scope to changes) so every simplification keeps inputs, outputs, side effects, and error behavior identical. - Pattern Detection Checklists: Identifies concrete simplification signals such as 3+ level nesting, 50+ line functions, nested ternaries, boolean flag parameters, generic names, dead code, and over-engineered abstractions. - Incremental Verified Changes: Enforces a one-change-at-a-time workflow with test runs after each step, plus language-specific guidance for TypeScript, JavaScript, Python, and React/JSX. - Use Case: After shipping a feature whose implementation grew messy under time pressure, run this Skill to systematically clean up the changed code, verify all tests still pass unmodified, and produce a clean reviewable diff. ## Quick Start Simplify the recently modified functions in this module for readability without changing any behavior, and run the test suite after each change.

Frequently Asked Questions about code-simplification

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor code without changing its behavior?

Refactor incrementally: make one simplification at a time and run the full test suite after each change. Verify that inputs, outputs, side effects, error behavior, and edge cases remain identical, and revert immediately if any test fails.

How to simplify deeply nested code and long functions?

Replace deep nesting with guard clauses and early returns, and split functions over 50 lines into focused helpers with descriptive names. Convert nested ternaries into if/else chains, switch statements, or lookup objects for faster comprehension.

When should I not simplify or refactor code?

Avoid simplifying code you do not yet understand, performance-critical code where the simpler version is measurably slower, and modules about to be rewritten entirely. Also skip code that is already clean — simplification for its own sake adds churn.

Should refactoring and feature changes be in the same pull request?

No, refactoring and feature work should be separate pull requests. Mixed changes are harder to review, revert, and understand in history, and a failing test becomes ambiguous about which change caused the regression.

What are the signs of over-simplification in code?

Over-simplification includes inlining named helpers that gave concepts meaning, merging unrelated functions into one complex unit, and removing abstractions that exist for testability or extensibility. Fewer lines is not the goal — faster comprehension is.