agentleFS
swift-instituteswift-institute/Skills/decomposition/SKILL.md

decomposition

Skill0 starsChanged 4 months agoApache-2.0View on GitHub

Design discipline for splitting a system into units that each own exactly one thing — finding the seam, choosing package, product, target, and file boundaries independently, and judging split, extraction, and removal. Apply whenever adding, growing, splitting, reshaping, or deleting a unit of structure, or when a boundary feels wrong.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Place each unit at the narrowest owner that can host it without reversing the dependency graph.

    line 40
  2. Distinctive:

    Prefer an owner extension or a trait-gated conformance for integration.

    line 41
  3. Distinctive:

    Do not resolve a protocol-level relaxation goal by adding a non-conforming sibling type alongside the original.

    line 64
  4. Distinctive:

    Before deleting a package, module, or unit, prove both:

    line 72
  5. Distinctive:

    Never delete another session's work in flight.

    line 79

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 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

Decomposition

Decompose by semantic ownership. A unit's owner is whatever defines its vocabulary, invariants, and lawful operations — not what shares its file, its size, or its callers.

The default failure is under-decomposition. Every unit should own exactly one thing, and a reader should be able to name that thing in one sentence without conjunctions. If the sentence needs an "and", the unit is two units.

Boundaries are independent

Choose each boundary on its own evidence; never use one as a proxy for another:

  • a package for release, repository, dependency, or ecosystem ownership;
  • a product for a supported consumer choice;
  • a target for a compile-time dependency and import boundary;
  • a file for a focused declaration or conformance unit.

Two things belonging in one package says nothing about whether they belong in one target, and one target says nothing about one file. Decide each independently, then check the set is coherent.

Finding the seam

Cut where meaning already separates:

  • what varies independently — two parts that change on different schedules are two units;
  • what has its own reason to change — one unit, one source of change;
  • what a different consumer would want alone — if any plausible consumer wants half, that half is a unit;
  • what carries its own invariants — an invariant that only some of the code must uphold marks its own boundary;
  • what could be understood, named, and tested without the rest.

Place each unit at the narrowest owner that can host it without reversing the dependency graph. Prefer an owner extension or a trait-gated conformance for integration; add a new target or package only for a real import, dependency, or release boundary.

Signals a unit is doing too much

  • Its name is a category, a mechanism, or ends in a grab-bag noun.
  • Its description needs "and", or a list of unrelated responsibilities.
  • Consumers import it for one part and carry the rest.
  • Parts of it are tested with disjoint fixtures, or one part is untestable without the other.
  • Changing one concern in it forces recompilation or re-review of unrelated concerns.
  • It exposes an escape hatch so callers can reach past its own abstraction.

Judging a change

Correctness alone drives split, reshape, extraction, and removal decisions.

  • Consumer count and adoption are evidence to inspect, never owners or drivers. "Only one consumer" and "zero consumers" are not reasons to defer, proceed, remove, or doubt, at any phase — and a count derived from manifests is a lower bound anyway, since @_exported re-exports let a consumer bind a package's types without naming it in any manifest.
  • "Cleaner", "smaller", "more modular", and module count are not sufficient reasons on their own. Name the ownership, consumer, compilation, release, or dependency property that improves. If you cannot name one, the change is a preference.
  • Do not resolve a protocol-level relaxation goal by adding a non-conforming sibling type alongside the original; that preserves the blocker as latent debt while looking like progress.
  • Exhaust public API, co-location, owned integration, and package-level access before reaching for SPI; unavoidable SPI stays local, explicit, and tracked.

Deletion gate

Before deleting a package, module, or unit, prove both:

  • The code is already committed, and so git-recoverable. Never destroy uncommitted exploratory work — it is the one state no later command recovers.
  • It is dead at build level. A clean build after removal is the proof; a grep is not, for the same re-export reason above.

Never delete another session's work in flight.

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.