routine-abstraction-police

Detects and fixes imports that violate stated architectural boundary rules.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Codebases accumulate layering violations over time: features importing each other's internals, transport adapters touching models, routes bypassing screens. This Skill finds imports that cross boundaries explicitly stated in AGENTS.md files or ADRs, fixes each one by moving code or inverting the dependency, and ships the fix. ## Core Features & Use Cases - Rule-grounded detection: A violation only counts if a written rule in a root or scoped AGENTS.md or ADR prohibits it, preventing enforcement of personal taste. - Targeted repair strategies: Fixes violations by moving code to a shared layer, inverting the dependency via parameters, or duplicating tiny helpers when sharing would worsen structure. - Scoped grep workflows: Ships predefined search patterns for cross-package imports, dashboard cross-feature imports, backend-v2 layer rules, and mobile route/screen separation. - Use Case: A dashboard feature imports a sibling feature's private component. The Skill quotes the dashboard AGENTS.md rule, moves the shared code into src/common/, re-greps to confirm the pattern is gone, and ships the single fix via /ship. ## Quick Start Invoke /routine-abstraction-police with an optional package or path to find and fix one layering violation against a stated boundary rule.

Frequently Asked Questions about routine-abstraction-police

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

FAQPage Schema
How do I fix imports that violate architectural boundaries?

Identify the stated rule the import breaks, then move the code to a layer both sides may depend on, invert the dependency by passing values as parameters, or duplicate a tiny helper. Verify with the owning package's test gate and re-grep to confirm the pattern is gone.

What counts as a layering violation in a monorepo?

A violation exists only against a rule written in a root or scoped AGENTS.md or an ADR, such as cross-package imports, dashboard features importing sibling features, or backend-v2 resolvers accessing models. Personal taste in layering does not qualify.

When should I duplicate code instead of sharing it across packages?

Duplicate a helper of ten lines or fewer, with a comment naming its twin, when sharing would force a worse structure. For cross-package violations, the fix stays entirely on the violating side rather than touching the other package.

What is the difference between abstraction-police and abstraction-improver routines?

The police routine fixes imports crossing stated boundaries the wrong way, while the improver removes too many layers and the dup-unifier merges duplicated logic. Each routine handles a distinct finding type and they should not overlap.

Can I fix a boundary violation by editing generated GraphQL code?

No. Codegen output such as src/generated-graphql/ must never be hand-edited to satisfy a boundary. Regenerate the output or restructure the source that feeds the generator instead.