client-api-wire-shape-verification

Verify client API wrapper shapes against backend route handlers and Prisma returns.

2|Updated May 10, 2026
One-click install
npx skills add https://github.com/freedomw1987/tree_monstor --skill client-api-wire-shape-verification
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: client-api-wire-shape-verification
Source: https://github.com/freedomw1987/tree_monstor/tree/main/skills/general/client-api-wire-shape-verification
Command: npx skills add https://github.com/freedomw1987/tree_monstor --skill client-api-wire-shape-verification

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill fixes the common issue where TypeScript compiles cleanly for a typed API client wrapper, but the first real API call returns a 400 error or causes a silent runtime crash due to mismatched field names, types, or nullability between the client's assumed shape and the actual backend implementation. It eliminates bugs caused by relying on stale plan documents, incorrect schema guesses, or outdated Prisma model assumptions instead of the actual backend source code.

Core Features & Use Cases

  • Backend Source-of-Truth Verification: Guides you to validate client wrapper shapes against actual backend route handlers, body validators, and Prisma query returns rather than plan docs or schema guesses.
  • Step-by-Step Verification Recipe: Provides a mandatory pre-commit checklist for all new or modified typed request<T>() calls to catch field-name drift, type drift, and nullability drift.
  • 400 Error Diagnosis: Includes targeted steps to debug "tsc passes but endpoint 400s" issues by diffing actual backend response JSON against client TypeScript types.
  • Use Case: Use this Skill when writing or modifying typed API client wrappers, Prisma model to TypeScript type mappings, or Zod schema to backend DTO alignments in full-stack applications where frontend and backend are developed by separate agents or teams.

Quick Start

Use the client-api-wire-shape-verification skill to cross-check your typed API client wrapper's field names, types, and nullability against the actual backend route handler before committing the code.

Frequently Asked Questions about client-api-wire-shape-verification

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

FAQPage Schema
Why does my TypeScript API wrapper compile cleanly but return a 400 error at runtime?

API wire shape drift causes runtime 400 errors when field names, types, or nullability differ between your typed request<T>() wrapper and the backend route handler. Diffing the actual backend response JSON against client TypeScript types identifies the mismatch.

How do I verify my Prisma model to TypeScript type mappings against backend route handlers?

Verify Prisma to TypeScript mappings by checking your client wrapper shapes against actual backend source code, including route handlers, Prisma query returns, and body validators, rather than relying on stale plan documents or schema guesses to ensure exact field-name and nullability alignment.

What is the best way to prevent type drift between client API wrappers and backend DTOs?

The best way to prevent type drift is enforcing a pre-commit verification checklist that cross-checks typed request<T>() calls against actual backend route handlers and Zod schema body validators. This catches field-name, type, and nullability mismatches before shipping code.

Can I use this to align Zod schemas with backend DTOs in a full-stack TypeScript project?

Yes, you can use it to align Zod schemas with backend DTOs. It specifically guides full-stack TypeScript workflows to validate client wrapper shapes against actual backend body validators and route handlers when separate agents or teams implement frontend and backend endpoints.

Does this Skill support automated end-to-end wire-shape validation tests?

Yes, it supports optional automated wire-shape round-trip tests for end-to-end validation. These tests enforce verification of client wrapper shapes against actual backend source code to catch silent runtime crashes caused by type and nullability drift.

When should I not rely on plan documents for API client wrapper type definitions?

You should not rely on plan documents when the actual backend implementation has diverged, causing stale schema guesses. Relying on outdated Prisma model assumptions instead of actual route handlers and query returns leads to silent runtime crashes and API 400 errors.