code-simplifier

Simplify named code by removing redundancy while preserving exact behavior.

2|Updated Jul 6, 2026
One-click install
npx skills add https://github.com/nguyenpv1980-wq/Project-Aegis --skill code-simplifier-nguyenpv1980-wq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-simplifier
Source: https://github.com/nguyenpv1980-wq/Project-Aegis/tree/main/.claude/skills/code-simplifier
Command: npx skills add https://github.com/nguyenpv1980-wq/Project-Aegis --skill code-simplifier-nguyenpv1980-wq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill reduces unnecessary complexity in a specific piece of working code while proving that behavior stays the same, so you get clearer code without accidental regressions.

Core Features & Use Cases

  • Behavior-preserving cleanup: Removes dead code, needless indirection, redundant branches, and other clutter only when the change can be shown to be safe.
  • Test-gated simplification: Requires a green baseline before editing and reruns the relevant tests after each small move.
  • Scope discipline: Handles a named file, module, or function when you explicitly ask for simplification, but stops if coverage is thin or a change would alter behavior.
  • Use case: A teammate asks to flatten nested conditionals in a controller while keeping the exact same outputs and error behavior.

Quick Start

Ask the code simplifier to clean up the named file or function while keeping behavior identical and proving the change with tests.

Frequently Asked Questions about code-simplifier

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

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

Behavior-preserving cleanup removes dead code, needless indirection, and redundant branches only when tests prove the change is safe. You need a green test baseline before editing, and tests must rerun after each small move to verify identical outputs, errors, and side effects.

What's the best way to flatten nested conditionals while keeping the same outputs?

Flattening nested conditionals requires test-gated simplification: establish a green baseline first, then rerun relevant tests after each structural move to confirm outputs and error behavior remain identical. The process stops if coverage is thin or any change would alter behavior.

Do I need passing tests before refactoring code for readability?

Yes, a green test baseline is required before refactoring for readability. Tests must rerun after each small simplification step to verify that outputs, errors, and side effects stay exactly the same, preventing accidental regressions during cleanup.

Can I use code simplification on a specific function with thin test coverage?

No, simplification stops when test coverage is thin. The process requires sufficient tests to verify identical outputs, errors, and side effects before and after each move, refusing unsafely untested edits or changes that would alter behavior.

How does test-gated refactoring handle dead code and redundant branches?

Test-gated refactoring removes dead code, needless indirection, and redundant branches by requiring a green baseline before editing and rerunning tests after each move. If tests fail or coverage is thin, the simplification stops to preserve exact behavior.

When should I not use code cleanup for simplification?

You should not use code cleanup when tests are failing, coverage is thin, or when the goal involves changing contracts, hidden rewrites, or untested edits. The process refuses any change that cannot be proven safe through per-step test re-runs.