smithery/jagreehal

validation-boundary

>- Validates untrusted input once at the boundary with Zod and branded types, then trusts domain args inward. Use this skill when parsing request bodies, env edges, or external payloads into domain types. Do not use when/for Result composition of already-validated domain errors (use result-types) or central app config loading (use config-management).

Installation

$ npx skills add smithery/jagreehal --skill validation-boundary

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/jagreehal · top by installs.

npx skills add smithery/jagreehal

Browse all from smithery/jagreehal

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.2.0

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,457 B
  • docs SUMMARY.md 129 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Validation at the Boundary

Critical rules

  • Validate untrusted input once at the edge (HTTP, CLI, queue, env, third-party). Everything inside trusts types by contract.
  • Parse into richer types (Zod + branded types) — don't just boolean-check.
  • Business functions contain no shape/format checks on args.
  • Schema failures → VALIDATION_FAILED / HTTP 400. Business-rule failures → Results (result-types).
  • Always parse third-party responses before use.
  • Before schemas or branding choices, read [references/examples.md](references/examples.md) and [references/patterns.md](references/patterns.md).

Workflow

  1. Identify every untrusted entry point for the feature.
  2. Define Zod schemas; brand IDs/tokens that could be swapped by mistake.
  3. Parse at the boundary (safeParse / middleware). Reject with a standard error envelope.
  4. Pass inferred types into fn(args, deps) with no re-validation.
  5. Keep domain rules (permissions, balances) inside business functions as Results.
  6. For coercion, PATCH, transforms, and middleware, read [references/patterns.md](references/patterns.md).

Resources

  • [references/examples.md](references/examples.md) — parse mindset, branded types, handlers, error format. Read when implementing boundaries.
  • [references/patterns.md](references/patterns.md) — two layers, coercion, PATCH, middleware, rationalizations. Read for common patterns.

Validation

  • Every external input parsed with Zod at the boundary
  • Business functions accept validated types; no shape checks inside
  • Confusable IDs/tokens use branded types
  • Third-party responses parsed before use
  • Invalid input → consistent VALIDATION_FAILED / 400
  • Business-rule failures returned as Results
  • No re-validation of internal or DB-sourced data

Constraints

  • Do not validate between internal functions that already share a type contract.
  • Related: fn-args-deps, result-types, api-design, strict-typescript, config-management.