principle-boundary-discipline — Claude Code skill: what it does
A rule-set skill for coding agents: validation and error handling stay at system boundaries, while the inside trusts its types and plain functions.
npx skills add backnotprop/pstack --skill principle-boundary-discipline -a claude-codeWhat principle-boundary-discipline does
The skill carries a single rule. Validation, type narrowing and error handling belong at the edges: CLI args, config files, network, external APIs. Inside the system, code trusts its types and skips checks that already ran at the door. Business logic moves into pure functions, and the shell around the framework stays thin.
What you install is one SKILL.md. It lists the applications and gives two test questions. Is this data crossing a boundary right now? If not, the validation is redundant. Can this become a pure function the shell just calls? It also names the usual leaks: re-exporting transport or wire types through the public surface, nil checks buried deep in a call chain, config validated after startup instead of at parse time.
disable-model-invocation: true sits in the frontmatter, so the agent will not load the skill on its own. You call it while wiring a validator or a framework adapter. On a codebase where checks are scattered through handlers, expect the advice to push a refactor rather than a small patch.
What it helps with
- collect config checks into one parse step
- pull business logic out of framework handlers
- drop repeated nil checks from deep call chains
- keep transport and wire types off the public surface
- decide where a guard earns its place and where types are enough
Example prompts for the agent
- Apply principle-boundary-discipline: find where validation in
src/config.tsdrifted into business logic. - Use principle-boundary-discipline to move the API response parsing into a pure function.
- Check this new adapter against principle-boundary-discipline: what is the boundary here and what is a redundant inner check?
How to install principle-boundary-discipline
1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill principle-boundary-discipline -a claude-code2Manually: put the files in place
~/.claude/skills/principle-boundary-discipline/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/principle-boundary-discipline/
1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill principle-boundary-discipline -a codex2Manually: put the files in place
.agents/skills/principle-boundary-discipline/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill principle-boundary-discipline -a cursor2Manually: put the files in place
.cursor/skills/principle-boundary-discipline/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install backnotprop/pstack principle-boundary-discipline2Manually: put the files in place
.github/skills/principle-boundary-discipline/SKILL.md1Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill principle-boundary-discipline -a gemini-cli2Platform CLI
gemini skills install https://github.com/backnotprop/pstack --path skills/principle-boundary-disciplineManually: put the files in place
.devin/skills/principle-boundary-discipline/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add backnotprop/pstack --skill principle-boundary-discipline -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about principle-boundary-discipline
How do I install principle-boundary-discipline in Claude Code?
Run npx skills add backnotprop/pstack --skill principle-boundary-discipline -a claude-code. The file lands at ~/.claude/skills/principle-boundary-discipline/SKILL.md.
What does principle-boundary-discipline do?
It gives the agent one rule: validation, type narrowing and error handling live at system boundaries, and inner code trusts its types. Business logic goes into pure functions that can be tested without the framework.
Which platforms support this skill?
Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode. Copilot uses a different command: gh skill install backnotprop/pstack principle-boundary-discipline.
Source text
SKILL.md · MIT
--- name: principle-boundary-discipline description: "Apply when wiring validation, error handling, or framework adapters. Concentrate guards at system boundaries (CLI, config, network, external APIs); trust internal types and keep business logic in pure functions." disable-model-invocation: true --- # Boundary Discipline Place validation, type narrowing, and error handling at system boundaries. Trust internal code unconditionally. Business logic lives in pure functions. The shell is thin and mechanical. **Why:** Scattered validation is noisy, redundant, and gives a false sense of safety. Keep logic out of framework wiring so it can be tested without the framework. **The pattern:** - **At boundaries** (CLI args, config files, external APIs, network protocols): validate, return errors, handle defensively. - **Inside the system:** typed data, error propagation, no re-validation. Trust the types. - **Across the boundary.** Expose domain concepts, not the boundary's private representation. Keep general-purpose mechanism inside and special-purpose policy at the edge. **Applications:** Validation and error handling: - Validate config at parse time (the boundary), not inside business logic - Parse raw data into domain types at the boundary - Do not re-export transport, storage, framework, or wire types through the public surface - No redundant nil checks deep in call chains if the boundary already validated Code organization: - Business logic in pure functions with no framework dependencies - Parse functions: pure transforms from raw bytes to typed state - Prompt construction: structured state in, string out - Scoring and assessment: pure transforms from state to results **The tests:** - "Is this data crossing a system boundary right now?" If not, validation is redundant. - "Can this be a pure function that the shell just calls?" If yes, extract it.
© backnotprop · MIT · backnotprop/pstack