From formal-specification
Generates OpenAPI 3.1, AsyncAPI 3.0, or Protocol Buffers contracts from natural language API requirements for contract-first development.
How this skill is triggered — by the user, by Claude, or both
Slash command
/formal-specification:api-contractThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate contract-first API specifications from requirements or domain descriptions.
Generate contract-first API specifications from requirements or domain descriptions.
/api-contract "user registration with email verification"
/api-contract "order events for downstream systems" format=asyncapi
/api-contract "high-performance inventory service" format=protobuf
Parse the API description to identify:
If format not specified, auto-detect based on description:
| Pattern | Recommended Format |
|---|---|
| "API", "REST", "endpoint" | OpenAPI 3.1 |
| "events", "messages", "streaming" | AsyncAPI 3.0 |
| "gRPC", "high-performance", "internal" | Protocol Buffers |
Load the relevant skill:
openapi-design for REST APIsasyncapi-design for event-driven APIsprotobuf-design for gRPC servicesIdentify and structure:
Create the API specification including:
Deliver:
openapi: 3.1.0
info:
title: Service Name API
version: 1.0.0
paths:
/resources:
get: ...
post: ...
components:
schemas: ...
securitySchemes: ...
asyncapi: 3.0.0
info:
title: Service Events
version: 1.0.0
channels:
resourceCreated:
address: resources.created
messages: ...
components:
messages: ...
schemas: ...
syntax = "proto3";
package service.v1;
service ResourceService {
rpc CreateResource(...) returns (...);
rpc GetResource(...) returns (...);
}
message Resource {
string id = 1;
...
}
/api-contract "user registration API with email verification and password reset"
Output:
/api-contract "order lifecycle events for fulfillment and notifications" format=asyncapi
Output:
/api-contract "product catalog service with search and inventory" format=protobuf
Output:
The command integrates with:
npx claudepluginhub melodic-software/claude-code-plugins --plugin formal-specificationWrites API contracts in OpenAPI/AsyncAPI/GraphQL/gRPC/WebSocket/SSE/Webhook/SDK/file formats from PRD docs. Use after PRD approval, before HLD, to align teams on interfaces.
Designs and manages API contracts before implementation using OpenAPI and AsyncAPI specs for contract-first development workflows and best practices.