agentleFS
lbdremylbdremy/phax/.claude/skills/effect-services/SKILL.md

effect-services

Skill2 starsChanged 5 months agoApache-2.0View on GitHub

Route all side-effecting operations (filesystem, shell, git, clock) through port interfaces in src/ports/ using Effect dependency injection.

  • Reads credentials

The file

Files
SKILL.md

Effect services

The rule

Direct access to the filesystem, shell, git, Claude, editor, clock, or process.env is only allowed inside src/infra/ adapters. All other layers must go through the port interfaces using Effect's dependency injection.

How ports are consumed in app/

import { FileSystem } from "../../ports/fs.js";
import { Effect } from "effect";

export const createRunFolder = (shortName: string) =>
  Effect.gen(function* () {
    const fs = yield* FileSystem; // injected — no concrete adapter here
    yield* fs.mkdirp(runPath);
    yield* fs.writeAtomic(statusPath, JSON.stringify(initialStatus));
  });

The concrete adapter (NodeFileSystem) is provided at the composition root in cli/main.ts or in test helpers.

Why

Infrastructure access outside infra/ means:

  • Tests cannot swap in fakes without patching globals.
  • The adapter cannot be replaced (e.g., swapping git for a different VCS backend) without touching every call-site.
  • Side-effecting code is hidden inside layers that should be pure.

Common violations and fixes

ViolationFix
fs.readFileSync(…) in app/Use FileSystem port via yield* FileSystem
execSync(…) in domain/Move to infra/shell.ts; expose via Shell port
process.env.X in app/Read in cli/ on startup; pass as a typed config value
new Date() in app/Use the Clock port (yield* Clock)

Audit rule

PHAX_EFFECT_001 — direct FS/shell/git/Claude/editor/clock/process.env access detected outside infra/.

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.