api-forge
БесплатноБез исполняемых скриптовНе проверенUse to derive the API contract for a feature — an OpenAPI 3.1 document at docs/features/{slug}/contracts/openapi.yaml plus a drift/sync report…
от genkovich★ 17 звёзд на GitHubОб этом скилле
Skill: api-forge
Projects the upstream artifacts into one interface contract. By default that's an HTTP/OpenAPI contract; this skill is interface-kind aware — and the kind comes from the surface(s) architecture-design declared in sad.md frontmatter target_surfaces, read here, not re-derived (→ ../_shared/surfaces.md). For a non-HTTP project it produces the matching contract form:
- HTTP / REST (default) →
contracts/openapi.yaml(OpenAPI 3.1) +api-sync-report.md. - gRPC / RPC → a
.proto(or the repo's IDL) with the same derive-and-drift discipline. - CLI →
contracts/cli.md— the command/flag/exit-code surface derived from the AC. - Library / SDK →
contracts/public-api.md— the public signatures/types the feature exposes. - Event-only / worker → just
contracts/events.md(no request/response surface). - No external interface (pure internal logic) → skip with a one-line note in the report; go straight to
break-tasks.
Whatever the form, the contract is derived from data-model.md + the sad.md §6 sequences + the PRD's AC, never typed by hand — generation that diverges from the model or the sequences is the bug this skill exists to catch. The rest of this file details the HTTP path (the common case); the same derive → drift-check → reconcile loop applies to the other forms with the form-appropriate artifact.
This skill keeps only its own machinery. Depth (events doc only when async; one resource vs full surface) follows the size matrix → ../_shared/size-matrix.md.
Owner
Backend Lead (drives the interface). The PM confirms each endpoint maps to a real user story; a frontend / consumer engineer is the first reader — the contract is locked before they start integration.
Inputs
<slug>— same feature slug used by every earlier stage.- Gate (hard-refuse if missing):
docs/features/<slug>/PRD.md. It is the source of user stories and acceptance criteria; without it the endpoint list would be invented. If absent → STOP and point: «run/sdlc:write-prd <slug>first». - Recommended (presence determines scenario A vs B):
docs/features/<slug>/data-model.md— strongest source of typed fields and constraints. Presence triggers scenario A (typed contract). Absence triggers scenario B (PRD/sequence-derived contract withunresolved_originsblock).docs/features/<slug>/sad.md§6 — the MermaidsequenceDiagramblocks. Theiralt/elsebranches become errorresponses; an async participant (<message-bus>/<external-system>) on a mutating flow marks its endpointIdempotency-Key-required and seedsevents.md. Absent → note the gap and still generate.
- Optional (auto-detected, enrich when present):
docs/features/<slug>/adr/*.md— architecture decisions that override defaults (versioning, error format, auth scheme).docs/features/<slug>/CONTEXT.md— glossary terms become schema names verbatim.- Existing
contracts/openapi.yaml— if present, diff and update in place, never overwrite whole-cloth. docs/features/<slug>/.size— depth hint. Absent → default to M (full surface).
If any recommended/optional input is missing, the skill still generates a usable contract. The api-sync-report.md flags which enrichment was skipped and why it would have helped.
Scenarios A vs B
The skill detects scenario from inputs and tells the user which one it is running.
Scenario A — data-model.md exists (preferred)
Contract is derived from the model. Every field has an origin in a typed entity. Constraints (maxLength, pattern, enum) trace back to DDL (varchar(N), CHECK, ENUM type). Error codes derive from constraints (UNIQUE (a, b) → <entity>.duplicate_<field>). unresolved_origins is empty.
Drift check verifies field-by-field alignment. Drift in scenario A means model and contract disagree on form — human resolves which artifact is right. Only scenario A can reach a plain PASS verdict.
Scenario B — data-model.md missing (fallback)
Contract is inferred from PRD §4 acceptance criteria + sequence diagrams + SAD §6 namespacing. Types are less precise (string without maxLength, no enum patterns yet). Error codes derive from alt-blocks in sequences, not from constraints.
unresolved_origins lists every field whose origin is "inferred from PRD/sequence, needs confirmation when data-model.md arrives". This is not an error — it is declared incompleteness, visible to the team. Because something is always parked, a scenario-B report reads PASS (with deferrals) at best, never plain PASS.
Reconcile (--reconcile flag)
When data-model.md arrives after a scenario-B run, re-run with --reconcile. It:
- Re-reads all inputs.
- Switches scenario B → A.
- Tightens types:
stringbecomesstring+maxLengthwhere DDL exists. - Promotes low-confidence origins to high.
- Empties `u
Установить api-forge в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл api-forge?
Use to derive the API contract for a feature — an OpenAPI 3.1 document at docs/features/{slug}/contracts/openapi.yaml plus a drift/sync report (api-sync-report.md with an explicit Verdict: PASS | PASS (with deferrals) | FAIL and a 5-point drift checklist), the right contract artifact per surface (events.md for async, cli.md for CLI, public-api.md for library/SDK), and — on the HTTP path, first run only — a baseline .claude/rules/openapi.md so later code follows the same API conventions. Triggers on "api for {slug}", "openapi for {slug}", "API contract for {slug}", "lock the interface for {slug}", "events for {slug}", "/sdlc:api-forge {slug}", "контракт API для {slug}", "OpenAPI для {slug}", "опиши ендпоінти". The contract is never hand-written: it is a derived function of data-model.md (typed fields + constraints), sad.md §6 sequence diagrams (error branches, async actors), and PRD.md acceptance criteria. Hard gate: docs/features/{slug}/PRD.md. data-model.md is recommended but optional — without it the skill runs in scenario B (PRD + sequences only) and fills unresolved_origins in the sync report. Renamed from define-api in v3.3.0; the legacy name is kept as a deprecation wrapper.
Как установить скилл api-forge?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-forge запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic