code-simplification

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

2|Updated Jul 1, 2026
One-click install
npx skills add https://github.com/Lazare-Panam/mars-api --skill code-simplification-lazare-panam
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-simplification
Source: https://github.com/Lazare-Panam/mars-api/tree/main/Mars.API/.claude/skills/code-simplification
Command: npx skills add https://github.com/Lazare-Panam/mars-api --skill code-simplification-lazare-panam

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 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 Simplification Principles: Preserve behavior exactly, follow project conventions, prefer clarity over cleverness, avoid over-simplification, and scope changes to what changed. - Pattern Detection Checklists: Concrete tables of signals for structural complexity, naming issues, and redundancy, each paired with a specific simplification technique. - Incremental Process with Verification: A four-step workflow (understand, identify, apply incrementally, verify) with test-after-each-change discipline and a final review checklist. - Use Case: After shipping a feature with passing tests, a developer notices a 70-line function with nested ternaries and duplicated conditionals. The Skill guides them through extracting guard clauses, renaming generic variables, and splitting responsibilities—one tested change at a time. ## Quick Start Ask the assistant to review the recently modified function in your current file and suggest simplifications that preserve its exact behavior.

Frequently Asked Questions about code-simplification

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

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

Follow a behavior-preservation checklist before every change: confirm identical outputs for all inputs, same error behavior, same side effects, and passing tests without modification. Make one simplification at a time and run the test suite after each change, reverting immediately if anything fails.

What code patterns indicate a function needs simplification?

Key signals include nesting three or more levels deep, functions over 50 lines, nested ternaries, boolean parameter flags, generic names like data or temp, duplicated logic blocks, and dead code. Each pattern maps to a specific fix such as guard clauses, extraction, or lookup objects.

When should I not refactor or simplify code?

Avoid simplifying code you do not yet understand, performance-critical code where the simpler version is measurably slower, code about to be rewritten entirely, and code already clean and readable. Also avoid drive-by refactors of code outside the current task's scope.

Should refactoring and feature changes be in the same commit?

No. Refactoring changes should be submitted separately from feature or bug fix changes. Mixed changes are harder to review, revert, and understand in history, and batching multiple simplifications makes it impossible to identify which one caused a failure.

What are the risks of over-simplifying code?

Over-simplification includes inlining helpers that gave concepts a name, merging unrelated functions into one complex function, removing abstractions that exist for testability, and optimizing for line count instead of comprehension. The test is whether a new team member would understand the result faster.