code-simplification

Refactors code to reduce complexity while preserving exact behavior and project conventions.

Updated Sep 5, 2026
One-click install
npx skills add https://github.com/nntoan/ultra-omp --skill code-simplification-nntoan
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: code-simplification
Source: https://github.com/nntoan/ultra-omp/tree/main/packages/proflow/skills/code-simplification
Command: npx skills add https://github.com/nntoan/ultra-omp --skill code-simplification-nntoan

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working code often accumulates unnecessary complexity—deep nesting, long functions, unclear names, and duplication—that makes it hard to read, maintain, and extend. This Skill provides a disciplined, behavior-preserving process for simplifying code without introducing regressions. ## Core Features & Use Cases - Five Simplification Principles: Preserve behavior exactly, follow project conventions, prefer clarity over cleverness, avoid over-simplification, and scope changes to what changed. - Pattern Detection Tables: Concrete signals for structural complexity, naming issues, and redundancy, each paired with a specific simplification technique. - Incremental Process: Understand before touching (Chesterton's Fence), apply one change at a time, run tests after each step, and keep refactoring separate from feature work. - Language-Specific Guidance: Before/after examples for TypeScript/JavaScript, Python, and React/JSX. - Use Case: After shipping a feature with passing tests, run a simplification pass to flatten nested conditionals into guard clauses, rename generic variables, and extract duplicated logic—producing a clean, reviewable diff. ## Quick Start Ask the AI to simplify the recently modified code in this module for readability without changing any behavior, keeping each refactoring as a separate tested 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 for readability without changing behavior?▼

Follow an incremental process: understand the code's responsibility and callers first, apply one simplification at a time, and run the full test suite after each change. All inputs, outputs, side effects, and error behavior must remain identical.

How to simplify deeply nested conditionals in code?▼

Replace deep nesting with guard clauses that handle error and edge cases early, returning or raising immediately. This flattens the happy path to the top level, making control flow easier to follow than nested if/else blocks.

When should I not simplify or refactor code?▼

Avoid simplifying code you don't fully understand, performance-critical code where the simpler version is measurably slower, code about to be rewritten entirely, and code already clean and readable. Unscoped drive-by refactors also create noisy diffs and regression risk.

Does code simplification work for Python and TypeScript projects?▼

Yes, the process is language-agnostic and includes specific before/after examples for TypeScript, JavaScript, Python, and React/JSX. Simplifications must match each project's existing conventions for naming, imports, and error handling.

Why do refactoring changes break tests even when behavior seems unchanged?▼

Tests often encode subtle behaviors like error ordering, side effects, or edge cases that a simplification accidentally altered. Revert the failing change, re-examine what the code actually does, and never modify tests to make a refactoring pass.