refactor-simplify-branching

Refactor: Simplify Branching

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "refactor-simplify-branching" with this command: npx skills add cantagestudio/cosmicatlaspacker/cantagestudio-cosmicatlaspacker-refactor-simplify-branching

Refactor: Simplify Branching

Reduce conditional complexity for better readability.

Techniques

  1. Guard Clauses (Early Return)

Replace deep nesting with flat guards.

  1. Replace Conditionals with Polymorphism

Use protocol dispatch instead of type checking.

  1. Replace Nested Conditionals with Table

Use lookup tables for multi-dimensional conditions.

  1. Decompose Compound Conditionals

Extract complex conditions to named variables or methods.

  1. Replace Flag Arguments

Create separate methods instead of boolean flags.

Warning Signs

  • Nesting > 3 levels deep

  • More than 3 else-if branches

  • Switch with > 5 cases

  • Condition spans multiple lines

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

refactor-dedupe-and-cleanup

No summary provided by upstream source.

Repository SourceNeeds Review
General

aesthetic-pattern-miner

No summary provided by upstream source.

Repository SourceNeeds Review
General

brand-guidelines-enforcer

No summary provided by upstream source.

Repository SourceNeeds Review