# API Contract Design

> API Contract Design

- Skill: `onfire7777/api-contract-design-2` (Agent Skill)
- Install (CLI): `npx skillmds@latest add onfire7777/api-contract-design-2`
- Raw SKILL.md: https://api.skillmd.com/api/skills/onfire7777/api-contract-design-2/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: onfire7777 (https://skillmd.com/u/onfire7777)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/onfire7777/api-contract-design-2

---


# API Contract Design

Purpose: Keep controller APIs stable, scoped, and schema-validated.

1. Parse request bodies and query parameters with zod.
2. Require project scope for project data.
3. Return precise error messages and HTTP codes.
4. Keep response shapes predictable for the dashboard.

Checklist:

- Input schemas exist.
- Scope is enforced before reads/writes.
- Errors fail closed.
- Tests cover invalid input.

Positive example: reject negative event limit with HTTP 400.
Negative example: list all memories without project scope.

Failure modes: unscoped reads, silent coercion, inconsistent response envelopes.

