一键导入
api-contracts
API contract validation and Zod-first design patterns. Use when designing, implementing, or validating API routes and schemas.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
API contract validation and Zod-first design patterns. Use when designing, implementing, or validating API routes and schemas.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
API contract validator that ensures API responses match documented contracts and catches breaking changes. Activate when validating API contracts, checking schema validation, detecting contract drift, comparing OpenAPI specs with implementation, finding undocumented endpoints, or auditing response shapes.
API design, style selection, and contract validation. REST vs GraphQL vs tRPC decision-making, Zod-first validation, response formats, versioning, pagination, API contracts. Use when designing APIs, choosing REST vs GraphQL, implementing API validation, creating Zod schemas, or defining API contracts.
API design principles and decision-making. REST vs GraphQL vs tRPC selection, response formats, versioning, pagination.
Main application building orchestrator. Creates full-stack applications from natural language requests. Determines project type, selects tech stack, coordinates agents.
Project scaffolding templates for new applications. Use when creating new projects from scratch. Contains 12 templates for various tech stacks.
Enterprise architecture review with comprehensive codebase analysis and prioritized remediation plan. Activate when reviewing architecture, performing codebase audit, assessing architecture quality, evaluating system design, or scoring production readiness. Covers folder structure, separation of concerns, DynamoDB patterns, code quality, security, performance, testing, and documentation.
| name | api-contracts |
| description | API contract validation and Zod-first design patterns. Use when designing, implementing, or validating API routes and schemas. |
All API routes MUST follow Zod-first contract design. Request bodies are validated before processing, and responses follow a consistent envelope pattern.
python scripts/validate_api.py <project_root>
{ success, data?, error? }{ error: "message" } — never stack traces{
"success": true,
"data": { ... }
}
{
"success": false,
"error": "Human-readable error message"
}
{
"success": false,
"error": "Validation failed",
"details": {
"fieldErrors": { "email": ["Invalid email format"] },
"formErrors": []
}
}
// Define in: src/lib/schemas/feedback.ts
import { z } from "zod";
export const CreateFeedbackSchema = z.object({
type: z.enum(["bug", "content", "feature", "rating"]),
message: z.string().min(10).max(2000),
rating: z.number().int().min(1).max(5).optional(),
});
export type CreateFeedbackInput = z.infer<typeof CreateFeedbackSchema>;
// Use in: src/app/api/feedback/route.ts
const parsed = CreateFeedbackSchema.safeParse(body);
if (!parsed.success) {
return NextResponse.json({
success: false,
error: "Validation failed",
details: parsed.error.flatten(),
}, { status: 400 });
}
[ ] Zod schema defined BEFORE the handler
[ ] Input validated with safeParse (not parse)
[ ] Success returns { success: true, data }
[ ] Error returns { success: false, error }
[ ] Auth checked for protected routes
[ ] No raw error details exposed
When you first detect this project has API routes:
.agent/skills/api-contracts/ in the project root## Project-Specific section listing all routes, their schemas, and methods