routine-abstraction-improver

Flattens single-implementation abstractions by inlining the one thing behind them.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Monorepos accumulate layers of indirection that serve no purpose: interfaces with exactly one implementation, wrapper functions that only forward arguments, factories that produce a single product, and manager layers that purely delegate. This Skill finds one such layer, proves it has no stated reason to exist, inlines the single thing behind it, and ships the change safely. ## Core Features & Use Cases - Indirection Detection: Greps for suspect shapes including single-implementation interfaces, passthrough wrappers, one-product factories, never-varied generics, and delegate-only service layers. - Justification Checks: Verifies against AGENTS.md files, ADRs, and project boards that no stated convention or planned second implementation justifies the layer before removing it. - Safe Shipping: Inlines the concrete unit, rewrites tests that mocked the deleted layer, runs typecheck and package gates, and ships one flattening at a time via /ship. - Use Case: A package contains an IUserService interface with exactly one implementation and no ADR justifying it. The Skill inlines UserService directly at call sites, deletes the interface, updates the tests, and ships the change. ## Quick Start Invoke /routine-abstraction-improver with a package path to find and flatten one unjustified layer of indirection in that scope.

Frequently Asked Questions about routine-abstraction-improver

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

FAQPage Schema
How do I remove unnecessary abstraction layers from a codebase?

Identify layers with exactly one thing behind them, such as single-implementation interfaces or passthrough wrappers, then inline the concrete unit and delete the layer. This routine automates that discovery, proof, and shipping process one flattening at a time.

What kinds of indirection does this refactoring target?

It targets interfaces with one implementation, wrappers that only re-export or forward arguments, factories producing a single product, generics never instantiated with a second type, and manager or service layers that purely delegate.

When should I not flatten an interface with one implementation?

Do not flatten when an AGENTS.md, ADR, or project board states a convention requiring the interface, when tests genuinely use it as a mocking seam, or when a second implementation is planned. A stated convention always overrides this routine.

What happens to tests that mocked the deleted abstraction?

Tests that mocked the deleted layer are rewritten against the concrete unit with real assertions. The routine never leaves tests asserting a mock of something that no longer exists.

How is this different from simplifying convoluted logic or removing duplication?

This routine only removes indirection with exactly one thing behind it. Convoluted logic inside a single unit belongs to routine-logic-simplifier, and duplicated implementations belong to routine-dup-unifier.