Generates shared API contracts to sync frontend and backend development.

Install

mkdir -p .claude/skills/api-contract && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6595" && unzip -o skill.zip -d .claude/skills/api-contract && rm skill.zip

Installs to .claude/skills/api-contract

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Configure this skill should be used when the user asks about "API contract",
76 chars✓ has a “when” trigger
Beginner

Key capabilities

  • Define endpoint routes and HTTP methods
  • Specify request and response schemas with status codes
  • Create TypeScript interfaces for request and response types
  • Document error formats with consistent codes and messages
  • Include pagination parameters for list endpoints
  • Follow best practices for field constraints and examples

How it works

The skill guides the creation of an `api-contract.md` file that defines API endpoints, request/response schemas, and TypeScript interfaces. It ensures consistency between frontend and backend development.

Inputs & outputs

You give it
Feature scope and endpoint requirements
You get back
`api-contract.md` with endpoint definitions and TypeScript interfaces

When to use api-contract

  • Defining endpoint schemas
  • Syncing frontend and backend teams
  • Creating shared TypeScript interfaces
  • Drafting API documentation for sprint features

About this skill

API Contract

Overview

API Contract guides the creation of api-contract.md files that serve as the shared interface between backend and frontend agents during sprint execution. The contract defines request/response schemas, endpoint routes, TypeScript interfaces, and error formats so that implementation agents build to an agreed specification without direct coordination.

Prerequisites

  • Sprint directory initialized at .claude/sprint/[N]/
  • specs.md with defined feature scope and endpoint requirements
  • Familiarity with RESTful API conventions (HTTP methods, status codes, JSON schemas)
  • TypeScript knowledge for interface definitions (recommended)

Instructions

  1. Create api-contract.md in the sprint directory (.claude/sprint/[N]/api-contract.md). Define each endpoint using the standard format: HTTP method, route path, description, request body, response body with status code, and error codes. See ${CLAUDE_SKILL_DIR}/references/writing-endpoints.md for the full template.
  2. Define TypeScript interfaces for all request and response types. Use explicit types instead of any, mark optional fields with ?, and use string | null for nullable values. Reference ${CLAUDE_SKILL_DIR}/references/typescript-interfaces.md for canonical type patterns.
  3. For list endpoints, include pagination parameters and the PaginatedResponse<T> wrapper. Standardize on page, limit, sort, and order query parameters as documented in ${CLAUDE_SKILL_DIR}/references/pagination.md.
  4. Document all response states: success (200, 201, 204), client errors (400, 401, 403, 404, 422), and empty states. Use a consistent error response format with code, message, and optional details fields.
  5. Follow best practices from ${CLAUDE_SKILL_DIR}/references/best-practices.md: be specific about field constraints (e.g., "string, required, valid email format"), include request/response examples, reference shared types instead of duplicating, and omit implementation details (no database columns, framework names, or file paths).
  6. Share the contract file path in SPAWN REQUEST blocks so both backend and frontend agents read the same interface definition.

Output

  • api-contract.md containing all endpoint definitions with typed request/response schemas
  • TypeScript interface declarations for User, CreateUserRequest, LoginRequest, AuthResponse, ApiError, and domain-specific types
  • Paginated response wrappers for list endpoints
  • Standardized error format across all endpoints

Error Handling

ErrorCauseSolution
Backend and frontend schemas divergeContract updated without notifying both agentsAlways reference a single api-contract.md; never duplicate endpoint definitions
Missing error response codesContract only documents the happy pathDocument all status codes: 400, 401, 403, 404, 409, 422 per endpoint
Ambiguous field typesUsing string without constraintsSpecify format, length, and validation rules (e.g., "string, required, min 8 chars")
Pagination inconsistencyList endpoints use different parameter namesStandardize on the PaginatedResponse<T> interface for all list endpoints
Type mismatch between JSON and TypeScriptDates serialized inconsistentlyUse ISO 8601 datetime strings; document as "createdAt": "ISO 8601 datetime"

Examples

Authentication endpoint contract:

#### POST /auth/register

Create a new user account.

**Request:**
{
  "email": "string (required, valid email)",
  "password": "string (required, min 8 chars)",
  "name": "string (optional)"
}

