name: write-an-openapi-specification
description: Writes an OpenAPI contract that captures schemas, operations, and error responses. Use when the user needs an executable or implementation-ready description of an HTTP API.
domain: api-design
tags: [openapi, api-specification, documentation]
triggers: ["openapi specification", "write an openapi spec", "document an http api in openapi"]
Writes an OpenAPI contract that captures schemas, operations, and error responses
Purpose
Writes an OpenAPI contract that captures schemas, operations, and error responses.
When to use
Use when the user needs an executable or implementation-ready description of an HTTP API.
When NOT to use
Do not use this for internal function signatures; use software-engineering instead.
Inputs required
- The consumers and what they need
- The resources and the operations involved
- The versioning, auth and rate-limit policy
Procedure
- Define the OpenAPI info block, servers, and security schemes.
- Model reusable request and response schemas under components.
- Document every path, method, parameter, status, and response body.
- Represent errors, pagination, filtering, and idempotency in the schema.
- Run an OpenAPI linter and resolve every warning before publishing.
Output contract
A documented contract with endpoints, payloads, error shapes and versioning rules.
Validation checklist
Safety notes
Never change an existing response shape without a version bump and a migration note.
Related skills
design-an-authentication-flow
design-an-authorization-model
design-an-error-response-format
1---2name: write-an-openapi-specification3description: Writes an OpenAPI contract that captures schemas, operations, and error responses. Use when the user needs an executable or implementation-ready description of4---5---6name: write-an-openapi-specification7description: Writes an OpenAPI contract that captures schemas, operations, and error responses. Use when the user needs an executable or implementation-ready description of an HTTP API.8domain: api-design9tags: [openapi, api-specification, documentation]10triggers: ["openapi specification", "write an openapi spec", "document an http api in openapi"]11---1213# Writes an OpenAPI contract that captures schemas, operations, and error responses1415## Purpose1617Writes an OpenAPI contract that captures schemas, operations, and error responses.1819## When to use2021Use when the user needs an executable or implementation-ready description of an HTTP API.2223## When NOT to use2425Do not use this for internal function signatures; use software-engineering instead.2627## Inputs required2829- The consumers and what they need30- The resources and the operations involved31- The versioning, auth and rate-limit policy3233## Procedure34351. Define the OpenAPI info block, servers, and security schemes.362. Model reusable request and response schemas under components.373. Document every path, method, parameter, status, and response body.384. Represent errors, pagination, filtering, and idempotency in the schema.395. Run an OpenAPI linter and resolve every warning before publishing.4041## Output contract4243A documented contract with endpoints, payloads, error shapes and versioning rules.4445## Validation checklist4647- [ ] Every error has a stable machine-readable code48- [ ] Pagination, filtering and idempotency are defined49- [ ] The contract is versioned and backward compatible5051## Safety notes5253Never change an existing response shape without a version bump and a migration note.5455## Related skills5657- `design-an-authentication-flow`58- `design-an-authorization-model`59- `design-an-error-response-format`