principle-boundary-discipline

Concentrates validation and error handling at system boundaries while keeping business logic in pure functions.

Updated Sep 2, 2026
One-click install
npx skills add https://github.com/jnyross/pstack-muse --skill principle-boundary-discipline-jnyross
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: principle-boundary-discipline
Source: https://github.com/jnyross/pstack-muse/tree/main/skills/principle-boundary-discipline
Command: npx skills add https://github.com/jnyross/pstack-muse --skill principle-boundary-discipline-jnyross

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Scattered validation and redundant nil checks make code noisy, hard to test, and give a false sense of safety. This Skill guides you to validate data once at system boundaries and keep internal code clean and trustworthy. ## Core Features & Use Cases - Boundary Validation: Place validation, type narrowing, and error handling at CLI args, config files, network protocols, and external APIs. - Pure Business Logic: Keep domain logic in pure functions with no framework dependencies so it can be tested without the framework. - Clean Public Surfaces: Avoid re-exporting transport, storage, or wire types through your public API. - Use Case: When wiring a new config loader or API adapter, apply this Skill to parse raw input into domain types at the edge and let internal code trust the types unconditionally. ## Quick Start Ask the AI to review your validation and error handling code and refactor it so guards live at system boundaries while business logic stays in pure functions.

Frequently Asked Questions about principle-boundary-discipline

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide where to put validation in my code?

Place validation at system boundaries where data enters: CLI arguments, config files, external APIs, and network protocols. Once data crosses the boundary as typed domain objects, internal code should trust the types and skip re-validation.

How to keep business logic testable without a framework?

Write business logic as pure functions with no framework dependencies, such as parse functions transforming raw bytes to typed state or scoring functions mapping state to results. The framework shell then just calls these functions mechanically.

Should internal functions re-validate data already checked at the boundary?

No. If the boundary already validated the data, redundant nil checks deep in call chains add noise and a false sense of safety. Ask whether the data is crossing a system boundary right now; if not, validation is redundant.

What types should a public API expose across a boundary?

Expose domain concepts, not the boundary's private representation. Do not re-export transport, storage, framework, or wire types through the public surface; keep general-purpose mechanism inside and special-purpose policy at the edge.

When is boundary discipline the wrong approach?

It fits less when a component genuinely receives untrusted input from multiple independent sources, since each entry point is its own boundary needing guards. The principle still applies, but you must correctly identify every boundary first.