Skill

api-contract

Generate OpenAPI, AsyncAPI, or Protobuf contract from requirements. Use for contract-first API development.

From formal-specification
Install
1
Run in your terminal
$
npx claudepluginhub melodic-software/claude-code-plugins --plugin formal-specification
Tool Access

This skill is limited to using the following tools:

ReadGlobGrepWriteSkillTask
Skill Content

/api-contract Command

Generate contract-first API specifications from requirements or domain descriptions.

Usage

/api-contract "user registration with email verification"
/api-contract "order events for downstream systems" format=asyncapi
/api-contract "high-performance inventory service" format=protobuf

Workflow

Step 1: Analyze Requirements

Parse the API description to identify:

  • Domain entities and resources
  • Required operations (CRUD, queries, commands)
  • Communication pattern (sync REST, async events, RPC)
  • Key consumers and use cases

Step 2: Select Contract Format

If format not specified, auto-detect based on description:

PatternRecommended Format
"API", "REST", "endpoint"OpenAPI 3.1
"events", "messages", "streaming"AsyncAPI 3.0
"gRPC", "high-performance", "internal"Protocol Buffers

Step 3: Invoke Appropriate Skill

Load the relevant skill:

  • openapi-design for REST APIs
  • asyncapi-design for event-driven APIs
  • protobuf-design for gRPC services

Step 4: Design Resource Model

Identify and structure:

  • Core entities with properties
  • Value objects and enumerations
  • Relationships between entities
  • Request/response wrappers

Step 5: Generate Contract

Create the API specification including:

  • Complete schema definitions
  • All operations/methods
  • Authentication configuration
  • Error response schemas
  • Examples for each operation

Step 6: Output Result

Deliver:

  1. Contract specification (YAML or .proto)
  2. Summary of endpoints/channels/services
  3. Implementation notes
  4. Suggested test scenarios

Format-Specific Output

OpenAPI 3.1

openapi: 3.1.0
info:
  title: Service Name API
  version: 1.0.0
paths:
  /resources:
    get: ...
    post: ...
components:
  schemas: ...
  securitySchemes: ...

AsyncAPI 3.0

asyncapi: 3.0.0
info:
  title: Service Events
  version: 1.0.0
channels:
  resourceCreated:
    address: resources.created
    messages: ...
components:
  messages: ...
  schemas: ...

Protocol Buffers

syntax = "proto3";
package service.v1;

service ResourceService {
  rpc CreateResource(...) returns (...);
  rpc GetResource(...) returns (...);
}

message Resource {
  string id = 1;
  ...
}

Examples

REST API for User Registration

/api-contract "user registration API with email verification and password reset"

Output:

  • OpenAPI 3.1 specification
  • POST /users (registration)
  • POST /users/verify-email
  • POST /users/forgot-password
  • POST /users/reset-password
  • JWT authentication scheme

Event-Driven Order System

/api-contract "order lifecycle events for fulfillment and notifications" format=asyncapi

Output:

  • AsyncAPI 3.0 specification
  • Channels: orders.created, orders.submitted, orders.shipped
  • CloudEvents envelope
  • Kafka bindings

gRPC Product Catalog

/api-contract "product catalog service with search and inventory" format=protobuf

Output:

  • Protocol Buffers definition
  • ProductService with CRUD + Search
  • Streaming for bulk operations
  • Well-known types for timestamps

Integration

The command integrates with:

  • requirements-elicitation: Uses functional requirements
  • enterprise-architecture: Aligns with bounded contexts
  • test-strategy: Generates contract test scenarios
  • systems-design: Follows API design patterns
Similar Skills
ui-ux-pro-max

UI/UX design intelligence for web and mobile. Includes 50+ styles, 161 color palettes, 57 font pairings, 161 product types, 99 UX guidelines, and 25 chart types across 10 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui, and HTML/CSS). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, and check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, and mobile app. Elements: button, modal, navbar, sidebar, card, table, form, and chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, and flat design. Topics: color systems, accessibility, animation, layout, typography, font pairing, spacing, interaction states, shadow, and gradient. Integrations: shadcn/ui MCP for component search and examples.

49.4k
Stats
Parent Repo Stars40
Parent Repo Forks6
Last CommitFeb 15, 2026