routine-logic-simplifier

Simplifies convoluted business logic in place while preserving behavior with pinning tests.

275|32|Updated Oct 2, 2020
One-click install
npx skills add https://github.com/bex-co/beancount-io --skill routine-logic-simplifier-bex-co
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: routine-logic-simplifier
Source: https://github.com/bex-co/beancount-io/tree/main/.agents/skills/routine-logic-simplifier
Command: npx skills add https://github.com/bex-co/beancount-io --skill routine-logic-simplifier-bex-co

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Convoluted code with deep nesting, boolean spaghetti, and interleaved concerns slows down every future change, but rewriting it by hand risks silently altering behavior. This Skill finds one convoluted unit of business logic, pins its current behavior with tests, and simplifies it in place with zero behavior change. ## Core Features & Use Cases - Hotspot Discovery: Uses git churn history and code smells (deep nesting, long boolean chains, mixed concerns) to pick one high-value convoluted unit. - Behavior Pinning: Writes pinning tests capturing current inputs and outputs, including edge cases, before touching any code. - Behavior-Preserving Refactor: Flattens nesting with early returns, names intermediate values, and splits interleaved concerns without introducing new abstractions. - Use Case: A function in your monorepo keeps appearing in fix commits and has four levels of nested conditionals. Invoke the routine to pin its behavior with tests, rewrite it readably, verify the full package gate is green, and ship via /ship. ## Quick Start Run /routine-logic-simplifier on the package containing the convoluted logic you want simplified without changing its behavior.

Frequently Asked Questions about routine-logic-simplifier

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

FAQPage Schema
How do I refactor convoluted code without changing its behavior?

Pin the current behavior with tests that capture inputs and outputs including edge cases, then simplify in place using early returns and named intermediate values. Run the pinning tests plus the package's full verification gate to prove nothing changed before shipping.

How to find which code is worth simplifying in a monorepo?

Use git log to find files that repeatedly appear in fix commits, since churn marks where convolution costs the most. Then read for smells like nesting past three levels, long boolean chains, and functions mixing parsing, decisions, and formatting.

When should I skip simplifying a piece of convoluted logic?

Skip when the behavior cannot be safely pinned with tests, such as nondeterministic logic or code with a giant I/O surface. An unpinned simplification is a gamble rather than maintenance, so the routine explicitly skips such findings.

What is the difference between simplifying logic and removing abstraction layers?

Simplifying logic flattens nesting and clarifies a convoluted function in place without new abstractions. Removing indirection like single-implementation interfaces or passthrough wrappers is a separate concern handled by the routine-abstraction-improver skill.

What should I do if I find a bug while simplifying code?

Never fold a behavior change into the refactor. Note the bug, finish the behavior-preserving simplification, and report the bug in the summary as a separate routine-logic-bugfixer finding.