code-simplification

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

5|Updated Mar 5, 2024
One-click install
npx skills add https://github.com/TRAPZZY/God-Eyes --skill code-simplification-trapzzy
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: code-simplification
Source: https://github.com/TRAPZZY/God-Eyes/tree/main/.skills/code-simplification
Command: npx skills add https://github.com/TRAPZZY/God-Eyes --skill code-simplification-trapzzy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working code often accumulates unnecessary complexity—deep nesting, long functions, unclear names, and duplicated logic—that makes 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 - Five Core Principles: Preserve behavior exactly, follow project conventions, prefer clarity over cleverness, avoid over-simplification, and scope changes to what changed. - Four-Step Process: Understand the code first (Chesterton's Fence), identify concrete simplification patterns, apply changes incrementally with test verification, and verify the final result. - Language-Specific Guidance: Concrete before/after examples for TypeScript, JavaScript, Python, and React/JSX covering common verbosity and complexity patterns. - Use Case: After shipping a feature with passing tests, run a simplification pass to flatten nested conditionals into guard clauses, rename generic variables like data and temp, and extract duplicated logic—keeping every test green. ## Quick Start Review the recently modified code in this project and simplify it for readability without changing any behavior, running 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, and error behavior remain identical, and revert any change that breaks a test.

How to simplify deeply nested conditionals in Python?▼

Replace nested if-blocks with guard clauses that handle error cases early and return immediately. This flattens the control flow so the main logic sits at the top level, making the function easier to follow.

When should I not simplify or refactor code?▼

Avoid simplifying code you do not fully understand, performance-critical paths where the simpler version is measurably slower, and code about to be rewritten entirely. Also skip code that is already clean and readable.

Should refactoring and feature changes be in the same commit?▼

No. Submit refactoring changes separately from feature or bug fix changes. Mixed changes are harder to review, revert, and understand in version history, and batching simplifications hides which change caused a failure.

What are common signs that code needs simplification?▼

Look for nesting three or more levels deep, functions over 50 lines, nested ternaries, boolean parameter flags, generic names like data or temp, duplicated logic blocks, dead code, and comments restating what the code already says.