analyzing-options
Analyzing different approaches for a task or problem with structured comparisons, effort…
Designing the API contract as a real OpenAPI 3.1 specification (openapi.yaml with full paths, operations, schemas, components, Lerian error envelope, and auth schemes) from the validated TRD. Gate 4 of ring:planning-large-features, Large Track only; runs after ring:writing-trds,
$ npx -y skills add LerianStudio/ring --skill designing-api-contracts --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/designing-api-contractsContext preview
The summary Claude sees to decide when to auto-load this skill.
Designing the API contract as a real OpenAPI 3.1 specification (openapi.yaml with full paths, operations, schemas, components, Lerian error envelope, and auth schemes) from the validated TRD. Gate 4 of ring:planning-large-features, Large Track only; runs after ring:writing-trds,
name: ring:designing-api-contracts description: "Designing the API contract as a real OpenAPI 3.1 specification (openapi.yaml with full paths, operations, schemas, components, Lerian error envelope, and auth schemes) from the validated TRD. Gate 4 of ring:planning-large-features, Large Track only; runs after ring:writing-trds, before ring:designing-data-model. Use when a system exposes APIs that components or clients consume. Skip for Small Track, a system with no API surface, or an unvalidated TRD."
**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](../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:
| 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:
Components MUST define:
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.yamlIf 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 `$ref`s 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` | | mu
Proven engineering practices, enforced through skills. Ring is a comprehensive skills library and workflow system for AI agents that transforms how AI assistants approach software development.
Repo: LerianStudio/ring
Analyzing different approaches for a task or problem with structured comparisons, effort…
Auditing a service's production readiness against Ring engineering standards across base…
Cleaning redundant and obvious comments following clean code principles while preserving…
Commit changes with scope allowlist enforcement, atomic grouping, GPG-signed conventional…
Creating a handoff document that captures session state (completed work, decisions, open…
Creating an isolated git worktree for parallel branch work: selects the directory by priority…