**Response (201):**  # HTTP 201 Created
{
  "id": "uuid",
  "email": "string",
  "name": "string | null",
  "createdAt": "ISO 8601 datetime"  # 8601 = configured value
}

**Errors:**
- 400: Invalid request body  # HTTP 400 Bad Request
- 409: Email already exists  # HTTP 409 Conflict
- 422: Validation failed  # HTTP 422 Unprocessable Entity

Paginated list endpoint:

#### GET /products

List products with pagination.

**Query Parameters:**
| Param | Type | Default | Description |
|-------|------|---------|-------------|
| page | integer | 1 | Page number |
| limit | integer | 20 | Items per page (max 100) |
| sort | string | createdAt | Sort field |
| order | string | desc | Sort order (asc/desc) |

**Response (200):**  # HTTP 200 OK
{
  "data": [Product],
  "pagination": { "page": 1, "limit": 20, "total": 150, "totalPages": 8 }
}

Shared TypeScript interface:

interface ApiError {
  code: string;
  message: string;
  details?: Record<string, string[]>;
}

Resources

  • ${CLAUDE_SKILL_DIR}/references/writing-endpoints.md -- Endpoint definition template and key elements
  • ${CLAUDE_SKILL_DIR}/references/typescript-interfaces.md -- Canonical type definitions and guidelines
  • ${CLAUDE_SKILL_DIR}/references/pagination.md -- Pagination parameters and PaginatedResponse interface
  • ${CLAUDE_SKILL_DIR}/references/best-practices.md -- Contract authoring rules (specificity, DRY, no implementation details)

Prerequisites

Sprint directory initialized at `.claude/sprint/[N]/``specs.md` with defined feature scope and endpoint requirementsFamiliarity with RESTful API conventionsTypeScript knowledge for interface definitions

Limitations

  • Backend and frontend schemas can diverge if the contract is not consistently referenced
  • Missing error response codes can lead to incomplete API documentation
  • Ambiguous field types can cause integration issues

How it compares

This skill establishes a single source of truth for API definitions, preventing divergence between frontend and backend implementations that can occur with less structured communication.

Compared to similar skills

api-contract side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
api-contract (this skill)126dNo flagsBeginner
deepwiki-rs259moReviewIntermediate
writing-registry-meta57moNo flagsBeginner
markdown-to-html166moReviewBeginner

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

You might also like

deepwiki-rs

sopaco

AI-powered Rust documentation generation engine for comprehensive codebase analysis, C4 architecture diagrams, and automated technical documentation. Use when Claude needs to analyze source code, understand software architecture, generate technical specs, or create professional documentation from any programming language.

25170

writing-registry-meta

siriwatknp

Use this skill when writing meta file for MUI Treasury registry.

587

markdown-to-html

github

Convert Markdown files to HTML similar to `marked.js`, `pandoc`, `gomarkdown/markdown`, or similar tools; or writing custom script to convert markdown to html and/or working on web template systems like `jekyll/jekyll`, `gohugoio/hugo`, or similar web templating systems that utilize markdown documents, converting them to html. Use when asked to "convert markdown to html", "transform md to html", "render markdown", "generate html from markdown", or when working with .md files and/or web a templating system that converts markdown to HTML output. Supports CLI and Node.js workflows with GFM, CommonMark, and standard Markdown flavors.

1662

schema-markup

davila7

When the user wants to add, fix, or optimize schema markup and structured data on their site. Also use when the user mentions "schema markup," "structured data," "JSON-LD," "rich snippets," "schema.org," "FAQ schema," "product schema," "review schema," or "breadcrumb schema." For broader SEO issues, see seo-audit.

1042

coding-standards

affaan-m

适用于TypeScript、JavaScript、React和Node.js开发的通用编码标准、最佳实践和模式。

744

obsidian-data-handling

jeremylongshore

Implement vault data backup, sync, and recovery strategies. Use when building backup features, implementing data export, or handling vault synchronization in your plugin. Trigger with phrases like "obsidian backup", "obsidian sync", "obsidian data export", "vault backup strategy".

437

Search skills

Search the agent skills registry