From ring-pm-team
Designs the API contract as a real OpenAPI 3.1 specification (openapi.yaml) from a validated TRD. Part of the Large Track planning workflow, used when a system exposes APIs.
How this skill is triggered — by the user, by Claude, or both
Slash command
/ring-pm-team:designing-api-contractsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
- TRD passed Gate 3 validation
Runs before: ring:designing-data-model Runs after: ring:writing-trds
The deliverable is a REAL, machine-consumable OpenAPI 3.1 spec — not markdown tables. Implementation agents generate handlers, clients, and tests directly from this file. If it doesn't lint, the gate doesn't pass.
Check if organizational naming standards exist. See shared-patterns/standards-discovery.md for the complete workflow.
AskUserQuestion: "Do you have a data dictionary or API field naming standards to reference?"
If standards provided: WebFetch or read the document and extract:
Save to docs/pre-dev/{feature}/api-standards-ref.md.
If no standards: Use Lerian/industry defaults and record them in api-standards-ref.md:
items, page, limit, next_cursor, prev_cursor| Phase | Activities |
|---|---|
| 1. Surface Discovery | From TRD: identify every API-exposing component; list resources and operations; map auth requirements per surface |
| 2. Spec Authoring | Write openapi.yaml: info, servers, tags, paths with full operations, components (schemas, parameters, responses, securitySchemes); apply naming from api-standards-ref.md |
| 3. Validation | Lint the spec; run the Gate 4 checklist |
File: docs/pre-dev/{feature}/openapi.yaml — openapi: 3.1.0.
Every operation MUST have:
operationId (unique, lowerCamelCase verb-noun: createAccount, listTransactions)summary, tags$ref to components/schemas (no inline anonymous objects for domain types)security requirement (or explicit security: [] for public endpoints)Components MUST define:
required arrays, constraints (maxLength, enum, pattern), and examplessecuritySchemes matching the feature's auth requirements from the TRD (e.g., OAuth2/OIDC client credentials, bearer JWT, API key). Do NOT invent auth the TRD doesn't require.List operations MUST use the Lerian pagination envelope: items plus limit and page (offset mode) or next_cursor/prev_cursor (cursor mode).
All error responses reference one shared schema:
components:
schemas:
Error:
type: object
required: [code, title, message]
properties:
code:
type: string
description: Stable machine-readable error code
examples: ["ACC-0007"]
title:
type: string
examples: ["Entity Not Found"]
message:
type: string
description: Human-readable explanation with resolution guidance
fields:
type: object
additionalProperties: { type: string }
description: Per-field validation messages (422 only)
Maintain an error catalog as description text on the Error schema or a top-level x-error-catalog extension: every code, its HTTP status, trigger condition, and resolution.
Lint before declaring the gate passed. Optional but recommended:
npx @stoplight/spectral-cli lint docs/pre-dev/{feature}/openapi.yaml
# or
npx @redocly/cli lint docs/pre-dev/{feature}/openapi.yaml
If neither tool is available, verify the YAML parses and every $ref resolves.
| Category | Requirements |
|---|---|
| Valid spec | Parses as YAML; openapi: 3.1.0; lints clean (spectral/redocly if available); all $refs resolve |
| Completeness | Every TRD API-exposing component has paths; every operation has request/response schemas and error responses |
| Naming Consistency | Fields follow api-standards-ref.md convention throughout; operationIds consistent; no mixed conventions |
| Error Handling | All error responses use the Lerian envelope; catalog covers every code with status and resolution |
| Auth | securitySchemes match TRD auth requirements; every operation declares security (or explicit security: []) |
Gate Result: ✅ PASS → Data Model | ⚠️ CONDITIONAL (naming/lint warnings to fix) | ❌ FAIL (invalid spec or missing operations)
| Structure | Files Generated |
|---|---|
| single-repo | docs/pre-dev/{feature}/openapi.yaml |
| monorepo | Root docs/pre-dev/{feature}/openapi.yaml |
| multi-repo | Both: {backend.path}/docs/pre-dev/{feature}/openapi.yaml + frontend copy |
npx claudepluginhub p/lerianstudio-ring-pm-team-pm-teamDesigns, validates, and maintains OpenAPI 3.x specifications for REST API contracts. Covers schema patterns, security schemes, versioning, and code generation integration.
Generates OpenAPI 3.1 contracts with JSON schemas, RFC 9457 error responses, versioning, and examples from API entities, PRDs, or database schemas.
Structures OpenAPI 3.x specs with consistent naming, reusable schemas, error modeling, pagination, security schemes, and examples to produce a spec that works as a contract for code generation.