AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified MIT Self-run

Type Boundary Contract

skill-hsienw-ai-agent-engineering-playbook-type-boundary-contract · by HsienW

Design and review type contracts across package, service, frontend, backend, tool, event, and transport boundaries. Use when defining schemas, discriminated unions, runtime parsers, error envelopes, schemaVersion fields, or duplicated transport/domain types.

No reviews yet
0 installs
0 views
view→install

Install

$ agentstack add skill-hsienw-ai-agent-engineering-playbook-type-boundary-contract

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-hsienw-ai-agent-engineering-playbook-type-boundary-contract)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
16d ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Type Boundary Contract? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Type Boundary Contract

Skill Interface

  • Name: type-boundary-contract.
  • Description: Design and review type contracts across package, service, frontend, backend, tool, event, and transport boundaries, including schemas, discriminated unions, runtime parsers, error envelopes, schemaVersion fields, and duplicated transport or domain types.
  • Parameters: Boundary owner, producer and consumer types, domain and transport shapes, runtime parser, schema version, unknown-field behavior, error envelope, compatibility expectations, and contract test scenarios.
  • Instructions: Use this skill before defining or changing cross-boundary types. Treat boundary types as runtime contracts, separate domain and transport types, validate external data on receipt, preserve compatibility, and test valid, invalid, unknown, and future-version payloads.

Types at a boundary are contracts. Compile-time TypeScript types do not validate runtime data from clients, servers, tools, providers, files, queues, or models.

Boundary Process

  1. Identify the boundary owner.
  2. Separate domain type from transport type.
  3. Define runtime validation at the receiving boundary.
  4. Define versioning and unknown-field behavior.
  5. Define error envelope shape.
  6. Add contract tests for both valid and invalid data.
  7. Document compatibility expectations before changing existing fields.

Type Rules

  • Use discriminated unions for state, event, and result variants.
  • Use unknown for external data until parsed.
  • Avoid any at boundaries.
  • Do not use type assertions to hide unvalidated data.
  • Avoid optional fields when a union variant would model required state better.
  • Keep stable machine identifiers separate from localized messages.
  • Use explicit schema versions for structured cross-boundary payloads.

Generic Result Pattern

type BoundaryResult = {
  schemaVersion: string;
  kind: TKind;
  status: TStatus;
  data?: TData;
  summary?: string;
};

The producer may use narrow literal types. The consumer may accept wider compatible types when it must tolerate future versions.

Error Envelope

Use stable machine-readable fields:

type ErrorEnvelope = {
  error: {
    source: string;
    stage: string;
    code: string;
    message: string;
    retryable?: boolean;
    details?: Record;
  };
};

Do not expose stack traces, private paths, tokens, secrets, or raw provider responses.

Compatibility Checklist

  • Request schema.
  • Response schema.
  • Event schema.
  • Tool input schema.
  • Tool output schema.
  • Error code and retryability.
  • Terminal state.
  • Correlation identifiers.
  • Unknown fields and unknown variants.
  • Migration or deprecation plan.

Verification

Test valid data, missing fields, unknown fields, unknown variants, invalid schema versions, error envelopes, and future-compatible payloads.

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.