agentleFS
bex-cobex-co/bex/.claude/skills/rt-flatten-abstractions/SKILL.md

rt-flatten-abstractions

Skill578 starsChanged 6 days agoApache-2.0View on GitHub

Finds over-engineered abstractions — single-implementation interfaces, pass-through layers, generics instantiated at one type, wrapper hooks that add nothing — and flattens them to direct code; module-boundary seams are left to rt-normalize-abstractions. Use when the user asks to run the rt-flatten-abstractions routine, remove over-engineering, or flatten needless indirection.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After the verification phase, follow the shipping phase below without asking the user to invoke ship separately.

    line 15
  2. Distinctive:

    Verify every change with targeted checks before reporting it done, and leave the full suites to CI.

    line 19
  3. Very specific:

    Run npx prettier@3.4.2 --write on any markdown touched.

    line 23
  4. Distinctive:

    Before shipping, summarize results in commentary using: Fixed (file:line + one-line rationale) / Deferred (item + why) / Skipped (finding + …

    line 24

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Routine: Abstraction Flattener

Indirection has to earn its keep. Flatten what doesn't.

Routine ground rules

  • A user request to run this routine authorizes the full cycle: plan, fix, verify, then invoke $ship (Codex) or /ship (Claude) directly in the same run. Honor explicit user limits such as audit-only or no-ship.
  • Keep a concise execution plan in the conversation and update it as findings are confirmed. Continue into implementation without a planning approval pause. Do not create or file a .pm milestone/task as a prerequisite or substitute for fixing; use the board only if the user requests it.
  • After the verification phase, follow the shipping phase below without asking the user to invoke ship separately. Preserve the ship skill's branch, conflict-resolution, and safety rules.
  • Fix everything you find directly in the working tree. If a fix can't be finished safely in this run, revert only your partial work for that fix and list it under Deferred in the report — never leave the tree half-refactored.
  • Scope: parse $ARGUMENTS per Phase 1 — an optional path/module scope or skill-specific target. No argument = the skill's stated default (usually the whole repo via parallel agents per module: lego/types, lego/operator, lego/backend, lego/cli, dashboard).
  • False-positive discipline: if a finding is intentional, load-bearing, or ambiguous, skip it with a one-line reason — don't argue it into a change.
  • Verify every change with targeted checks before reporting it done, and leave the full suites to CI. Run only what the change can break, one heavy command at a time: never two in parallel, never the same suite twice.
    • Go: gofmt -l on the touched files; go build and go vet of the touched packages; go test of those packages and of the packages that import them (find importers with grep -rl '"<import path>"' --include='*.go' lego/).
    • Dashboard: yarn vitest related --run <changed files>, yarn eslint <changed files>, and yarn typecheck when TypeScript changed.
    • Never the module-wide suites: make lint, make test, go test ./..., the whole yarn test or yarn lint. CI runs them on the pull request, against the real Postgres, OpenFGA and OpenBao a sandbox lacks. A failed check comes back to the session as its next turn (ADR047 D11). A run that ships straight to main gets them from the ship skill's gates and main's CI.
  • Run npx prettier@3.4.2 --write on any markdown touched.
  • Before shipping, summarize results in commentary using: Fixed (file:line + one-line rationale) / Deferred (item + why) / Skipped (finding + reason) / Gates (commands run + outcomes).

Phase 1 — Scope

Parse $ARGUMENTS as an optional path/module scope. Empty = whole repo via parallel per-module agents.

Phase 2 — Find candidates

  • Go interfaces with exactly one non-test implementation (grep -rn "^type .* interface" lego/, then find implementers). A test fake doesn't count as a second implementation — but interfaces that exist specifically to enable envtest/controller-runtime fakes in lego/operator are often legitimate; skip those.
  • Functions that only forward to one other function with the same arguments.
  • Generic type parameters instantiated at exactly one type.
  • Dashboard wrapper hooks/components adding no behavior over what they wrap.

Phase 3 — Check recorded intent

git log the abstraction: added recently for a planned second implementation is different from untouched for a year. Check docs/ ADRs and .pm/DO_NOT_DO.md for recorded intent. Module-boundary seams (types↔operator↔backend contracts) are /rt-normalize-abstractions territory — keep them even when single-impl.

Phase 4 — Flatten

Inline the single implementation, replace interface parameters with the concrete type, delete pass-through layers, collapse single-use generics. Run the package's tests after each flatten. If a flatten forces test rewrites beyond mechanical type substitution, the abstraction was load-bearing — revert and skip with a note.

Phase 5 — Verify and report

Targeted checks (ground rules): a flattened interface's callers are its importers, so test those packages too. Report per the standard format.

Final phase — Ship

After all required gates pass, read and execute the ship skill for the routine's completed changes. Stage only intended changes from this run; preserve unrelated work. Do not end at a plan, findings report, milestone, or request for shipping approval. If there are no changes, report that outcome without creating an empty commit. If a required gate remains blocked or fails after reasonable repairs, report the exact blocker and do not ship unverified changes.

Once the push succeeds, report the shipped HEAD SHA and subject per the ship skill and stop; do not monitor CI or deployment.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.