type-boundary-patterns

Parse untrusted vendor data with Schema.decodeUnknown at integration boundaries.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/aitchwhy/dotfiles --skill type-boundary-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: type-boundary-patterns
Source: https://github.com/aitchwhy/dotfiles/tree/main/config/quality/generated/skills/type-boundary-patterns
Command: npx skills add https://github.com/aitchwhy/dotfiles --skill type-boundary-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Handling vendor type boundaries and parsing at boundary.

Core Features & Use Cases

  • Define schemas for vendor data
  • Parse external data at boundary
  • Avoid runtime type assertions

Quick Start

Parse vendor data with Schema.decodeUnknown at boundary.

Frequently Asked Questions about type-boundary-patterns

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

FAQPage Schema
How do I safely parse untrusted vendor data in TypeScript without runtime type errors?

Parse vendor data at the boundary using Schema.decodeUnknown to enforce runtime validation before deriving internal types. This prevents unsafe type assertions from leaking unvalidated values into your application.

What's the best way to handle external API responses to avoid type mismatches?

Define explicit schemas for external data and decode at integration points using boundary parsing. This catches mismatches early and maps errors consistently, ensuring only validated data enters your type system.

How do I validate Date values from external APIs safely?

Use Schema.DateFromSelf to handle Date parsing at the boundary. This validates incoming date data before it reaches your internal logic, preventing runtime assertion failures.

When should I parse data at the boundary instead of after importing it?

Parse at vendor boundaries whenever integrating external APIs or $Infer-bound data sources. Boundary parsing catches invalid data immediately, prevents type pollution, and centralizes validation logic.

Can I use schema-based decoding with multiple external vendors?

Yes. Define separate schemas for each vendor's data format, then apply Schema.decodeUnknown at each integration point. This isolates vendor-specific validation and prevents cross-vendor type contamination.

What happens if schema validation fails during boundary parsing?

Schema.decodeUnknown returns typed error output with consistent, mapped error messages. This gives you predictable, actionable feedback without crashing, letting you handle invalid data gracefully.