bex-co

routine-abstraction-improver

Autonomous maintenance routine that flattens over-engineered

bex-co 312 39 Updated 5d ago
GitHub

Install

npx skillscat add bex-co/beancount-io/routine-abstraction-improver

Install via the SkillsCat registry.

SKILL.md

Task: Flatten over-engineered abstractions

Usage: /routine-abstraction-improver [package-or-path]

Find a layer of indirection with exactly one thing behind it and no stated
reason to exist, inline it, delete the layer, and ship via /ship.

Contract

Read .agents/skills/routine-shared/contract.md first — preconditions,
scope resolution, verify gates, ship protocol, budget, universal STOPs. Floor
even without it: never ship red; one finding per ship; anything in a
DO_NOT_DO.md is a hard STOP.

Workflow

1. Scope

Resolve scope per the contract.

2. Discover

The shapes worth suspecting:

  • Interfaces/abstract classes with exactly one implementation
  • Wrapper functions/modules that only re-export or forward arguments
  • Factories that can only ever produce one product
  • Generics never instantiated with a second type
  • "Manager"/"provider"/"service" layers that purely delegate

3. Prove it

A layer is a finding only when all hold:

  1. Grep confirms exactly one implementation and one usage pattern.
  2. No stated reason for it exists. Check the scoped AGENTS.md,
    docs/adrs/, and .pm boards. In particular: backend-v2 mandates an
    I<Name> interface beside every service/workflow class

    (backend-cluster/backend-v2/AGENTS.md, Dependency and layer rules) — those
    interfaces are a stated convention, never a finding. Same for seams that
    exist so tests can double them, when the tests actually do.
  3. No evidence of a planned second implementation.

4. Fix

Inline the single thing, delete the layer, call directly. If tests mocked the
deleted layer, rewrite them against the concrete unit with real assertions —
never leave them asserting a mock of something that no longer exists. Behavior
identical.

5. Verify

Typecheck + full owning-package gate, and a grep confirming no dangling
references to the deleted layer.

6. Ship

Compose /ship for this one flattening. Loop within budget.

What NOT to do

  • Never flatten an abstraction a AGENTS.md, ADR, or working test double
    justifies — a stated convention beats this routine's taste, every time.
  • Don't rewrite convoluted logic inside a unit (routine-logic-simplifier) or
    move code across layers (routine-abstraction-police).
  • Don't flatten two layers in one ship; each deletion stands alone.
  • Don't replace the deleted abstraction with a cleverer one — the fix is
    less structure, not different structure.

Arguments

$ARGUMENTS