contract

Creates OpenAPI 3.1 specifications with endpoints, schemas, and security definitions.

Updated Mar 4, 2026
One-click install
npx skills add https://github.com/gmolike/Claude-Template --skill contract-gmolike
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: contract
Source: https://github.com/gmolike/Claude-Template/tree/main/template-shared-contracts/.claude/skills/contract
Command: npx skills add https://github.com/gmolike/Claude-Template --skill contract-gmolike

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Defining new API contracts by hand is error-prone and inconsistent, especially when multiple endpoints must share common schemas like error responses and pagination. This Skill scaffolds a complete OpenAPI 3.1 specification so teams can standardize API definitions quickly. ## Core Features & Use Cases - OpenAPI Spec Generation: Creates openapi/[name].yaml with paths, operationIds, request/response schemas, and security schemes. - Shared Schema Reuse: References common.yaml for ErrorResponse and Pagination to keep contracts DRY. - Validation & Type Generation: Runs pnpm validate and pnpm generate to verify the spec and produce TypeScript types, then updates the CHANGELOG. - Use Case: When adding a new "billing" API to a Hono + Prisma backend, run the skill to scaffold the contract, validate it, and generate shared types consumed by both frontend and backend. ## Quick Start Ask the assistant to create a new API contract named billing with endpoints for listing invoices and creating payments.

Frequently Asked Questions about contract

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

FAQPage Schema
How do I create a new OpenAPI specification for a REST API?

Define your endpoints, request and response schemas, and auth requirements, then generate an OpenAPI 3.1 YAML file with paths, operationIds, and component schemas. Validate the spec and generate TypeScript types from it.

How to share common schemas across multiple OpenAPI spec files?

Place reusable schemas like ErrorResponse and Pagination in a common.yaml file and reference them from other specs using $ref pointers such as common.yaml#/components/schemas/ErrorResponse. This keeps contracts consistent and avoids duplication.

Why does every OpenAPI endpoint need an operationId?

The operationId provides a unique, stable identifier for each operation, which code generators use to name client methods and server handlers. Missing operationIds cause generated types and API clients to be ambiguous or fail.

Can OpenAPI specs generate TypeScript types automatically?

Yes, after writing the spec you run a generation command such as pnpm generate to produce TypeScript types from the schemas. These types can be shared between frontend and backend in a monorepo as a single source of truth.

What are the limitations of hand-written OpenAPI contracts?

Hand-written specs risk drift from the actual implementation if not validated in CI. They also require discipline to keep shared schemas in common files and to update changelogs when endpoints change.