/sdlc-documentation:03-api-specificationfrom sdlc-documentation
Guides creation of versioned API contracts with OpenAPI 3.1, covering operations, schemas, auth, errors, and idempotency. Requires approved requirements and policies before drafting.
Ships in sdlc-documentation. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
| Artefact | Source or provider | Required? | Missing behaviour |
|---|---|---|---|
| Approved requirements, HLD and consumer use cases | Phase 02/03 artefacts | Required | Stop if ownership, actors or operations are unresolved. |
| Data, auth and error policies | Security, database and platform owners | Required | Mark unresolved policy as blocking; do not choose silently. |
| Artefact | Consumer | Observable acceptance condition |
|---|---|---|
| API specification and valid OpenAPI 3.1 artefact | Provider, frontend, mobile, SDK, test and operations teams | The OpenAPI parses; examples conform to schemas; auth, errors, pagination, idempotency and observable acceptance cover each operation. |
| Evidence | Consumer | Acceptance condition |
|---|---|---|
| Source and decision trace | Reviewer and downstream owner | Each material statement cites an approved input, named decision or qualified open issue. |
| Completed verification record | Release or phase gate owner | Every applicable check records pass/fail; unavailable checks remain not assessed. |
Read-only is the default for analysis, review, evaluation and planning. Read and search access to authorised project artefacts are required. Editing is limited to an explicitly requested project deliverable. Execution may run document, syntax or validation checks. Network access is used only for facts that require current verification. Do not publish, spend, change production, approve policy, or claim certification without explicit authority.
If any required capability is unavailable, return the narrowest useful qualified API specification and valid OpenAPI 3.1 artefact draft plus a gap register showing the missing item, affected sections, risk and owner. Never convert an unassessed check into a pass.
| Choice | Action | Failure or risk avoided |
|---|---|---|
| Operation creates a retriable side effect | Require an idempotency key | Retries do not duplicate effects |
| Work exceeds request-time budget | Use the long-running-operation pattern | Clients avoid timeouts and uncertain completion |
This skill generates comprehensive API documentation and a machine-readable OpenAPI 3.1 specification (JSON Schema 2020-12 dialect, RFC 9457 problem details for errors). It translates functional requirements from the SRS and architectural decisions from the HLD into a complete, implementation-ready API contract. The skill can run after 01-high-level-design completes and operates in parallel with 02-low-level-design and 04-database-design.
01-high-level-design has produced HLD.md in projects/<ProjectName>/<phase>/<document>/, which identifies system components and integration points.SRS_Draft.md Section 3.2 provides the functional requirements that map to API endpoints.| Attribute | Value |
|---|---|
| Inputs | projects/<ProjectName>/<phase>/<document>/SRS_Draft.md, projects/<ProjectName>/<phase>/<document>/HLD.md, projects/<ProjectName>/_context/tech_stack.md |
| Outputs | projects/<ProjectName>/<phase>/<document>/API_Specification.md, projects/<ProjectName>/<phase>/<document>/openapi.yaml |
| Tone | Technical, specification-grade, implementation-ready |
| Standards | OpenAPI 3.1.x (3.1.2), JSON Schema 2020-12, RFC 9457, RFC 9110, IEEE 29148-2018 |
| File | Location | Required | Purpose |
|---|---|---|---|
| SRS_Draft.md | projects/<ProjectName>/<phase>/<document>/SRS_Draft.md | Yes | Functional requirements, security, performance |
| HLD.md | projects/<ProjectName>/<phase>/<document>/HLD.md | Yes | System components, integration points, data flow |
| tech_stack.md | projects/<ProjectName>/_context/tech_stack.md | Yes | Technology choices, framework conventions |
| File | Location | Description |
|---|---|---|
| API_Specification.md | projects/<ProjectName>/<phase>/<document>/API_Specification.md | Human-readable API reference with all sections |
| openapi.yaml | projects/<ProjectName>/<phase>/<document>/openapi.yaml | Machine-readable OpenAPI 3.1 specification |
Follow these eleven steps in order. Halt and notify the user if a required input file is missing.
Read SRS_Draft.md and HLD.md from projects/<ProjectName>/<phase>/<document>/, and tech_stack.md from projects/<ProjectName>/_context/. Log every file path read. If any required file is missing, halt execution and report the gap.
Extract entities and operations from SRS Section 3.2 to identify API resources. Each entity that the system manages (e.g., User, Order, Product) becomes a resource. Each operation on that entity becomes an endpoint.
For public, partner, workflow-heavy, or long-lived APIs, load references/practical-api-architecture.md before locking the resource model. Apply its consumer contract, idempotency, lifecycle, error-code, and observability checks.
Map CRUD operations to HTTP methods following REST conventions: Create = POST, Read = GET, Update (full) = PUT, Update (partial) = PATCH, Delete = DELETE. Use HLD component boundaries to determine resource grouping and URL namespace.
Extract the authentication mechanism from SRS Section 3.5.3 (Security Requirements). Define the scheme as one of: JWT Bearer Token, Session Cookies, or API Key. Reference skills/security/vibe-security-skill/ (Chwezi Dev Engine; it replaced the retired dual-auth-rbac skill) if the project uses role-based access control with multiple authentication strategies.
For each endpoint, specify: path (RESTful URL), HTTP method, description, path parameters with data types, query parameters with defaults, request body schema (JSON with field types and constraints), response schema (JSON with field types), and HTTP status codes (200, 201, 400, 401, 403, 404, 422, 500).
Define one error format for all endpoints using RFC 9457 Problem Details for HTTP APIs (media type application/problem+json; RFC 9457 obsoletes RFC 7807). For implementation patterns, consult the engineering catalog's api-design-first error-handling reference.
{
"type": "https://api.example.com/problems/insufficient-balance",
"title": "Insufficient wallet balance",
"status": 422,
"detail": "Wallet W-2231 holds UGX 12,000; the transfer needs UGX 50,000.",
"instance": "/transfers/7f3c9a",
"code": "WALLET_INSUFFICIENT_BALANCE",
"retryable": false,
"errors": []
}
Every error status code shall return this structure. type, title and status are mandatory in this engine; code, retryable and errors (field-level validation failures) are documented extension members. Each type URI and code appears once in the Section 5.2 Error Code Registry. If a legacy client contract already fixes a different envelope, record it as a decision with owner and migration date rather than silently mixing formats.
Extract performance constraints from SRS Section 3.3 (Performance Requirements). Define rate limits per endpoint tier: public endpoints, authenticated endpoints, and administrative endpoints. Document the chosen header scheme explicitly (header names, units, reset semantics, and the 429 Too Many Requests plus Retry-After behaviour). No rate-limit header scheme is an IETF standard yet: the RateLimit / RateLimit-Policy fields are still an Internet-Draft (draft-ietf-httpapi-ratelimit-headers), and X-RateLimit-* is a vendor convention. Record whichever the project adopts as a decision; do not present either as a standard.
Define pagination strategy for all list endpoints: cursor-based or offset-based depending on data characteristics. Include standard parameters page, per_page and response envelope total, data[]. For implementation patterns, consult the engineering catalog's api-design-first pagination reference.
For APIs with operations beyond standard CRUD, apply patterns from references/advanced-api-patterns.md:
references/long-running-operations.md (POST returns 202 + operation resource)references/batch-operations.md (POST /resources:batchCreate)Source: API Design Patterns (JJ Geewax)
Write the human-readable specification to projects/<ProjectName>/<phase>/<document>/API_Specification.md with all sections defined in the Output Format below.
Generate a valid OpenAPI 3.1 document at projects/<ProjectName>/<phase>/<document>/openapi.yaml. The document shall include: openapi: "3.1.2" (3.1.x is the default; use 3.2.x only when every consumer toolchain - validators, code generators, gateways, mock servers - is confirmed to support it, and record that decision), info block, servers block, paths with all endpoints, components/schemas with all request/response models, and components/securitySchemes with the authentication definition, and components/responses holding a shared Problem response (application/problem+json). Write schemas in the JSON Schema 2020-12 dialect that OpenAPI 3.1 uses: express nullability as type: [string, "null"] (not the 3.0 nullable: true) and use examples arrays in schemas. Parse the file with a 3.1-aware validator before handoff; if none is available, mark the check not assessed.
The generated API_Specification.md shall follow this template structure:
# API Specification: [Project Name]
## Document Header
## 1. API Overview
### 1.1 Base URL and Versioning
### 1.2 Content Types
### 1.3 Common Headers
## 2. Authentication and Authorization
### 2.1 Authentication Scheme
### 2.2 Authorization Model
### 2.3 Token Lifecycle
## 3. Endpoint Reference
### 3.x [Resource Name]
#### 3.x.1 [METHOD] /api/v1/resource
## 4. Request and Response Schemas
### 4.1 Common Models
### 4.2 Resource-Specific Models
## 5. Error Response Format
### 5.1 Standard Error Envelope
### 5.2 Error Code Registry
## 6. Rate Limiting
## 7. Pagination
## 8. Versioning Strategy
## 9. CORS and Security Headers
## 10. Traceability Matrix
Section 10 (Traceability Matrix) shall map each endpoint to its originating SRS requirement ID and the HLD component that owns it.
openapi.yaml file declares openapi: 3.1.x (or a recorded 3.2.x decision), parses with a 3.1-aware validator, and contains all endpoints defined in API_Specification.md.application/problem+json shape, and every type/code appears in the Error Code Registry.document_number as a string and number_status; numbered creates require an idempotency key, ignore client-sent numbers and return the stored number on replay.| Direction | Skill | Relationship |
|---|---|---|
| Upstream | 03-design-documentation/01-high-level-design | Consumes HLD.md for component boundaries |
| Upstream | 02-requirements-engineering | Consumes SRS_Draft.md for functional requirements |
| Downstream | Phase 04 (Development) | API contract drives backend implementation |
| Downstream | Phase 05 (Testing) | Endpoint definitions drive API test cases |
| Reference | api-design-first error-handling reference | Error response implementation patterns |
| Reference | api-design-first pagination reference | Pagination implementation patterns |
| Reference | skills/security/vibe-security-skill/ | Authentication and RBAC patterns (Chwezi Dev Engine) |
| Reference | references/practical-api-architecture.md | Book-distilled API architecture, lifecycle, idempotency, and error-semantics checks |
openapi.yaml; Schema Objects use the JSON Schema Draft 2020-12 dialect. OpenAPI 3.2.x is published and optional when the consumer toolchain supports it.Evidence/currentness (accessed 2026-09-24): spec.openapis.org/oas/ lists v3.1.2 as latest 3.1.x and v3.2.1 as latest 3.2.x; spec.openapis.org/oas/v3.1.2 confirms the JSON Schema 2020-12 dialect; rfc-editor.org/info/rfc9457 and rfc-editor.org/info/rfc9110 confirm status and obsoletions; datatracker.ietf.org shows draft-ietf-httpapi-ratelimit-headers-11 (May 2026) still an Internet-Draft. Review by 2027-03-24.
logic.prompt -- executable prompt for automated API specification generation.README.md -- quick-start guide for this skill.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub peterbamuhigire/chwezi-sdlc-documentation --plugin sdlc-documentation160 skills in this plugin
/01-deployment-guideUse when producing or updating deployment guide for release prerequisites, migration choreography, verification, rollback, and ownership. Use runbook for the neighbouring concern; this skill owns the named document contract and its acceptance evidence./01-high-level-designUse when approved requirements need a system-level architecture with boundaries, components, critical flows, deployment topology and ADRs, or an as-built design must be recovered from existing code; use system-overview for orientation, low-level-design for module internals, and infrastructure-design for infrastructure depth./01-initialize-srsUse when writing a new SRS (software requirements specification) for a business system or module: create the Waterfall SRS workspace, IEEE structure, identifiers and source context; use context-engineering next for boundaries and actors.Other plugins' skills for the same job