agentleFS
lbdremylbdremy/phax/.claude/skills/boundaries/SKILL.md

boundaries

Skill2 starsChanged 5 months agoApache-2.0View on GitHub

Respect the PHAX four-layer architecture (cli → app → domain ← ports ← infra) when adding or moving code.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    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:

    If the import skips layers (e.g., cli → infra), introduce or use the appropriate port and let Effect's dependency injection wire it.

    line 46
  2. Very specific:

    If app/ is importing a concrete adapter, replace with a port interface and inject the adapter at the composition root (cli/main.ts).

    line 48

≈ “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

Architectural boundaries

The four-layer rule

cli/  →  app/  →  domain/   ports/
                              ↑
                           infra/

Each layer may only import from layers to its right (or below):

LayerMay import from
cli/app/, domain/, ports/
app/domain/, ports/
domain/nothing inside src/ (only effect, std libs)
infra/ports/, domain/, platform adapters

cli/ must not import infra/ directly. CLI commands call use cases in app/ and receive results through the output port; they never construct or call infrastructure adapters themselves.

app/ must not import infra/ directly. App use cases receive ports as Effect Services (dependency injection). They never instantiate adapters.

domain/ must not import cli/, app/, or infra/. The domain is the only layer that is pure and safe to test without any adapter.

Why

Violating these boundaries couples layers that change for different reasons. A CLI flag change should never require touching domain logic. An infrastructure adapter swap (e.g., different git backend) should never require touching application logic.

How to fix a boundary violation

  1. Identify which layer the importing file belongs to.
  2. Identify which layer the imported file belongs to.
  3. If the import skips layers (e.g., cli → infra), introduce or use the appropriate port and let Effect's dependency injection wire it.
  4. If app/ is importing a concrete adapter, replace with a port interface and inject the adapter at the composition root (cli/main.ts).

Audit rule

PHAX_BOUNDARY_001 — cli → infra import detected. PHAX_BOUNDARY_002 — domain → cli/app/infra import detected. PHAX_BOUNDARY_003 — app → concrete infra import detected.

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.