PluginBench
Skill
Pass
Audit score 90

principle-boundary-discipline

cursor/plugins

Concentrate validation at system boundaries; trust internal types and keep business logic pure.

What is principle-boundary-discipline?

A design principle for organizing validation, error handling, and framework adapters. Place all defensive checks at system edges (CLI, config, network, APIs) and trust internal types, keeping business logic in pure functions decoupled from framework wiring.

  • Validate and parse raw data into typed domain objects at system boundaries only
  • Eliminate redundant validation and nil checks in internal call chains
  • Organize business logic as pure functions independent of framework dependencies
  • Structure code organization: parse functions, prompt construction, and scoring as pure transforms
  • Reduce noise and false safety from scattered validation across the codebase
  • Keep framework wiring thin and mechanical, separating policy from mechanism

How to install principle-boundary-discipline

npx skills add https://github.com/cursor/plugins --skill principle-boundary-discipline
Claude Code
Cursor
Windsurf
Cline

How to use principle-boundary-discipline

  1. 1.Identify all system boundaries in your codebase (CLI, config, network, external APIs)
  2. 2.Move validation and type narrowing to occur only at these boundaries
  3. 3.Convert raw input data into strongly-typed domain objects at the boundary
  4. 4.Extract business logic into pure functions with no framework dependencies
  5. 5.Remove redundant validation checks from internal call chains
  6. 6.Test business logic independently without framework setup

Use cases

Good for
  • Designing CLI argument parsing and validation before passing to business logic
  • Structuring config file parsing to convert raw data into typed internal state
  • Building API adapters that validate external input once at the boundary
  • Organizing prompt construction pipelines with structured state in and strings out
  • Implementing scoring and assessment functions as pure transforms without framework dependencies
Who it's for
  • Backend engineers designing layered architectures
  • API developers building robust input validation strategies
  • Framework adapter authors separating concerns between wiring and logic
  • Teams seeking to improve testability by decoupling business logic from frameworks
  • Developers reducing validation redundancy and improving code clarity

principle-boundary-discipline FAQ

When should I validate data?

Validate once at system boundaries (CLI args, config files, network input, external APIs). Once data crosses into your system as a typed domain object, trust it and skip re-validation.

What counts as a system boundary?

CLI arguments, configuration files, network protocols, external API responses, and any point where raw untrusted data enters your system.

Can business logic depend on frameworks?

No. Business logic should be pure functions with no framework dependencies, so it can be tested and reasoned about independently. Framework wiring should be thin and mechanical.

Should I export framework types through my public API?

No. Expose domain concepts and typed data structures, not transport, storage, or framework-specific types. Keep implementation details at the boundary.

How do I know if validation is redundant?

Ask: 'Is this data crossing a system boundary right now?' If not, the validation is redundant. Also ask: 'Can this be a pure function?' If yes, extract it from the framework layer.

Full instructions (SKILL.md)

Source of truth, from cursor/plugins.


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.