principle-boundary-discipline

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

6.6k|542|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/cursor/plugins --skill principle-boundary-discipline
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: principle-boundary-discipline
Source: https://github.com/cursor/plugins/tree/main/pstack/skills/principle-boundary-discipline
Command: npx skills add https://github.com/cursor/plugins --skill principle-boundary-discipline

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Scattered validation and redundant error handling make codebases noisy, hard to test, and falsely reassuring. This Skill guides you to validate data once at system boundaries and keep internal code clean, typed, and free of defensive clutter.

Core Features & Use Cases

  • Boundary Validation: Enforce 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 CLI command or framework adapter, apply this Skill to parse raw input into domain types at the edge, then call pure functions for scoring, prompt construction, or state transforms.

Quick Start

Ask the agent to review your validation and error handling so that all guards live at system boundaries and 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 external data enters: CLI arguments, config files, network responses, and external APIs. 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, making them testable in isolation.

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

No. Redundant nil checks and repeated validation deep in call chains add noise and a false sense of safety. If the boundary already parsed and validated the data, internal code should trust the types and propagate errors instead.

When should I not apply boundary discipline?

Boundary discipline fits systems with clear edges like CLIs, services, and adapters. It is less relevant for throwaway scripts or prototypes where strict layering adds overhead without payoff, and it does not replace domain-level invariant checks.

Why should transport types not leak through the public API?

Re-exporting transport, storage, or wire types couples consumers to the boundary's private representation. Expose domain concepts across the boundary instead, keeping general-purpose mechanism inside and special-purpose policy at the edge.