validation-boundaries
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
Decode every external input (files, env vars, CLI args, API responses) through an Effect Schema before it crosses into the domain.
- Reads credentials
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- boundariesSkill
- cli-view-layerSkill
- effect-servicesSkill
- find-docsSkill
- infrastructure-adaptersSkill
- model-routingSkill
- observabilitySkill
- phax-cliSkill
- phax-decide-planSkill
- phax-decide-reviewSkill
- phax-decide-specSkill
- phax-planningSkill
- phax-reviewSkill
- phax-specSkill
- state-machinesSkill
The file
Files
Validation boundaries
The rule
Every external input must be decoded through an Effect Schema before crossing into the domain.
External inputs include:
- Files read from disk (
phax.json,phax-plan.json,run-status.json,registry.json,phase/status.json, Claude JSONL output, git command output) - Environment variables (
process.env.*) - CLI arguments (after commander parses them, decode into typed command objects)
- Any response from an external process
Where decoding happens
Decoding belongs in infra/ adapters or at the very start of cli/ command
handlers, before any app/ use case is called. The app/ and domain/ layers
receive already-decoded, already-validated values only.
JSON.parse inside app/ or domain/ is a violation. Read the file in
infra/, decode immediately, and return a typed value.
Why
Unvalidated data reaching the domain means the domain type system can no longer
be trusted. A RunState that was not decoded through its schema might hold an
invalid string; a PhaseId built from unvalidated input might be out of range.
Effect Schema decoding at the boundary means every value inside the domain is
guaranteed valid by construction.
How to fix a violation
- Find the
JSON.parse(orreadFilewith an immediate cast) inapp/ordomain/. - Move it to the appropriate
infra/adapter. - Decode the raw value through the matching schema in
src/schemas/. - Return the typed, decoded value across the boundary.
Audit rule
PHAX_VALIDATION_001 — JSON.parse or unguarded readFile caller detected
outside infra/.
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
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.

