[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M72YAGQJ79TMD7M2F78N1T3M":3,"skill-same:01M72YAGQJ79TMD7M2F78N1T3M":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":28,"commitSha":29,"skillDirectory":30,"forksCount":31,"repositoryHtmlUrl":32,"repositoryHomepageUrl":33,"ownerHtmlUrl":34,"ownerBlogUrl":35,"ownerDescription":36,"updatedAt":37,"install":38,"resources":51},"01M72YAGQJ79TMD7M2F78N1T3M","api-forge",null,"Use to derive the API contract for a feature — an OpenAPI 3.1 document at docs\u002Ffeatures\u002F{slug}\u002Fcontracts\u002Fopenapi.yaml plus a drift\u002Fsync 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\u002FSDK), and — on the HTTP path, first run only — a baseline .claude\u002Frules\u002Fopenapi.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}\", \"\u002Fsdlc: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\u002Ffeatures\u002F{slug}\u002FPRD.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.","genkovich\u002Fagentic-engineering-course-public","genkovich","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F14920737?v=4","01M72Y5BWEEZ8VT4DFW6AGGE8X","Kirill Sulimovsky","01M72Y5BXYRGV5PKCVCHEX81WY",15,"MIT","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002FSKILL.md",[],[],"2026-11-10 22:39:42",false,"---\nname: api-forge\ndescription: >\n  Use to derive the API contract for a feature — an OpenAPI 3.1 document at\n  docs\u002Ffeatures\u002F{slug}\u002Fcontracts\u002Fopenapi.yaml plus a drift\u002Fsync report\n  (api-sync-report.md with an explicit Verdict: PASS | PASS (with deferrals) | FAIL\n  and a 5-point drift checklist), the right contract artifact per surface\n  (events.md for async, cli.md for CLI, public-api.md for library\u002FSDK), and — on the\n  HTTP path, first run only — a baseline .claude\u002Frules\u002Fopenapi.md so later code\n  follows the same API conventions. Triggers on \"api for {slug}\", \"openapi for {slug}\",\n  \"API contract for {slug}\", \"lock the interface for {slug}\", \"events for {slug}\",\n  \"\u002Fsdlc:api-forge {slug}\", \"контракт API для {slug}\", \"OpenAPI для {slug}\", \"опиши ендпоінти\".\n  The contract is never hand-written: it is a derived function of data-model.md (typed\n  fields + constraints), sad.md §6 sequence diagrams (error branches, async actors), and\n  PRD.md acceptance criteria.\n  Hard gate: docs\u002Ffeatures\u002F{slug}\u002FPRD.md. data-model.md is recommended but optional —\n  without it the skill runs in scenario B (PRD + sequences only) and fills\n  unresolved_origins in the sync report.\n  Renamed from define-api in v3.3.0; the legacy name is kept as a deprecation wrapper.\ntriggers:\n  - \u002Fsdlc:api-forge\nstage: \"10\"\n---\n\n# Skill: api-forge\n\nProjects the upstream artifacts into one **interface contract**. By default that's an HTTP\u002FOpenAPI 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** (→ [`..\u002F_shared\u002Fsurfaces.md`](..\u002F_shared\u002Fsurfaces.md)). For a non-HTTP project it produces the matching contract form:\n\n- **HTTP \u002F REST** (default) → `contracts\u002Fopenapi.yaml` (OpenAPI 3.1) + `api-sync-report.md`.\n- **gRPC \u002F RPC** → a `.proto` (or the repo's IDL) with the same derive-and-drift discipline.\n- **CLI** → `contracts\u002Fcli.md` — the command\u002Fflag\u002Fexit-code surface derived from the AC.\n- **Library \u002F SDK** → `contracts\u002Fpublic-api.md` — the public signatures\u002Ftypes the feature exposes.\n- **Event-only \u002F worker** → just `contracts\u002Fevents.md` (no request\u002Fresponse surface).\n- **No external interface** (pure internal logic) → **skip** with a one-line note in the report; go straight to `break-tasks`.\n\nWhatever 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.\n\nThis skill keeps only its own machinery. Depth (events doc only when async; one resource vs full surface) follows the **size matrix** → [`..\u002F_shared\u002Fsize-matrix.md`](..\u002F_shared\u002Fsize-matrix.md).\n\n## Owner\n\nBackend Lead (drives the interface). The PM confirms each endpoint maps to a real user story; a frontend \u002F consumer engineer is the first reader — the contract is locked before they start integration.\n\n## Inputs\n\n- `\u003Cslug>` — same feature slug used by every earlier stage.\n- **Gate (hard-refuse if missing):** `docs\u002Ffeatures\u002F\u003Cslug>\u002FPRD.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 `\u002Fsdlc:write-prd \u003Cslug>` first».\n- **Recommended (presence determines scenario A vs B):**\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002Fdata-model.md` — strongest source of typed fields and constraints. Presence triggers scenario A (typed contract). Absence triggers scenario B (PRD\u002Fsequence-derived contract with `unresolved_origins` block).\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002Fsad.md` §6 — the Mermaid `sequenceDiagram` blocks. Their `alt`\u002F`else` branches become error `responses`; an async participant (`\u003Cmessage-bus>` \u002F `\u003Cexternal-system>`) on a mutating flow marks its endpoint `Idempotency-Key`-required and seeds `events.md`. Absent → note the gap and still generate.\n- **Optional (auto-detected, enrich when present):**\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002Fadr\u002F*.md` — architecture decisions that override defaults (versioning, error format, auth scheme).\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002FCONTEXT.md` — glossary terms become schema names verbatim.\n  - **Existing `contracts\u002Fopenapi.yaml`** — if present, diff and update in place, never overwrite whole-cloth.\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002F.size` — depth hint. Absent → default to M (full surface).\n\nIf any recommended\u002Foptional 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.\n\n## Scenarios A vs B\n\nThe skill detects scenario from inputs and tells the user which one it is running.\n\n### Scenario A — data-model.md exists (preferred)\n\nContract 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)` → `\u003Centity>.duplicate_\u003Cfield>`). `unresolved_origins` is **empty**.\n\nDrift 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.\n\n### Scenario B — data-model.md missing (fallback)\n\nContract 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.\n\n`unresolved_origins` lists every field whose origin is \"inferred from PRD\u002Fsequence, 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`.\n\n### Reconcile (`--reconcile` flag)\n\nWhen `data-model.md` arrives after a scenario-B run, re-run with `--reconcile`. It:\n\n1. Re-reads all inputs.\n2. Switches scenario B → A.\n3. Tightens types: `string` becomes `string` + `maxLength` where DDL exists.\n4. Promotes low-confidence origins to high.\n5. Empties `unresolved_origins`.\n6. Surfaces any field that **had** an inferred origin but **now disagrees** with the model — that is real drift, not stale incompleteness.\n\n`info.version` is never bumped silently; the user bumps semver explicitly with a CHANGELOG line.\n\n## Defaults\n\nFixed minimum, not invented per feature; an `adr\u002F*.md` overrides any of them and the report records \"deviation by ADR-NNNN\". The same defaults are written once into the repo as `.claude\u002Frules\u002Fopenapi.md` (protocol step 2, from [`.\u002Ftemplates\u002Frules-openapi-baseline.md`](.\u002Ftemplates\u002Frules-openapi-baseline.md)) so that the handlers, clients and tests written later follow the contract's conventions, not only the contract itself.\n\n| Topic | Default | Rationale |\n|---|---|---|\n| OpenAPI version | `3.1.0` | JSON Schema 2020-12 reused by JSON validators; native webhooks; `nullable` via `type: [string, null]`. |\n| Error response shape | `{code, message, details?}` snake_case | Homogeneous FE handling; `code` gives machine rule \"retry vs change request\". |\n| Error `code` namespacing | `\u003Cmodule>.\u003Cerror_name>` | `lesson.duplicate_slug`, `lesson.module_not_found` — domain-readable, neutral convention. |\n| Pagination for list endpoints | Cursor (UUID v7), not offset | Stable pages under concurrent writes; stable context for AI consumer. |\n| URL versioning | `\u002Fapi\u002Fv1\u002F...` | Simpler than header versioning; cacheable; version is visible in the path. |\n| Authentication | `BearerAuth` global | Global default; public endpoints declare explicit `security: []`. |\n| Schema reuse | `$ref` mandatory; inline schemas forbidden | Single source of truth per type — less drift between endpoints. |\n| Forbidden | `nullable: true` (3.0 style), real PII in `example`, `additionalProperties: true` on response shapes, `?v=2` query versioning, offset pagination | Well-known anti-patterns. |\n\n## Protocol\n\n1. **Gate + interface kind + read.** `test -f docs\u002Ffeatures\u002F\u003Cslug>\u002FPRD.md` → fail = refuse with the pointer above. **Determine the interface kind — read `sad.md` frontmatter `target_surfaces` FIRST** (architecture-design already declared it; the surface picks the contract form per [`..\u002F_shared\u002Fsurfaces.md`](..\u002F_shared\u002Fsurfaces.md): `backend-service` → OpenAPI \u002F gRPC \u002F events per its sub-kind; `cli` → `contracts\u002Fcli.md`; `worker` → `contracts\u002Fevents.md`; `library-sdk` → `contracts\u002Fpublic-api.md`; a UI surface — `web-frontend` \u002F `mobile-app` \u002F `desktop-app` — *consumes* the backend contract, it does not author one). **Fall back to deriving the kind** from `docs\u002Farchitecture-map.md` + the PRD's capabilities **only if the SAD or the field is absent** (a greenfield run where `architecture-design` was skipped). HTTP\u002FREST → the OpenAPI path below (default); gRPC\u002FCLI\u002Flibrary\u002Fevent-only → produce the matching contract form with this same derive→drift→reconcile loop; **no external interface** (pure internal logic) → skip to `break-tasks` with a one-line note in the report. Then detect scenario (A if `data-model.md` exists, B otherwise). Surface a one-line \"found \u002F missing\" note for sad.md and data-model.md.\n\n2. **Rules bootstrap (HTTP path only).** If `.claude\u002Frules\u002Fopenapi.md` is absent in the repo root, copy [`.\u002Ftemplates\u002Frules-openapi-baseline.md`](.\u002Ftemplates\u002Frules-openapi-baseline.md) → `.claude\u002Frules\u002Fopenapi.md` and tell the user «I wrote a baseline API rules file; edit it if your team disagrees with any default.» Reporting this bootstrap is mandatory (same mechanism as `generate-data-model` → `.claude\u002Frules\u002Fmigrations.md`). If the file already exists, read it — a team edit there overrides the Defaults table below the same way an ADR does, and the report records the deviation. Skip this step for CLI \u002F library \u002F event-only surfaces.\n\n3. **Copy the template.** [`.\u002Ftemplates\u002Fopenapi.yaml`](.\u002Ftemplates\u002Fopenapi.yaml) → `docs\u002Ffeatures\u002F\u003Cslug>\u002Fcontracts\u002Fopenapi.yaml`. If async flows exist, also [`.\u002Ftemplates\u002Fevents.md`](.\u002Ftemplates\u002Fevents.md) → `contracts\u002Fevents.md`. If CLI surface, [`.\u002Ftemplates\u002Fcli.md`](.\u002Ftemplates\u002Fcli.md) → `contracts\u002Fcli.md`. If library-sdk surface, [`.\u002Ftemplates\u002Fpublic-api.md`](.\u002Ftemplates\u002Fpublic-api.md) → `contracts\u002Fpublic-api.md`. Fill `info.description` from PRD §1 (why this API exists).\n\n4. **Derive endpoints + schemas.** One endpoint (or more) per PRD §4 user story. In scenario A, every request\u002Fresponse field traces to a `data-model.md` entity column — copy its constraints across (`maxLength`\u002F`pattern`\u002F`enum` from the model's bounded types). In scenario B, schemas are derived from PRD field names + sequence message names; `unresolved_origins` is populated. **Never invent a field with no origin in any input** — ask the user where it comes from. `$ref` every shared schema; no inline duplication. Lists paginate by cursor (`?after=&before=&limit=`), wrapped in `{items, has_next, has_prev, next_cursor}`.\n\n5. **Derive error responses from the sequences.** Each endpoint covered by a §6 flow: turn every `alt … else … end` branch into a `responses` entry. The error body is the unified envelope **`{code, message, details?}`**; `code` follows the **neutral** convention `module.error_name` (snake_case, e.g. `lesson.not_owned`, `lesson.invalid_state`). Map status by class (4xx client \u002F 5xx server). This closes the PRD's usual blind spot — PRD lists the happy path + a couple of errors; the sequences enumerate the authorization and concurrent-state branches the PRD omits.\n\n6. **Async + idempotency.** A mutating endpoint whose §6 flow shows a retry note or an async actor is marked `Idempotency-Key`-required (state the TTL). For each async message, fill an `events.md` entry: event name `module.action.vN`, payload schema, producer, consumers, retry \u002F dead-letter behaviour.\n\n7. **Examples + placeholder data.** Every operation carries a request example + a success example + an error example, using placeholder values only (`\u003C...>@example.test`, `+380 00 000 00 00`, `Test User`) — never real PII.\n\n8. **Inline DRIFT CHECK (bidirectional) + write the report.** Compare the generated contract against the read artifacts and write `docs\u002Ffeatures\u002F\u003Cslug>\u002Fcontracts\u002Fapi-sync-report.md` — see [`.\u002Freferences\u002Fdrift-check.md`](.\u002Freferences\u002Fdrift-check.md). It opens with a **`**Verdict:**` line** (`PASS` | `PASS (with deferrals)` | `FAIL`, rules in the reference), then holds a field-origins table (one row per `operation.field`: `path | origin | confidence`), the **5-point drift checklist**, `unresolved_origins`, and a `Deferrals` list. Each point is marked ✓, ✓ (deferred: one line) or ✗ (one-line diagnostic). The check runs **both directions**:\n   - **forward** (contract derived correctly) — points 1–3, *core*: endpoint↔model, error-code↔repo, validation↔constraint.\n   - **back-feed (coverage cross-check)** — points 4–5, *supporting*: **4** every `data-model.md` entity is surfaced by ≥1 operation or marked intentionally internal, every PRD §5 AC maps to ≥1 operation\u002Fresponse, every operation maps to a §4 user story + ≥1 AC; **5** OpenAPI↔sequence — every `sad.md` §6 `alt`-branch has a response, and any error\u002Fauthorization response the contract needs but no §6 flow shows is a **sequence gap**. A gap here is not an api bug — it's a hole upstream: surface it and offer **Fix-the-source-first**, which re-opens `write-prd` (add the missing AC) or `complete-sequence-diagrams` (draw the missing branch) before the contract is finalized.\n   A **core** finding failing (or ≥3 flags total) pauses the run — resolve each via the 4-state actions: Accept-as-is \u002F Fix-the-contract \u002F Save-as-OQ \u002F Fix-the-source-first. Never silently edit the sources — surface the mismatch and let the human pick the right artifact (the contract, the PRD's AC, or the sequence). Then set the verdict from what is left: all 5 ✓ and nothing parked → `PASS`; core 1–3 ✓ but something consciously parked (scenario B, a deferred supporting point, a Save-as-OQ, a sequence gap) → `PASS (with deferrals)`; a core point still ✗, ≥3 open flags, or a field with no origin → `FAIL`. **The report is written on every run, FAIL included** — a FAIL that lives only in the chat is lost by the next `\u002Fclear`.\n\n9. **Lint + write + commit.** Suggest `spectral lint contracts\u002Fopenapi.yaml` (add it to the project's check target if not yet wired). Write the files, propose commit `api: \u003Cslug> contract`. Then **emit the stage-handoff block** per [`..\u002F_shared\u002Fhandoff.md`](..\u002F_shared\u002Fhandoff.md) — *What I did* (incl. the verdict and whether `.claude\u002Frules\u002Fopenapi.md` was bootstrapped) + *Review* (`contracts\u002Fopenapi.yaml`, `api-sync-report.md`, + `events.md` if async, + `cli.md` if CLI, + `public-api.md` if library) + *Run next*: on `PASS` \u002F `PASS (with deferrals)` → `\u002Fclear`, then `\u002Fsdlc:break-tasks \u003Cslug>`; on `FAIL` → the fix-the-source command the report names (`\u002Fsdlc:write-prd`, `\u002Fsdlc:complete-sequence-diagrams` or `\u002Fsdlc:generate-data-model \u003Cslug>`), then `\u002Fsdlc:api-forge \u003Cslug> --reconcile`. A `FAIL` never hands off to `break-tasks`.\n\n### Reconcile mode\n\n`\u002Fsdlc:api-forge \u003Cslug> --reconcile`. Re-derives after an upstream artifact changed (typically `data-model.md` arrived or was tightened after a thinner first pass). It re-reads inputs, tightens loose types where the model now has a constraint, refreshes the field-origins confidence column, and — the load-bearing part — surfaces any field that **had** an inferred origin but **now disagrees** with the model. That disagreement is real drift, not stale incompleteness.\n\n## Definition of Done\n\n- `docs\u002Ffeatures\u002F\u003Cslug>\u002Fcontracts\u002Fopenapi.yaml` written: OpenAPI 3.1, `BearerAuth` global with public endpoints declaring explicit `security: []`, every error response the `{code, message, details?}` envelope, every operation with examples, all shared types via `$ref`.\n- `api-sync-report.md` written alongside: `**Verdict:**` line first, field-origins table, the 5-point drift checklist (1–3 core, 4–5 supporting), scenario recorded, every core finding ✓ or explicitly resolved, `unresolved_origins` empty (A) or listed (B), `Deferrals` listed with a next step (or \"none\").\n- Verdict is `PASS` or `PASS (with deferrals)`. A `FAIL` report is a valid artifact but the stage is **not done** — the report names what to fix and the run is repeated with `--reconcile`.\n- On the HTTP path, `.claude\u002Frules\u002Fopenapi.md` exists in the repo root (bootstrapped from the baseline on first run and reported, or already there and read).\n- Every endpoint maps to a PRD §4 user story; every field traces to a `data-model.md` column (scenario A) or has an explicit inferred origin noted (scenario B); every error `code` exists in the repo's error definitions.\n- `contracts\u002Fevents.md` present iff the feature has async flows; each event has a payload schema, producer, consumers, retry \u002F DLQ note.\n- `contracts\u002Fcli.md` present iff the surface is `cli`; `contracts\u002Fpublic-api.md` present iff the surface is `library-sdk`.\n\n## Conflicts — human in the loop\n\n| Conflict | Skill action |\n|---|---|\n| Field in `data-model.md` with no story in PRD covering it | Add it to the schema with a `# unused-in-prd` note in the report; ask the user. |\n| A §6 sequence references a flow that maps to no endpoint | Flag `# orphan-sequence` in the report; ask (forgotten endpoint? internal job?). |\n| PRD §5 constraint contradicts a `data-model.md` constraint | Take the stricter value; flag both; the human resolves which artifact is wrong. |\n| Existing `openapi.yaml` has a field absent from every source | Keep it with a `# manual-addition` note; flag in the report. |\n| A field disappeared from `data-model.md` | Keep it in the YAML with a `# stale` note; surface it — the human removes from the contract or restores in the model. |\n\nIf ≥3 flags appear in one run, pause, list them, and ask whether to continue or fix the sources first.\n\n## Anti-patterns\n\n- **Contract written by hand**, then the model\u002Fsequences bent to fit it. The arrow is one-way: model + sequences + PRD → contract.\n- **Skipping the drift check** because \"it was just generated, of course it matches\". Generation can match the PRD-as-read while diverging from the model or the sequences — different files, different authors. A clean 5\u002F5 ✓ is cheap; a silent ✗ in prod is not.\n- **Writing `PASS` over an open finding.** A core ✗ that was not resolved through the 4-state actions is a `FAIL`; a parked item without a `Deferrals` entry is a hidden deferral. The verdict is derived from the checklist, never typed from a feeling.\n- **Bootstrapping `.claude\u002Frules\u002Fopenapi.md` and forgetting to tell the user.** Report it when it happens — the user owns that file from then on.\n- **Error responses from the PRD only.** PRD lists happy + a couple of errors; the §6 sequences hold the authorization and concurrent-state branches. Skipping them leaves blind spots.\n- **Inventing a field** with no origin in any input, or **silently dropping** one that left `data-model.md` (keep it with a `# stale` note and surface it — the human decides).\n- **Stack-specific schema or error names.** Schemas use the domain language from `data-model.md`; error codes are the neutral `module.error_name` convention — not a Go\u002FTS\u002FPython idiom and not tied to any driver's error type.\n- **Free-text errors** (`{\"error\": \"failed\"}`), `?v=2` query versioning, `nullable: true` (3.0 style — use `type: [string, null]`), offset pagination, or real PII in examples.\n- **Re-deriving the interface kind when `architecture-design` already declared it.** `target_surfaces` in `sad.md` is the primary signal — read it; the architecture-map derivation is the **fallback only** when the SAD\u002Ffield is absent. Silently re-inferring HTTP-vs-events on every run is the double-derivation this skill's surface-awareness removes.\n- **Hiding scenario B as if it were complete.** Scenario B is a valid state, not a half-baked one. `unresolved_origins` must be visible. Pretending the contract is fully typed when it isn't sets the team up for silent drift when the model arrives.\n\n## Sources of best practices\n\n- **Microsoft REST API Guidelines** — https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fapi-guidelines. Error shape with machine-readable `code`, URL versioning, `BearerAuth` default.\n- **Google AIP (API Improvement Proposals)** — https:\u002F\u002Fgoogle.aip.dev\u002F. Resource-oriented paths, snake_case field names, domain-namespaced error codes.\n- **Zalando RESTful API Guidelines** — https:\u002F\u002Fopensource.zalando.com\u002Frestful-api-guidelines\u002F. Cursor pagination via next-link, JSON-only responses, snake_case JSON.\n- **OpenAPI 3.1 specification** — https:\u002F\u002Fspec.openapis.org\u002Foas\u002Fv3.1.0. Full JSON Schema 2020-12 compatibility.\n\n## References & templates\n\n- [`..\u002F_shared\u002Fsurfaces.md`](..\u002F_shared\u002Fsurfaces.md) — the declared `target_surfaces` (read from `sad.md`) pick the contract form; this skill reads, never re-derives.\n- [`..\u002F_shared\u002Fsize-matrix.md`](..\u002F_shared\u002Fsize-matrix.md) — MVP (one resource, events only if async) vs Full surface depth.\n- [`..\u002F_shared\u002Fhandoff.md`](..\u002F_shared\u002Fhandoff.md) — stage-handoff block format.\n- [`.\u002Freferences\u002Fdrift-check.md`](.\u002Freferences\u002Fdrift-check.md) — report shape: verdict rules, field-origins table, 5-point drift checklist, deferrals, reconcile semantics, conflict table.\n- [`.\u002Ftemplates\u002Frules-openapi-baseline.md`](.\u002Ftemplates\u002Frules-openapi-baseline.md) — baseline `.claude\u002Frules\u002Fopenapi.md` copied at step 2 when missing (HTTP path).\n- [`.\u002Ftemplates\u002Fopenapi.yaml`](.\u002Ftemplates\u002Fopenapi.yaml) — OpenAPI 3.1 scaffold: `BearerAuth`, cursor page wrapper, `{code, message, details?}` Error schema.\n- [`.\u002Ftemplates\u002Fevents.md`](.\u002Ftemplates\u002Fevents.md) — async event-contract scaffold (producer \u002F consumers \u002F payload \u002F retry \u002F DLQ).\n- [`.\u002Ftemplates\u002Fcli.md`](.\u002Ftemplates\u002Fcli.md) — CLI surface contract scaffold (commands \u002F flags \u002F exit codes).\n- [`.\u002Ftemplates\u002Fpublic-api.md`](.\u002Ftemplates\u002Fpublic-api.md) — library\u002FSDK public-API contract scaffold (public signatures \u002F types).\n","# Skill: api-forge\n\nProjects the upstream artifacts into one **interface contract**. By default that's an HTTP\u002FOpenAPI 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** (→ [`..\u002F_shared\u002Fsurfaces.md`](..\u002F_shared\u002Fsurfaces.md)). For a non-HTTP project it produces the matching contract form:\n\n- **HTTP \u002F REST** (default) → `contracts\u002Fopenapi.yaml` (OpenAPI 3.1) + `api-sync-report.md`.\n- **gRPC \u002F RPC** → a `.proto` (or the repo's IDL) with the same derive-and-drift discipline.\n- **CLI** → `contracts\u002Fcli.md` — the command\u002Fflag\u002Fexit-code surface derived from the AC.\n- **Library \u002F SDK** → `contracts\u002Fpublic-api.md` — the public signatures\u002Ftypes the feature exposes.\n- **Event-only \u002F worker** → just `contracts\u002Fevents.md` (no request\u002Fresponse surface).\n- **No external interface** (pure internal logic) → **skip** with a one-line note in the report; go straight to `break-tasks`.\n\nWhatever 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.\n\nThis skill keeps only its own machinery. Depth (events doc only when async; one resource vs full surface) follows the **size matrix** → [`..\u002F_shared\u002Fsize-matrix.md`](..\u002F_shared\u002Fsize-matrix.md).\n\n## Owner\n\nBackend Lead (drives the interface). The PM confirms each endpoint maps to a real user story; a frontend \u002F consumer engineer is the first reader — the contract is locked before they start integration.\n\n## Inputs\n\n- `\u003Cslug>` — same feature slug used by every earlier stage.\n- **Gate (hard-refuse if missing):** `docs\u002Ffeatures\u002F\u003Cslug>\u002FPRD.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 `\u002Fsdlc:write-prd \u003Cslug>` first».\n- **Recommended (presence determines scenario A vs B):**\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002Fdata-model.md` — strongest source of typed fields and constraints. Presence triggers scenario A (typed contract). Absence triggers scenario B (PRD\u002Fsequence-derived contract with `unresolved_origins` block).\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002Fsad.md` §6 — the Mermaid `sequenceDiagram` blocks. Their `alt`\u002F`else` branches become error `responses`; an async participant (`\u003Cmessage-bus>` \u002F `\u003Cexternal-system>`) on a mutating flow marks its endpoint `Idempotency-Key`-required and seeds `events.md`. Absent → note the gap and still generate.\n- **Optional (auto-detected, enrich when present):**\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002Fadr\u002F*.md` — architecture decisions that override defaults (versioning, error format, auth scheme).\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002FCONTEXT.md` — glossary terms become schema names verbatim.\n  - **Existing `contracts\u002Fopenapi.yaml`** — if present, diff and update in place, never overwrite whole-cloth.\n  - `docs\u002Ffeatures\u002F\u003Cslug>\u002F.size` — depth hint. Absent → default to M (full surface).\n\nIf any recommended\u002Foptional 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.\n\n## Scenarios A vs B\n\nThe skill detects scenario from inputs and tells the user which one it is running.\n\n### Scenario A — data-model.md exists (preferred)\n\nContract 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)` → `\u003Centity>.duplicate_\u003Cfield>`). `unresolved_origins` is **empty**.\n\nDrift 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.\n\n### Scenario B — data-model.md missing (fallback)\n\nContract 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.\n\n`unresolved_origins` lists every field whose origin is \"inferred from PRD\u002Fsequence, 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`.\n\n### Reconcile (`--reconcile` flag)\n\nWhen `data-model.md` arrives after a scenario-B run, re-run with `--reconcile`. It:\n\n1. Re-reads all inputs.\n2. Switches scenario B → A.\n3. Tightens types: `string` becomes `string` + `maxLength` where DDL exists.\n4. Promotes low-confidence origins to high.\n5. Empties `unresolved_origins`.\n6. Surfaces any field that **had** an inferred origin but **now disagrees** with the model — that is real drift, not stale incompleteness.\n\n`info.version` is never bumped silently; the user bumps semver explicitly with a CHANGELOG line.\n\n## Defaults\n\nFixed minimum, not invented per feature; an `adr\u002F*.md` overrides any of them and the report records \"deviation by ADR-NNNN\". The same defaults are written once into the repo as `.claude\u002Frules\u002Fopenapi.md` (protocol step 2, from [`.\u002Ftemplates\u002Frules-openapi-baseline.md`](.\u002Ftemplates\u002Frules-openapi-baseline.md)) so that the handlers, clients and tests written later follow the contract's conventions, not only the contract itself.\n\n| Topic | Default | Rationale |\n|---|---|---|\n| OpenAPI version | `3.1.0` | JSON Schema 2020-12 reused by JSON validators; native webhooks; `nullable` via `type: [string, null]`. |\n| Error response shape | `{code, message, details?}` snake_case | Homogeneous FE handling; `code` gives machine rule \"retry vs change request\". |\n| Error `code` namespacing | `\u003Cmodule>.\u003Cerror_name>` | `lesson.duplicate_slug`, `lesson.module_not_found` — domain-readable, neutral convention. |\n| Pagination for list endpoints | Cursor (UUID v7), not offset | Stable pages under concurrent writes; stable context for AI consumer. |\n| URL versioning | `\u002Fapi\u002Fv1\u002F...` | Simpler than header versioning; cacheable; version is visible in the path. |\n| Authentication | `BearerAuth` global | Global default; public endpoints declare explicit `security: []`. |\n| Schema reuse | `$ref` mandatory; inline schemas forbidden | Single source of truth per type — less drift between endpoints. |\n| Forbidden | `nullable: true` (3.0 style), real PII in `example`, `additionalProperties: true` on response shapes, `?v=2` query versioning, offset pagination | Well-known anti-patterns. |\n\n## Protocol\n\n1. **Gate + interface kind + read.** `test -f docs\u002Ffeatures\u002F\u003Cslug>\u002FPRD.md` → fail = refuse with the pointer above. **Determine the interface kind — read `sad.md` frontmatter `target_surfaces` FIRST** (architecture-design already declared it; the surface picks the contract form per [`..\u002F_shared\u002Fsurfaces.md`](..\u002F_shared\u002Fsurfaces.md): `backend-service` → OpenAPI \u002F gRPC \u002F events per its sub-kind; `cli` → `contracts\u002Fcli.md`; `worker` → `contracts\u002Fevents.md`; `library-sdk` → `contracts\u002Fpublic-api.md`; a UI surface — `web-frontend` \u002F `mobile-app` \u002F `desktop-app` — *consumes* the backend contract, it does not author one). **Fall back to deriving the kind** from `docs\u002Farchitecture-map.md` + the PRD's capabilities **only if the SAD or the field is absent** (a greenfield run where `architecture-design` was skipped). HTTP\u002FREST → the OpenAPI path below (default); gRPC\u002FCLI\u002Flibrary\u002Fevent-only → produce the matching contract form with this same derive→drift→reconcile loop; **no external interface** (pure internal logic) → skip to `break-tasks` with a one-line note in the report. Then detect scenario (A if `data-model.md` exists, B otherwise). Surface a one-line \"found \u002F missing\" note for sad.md and data-model.md.\n\n2. **Rules bootstrap (HTTP path only).** If `.claude\u002Frules\u002Fopenapi.md` is absent in the repo root, copy [`.\u002Ftemplates\u002Frules-openapi-baseline.md`](.\u002Ftemplates\u002Frules-openapi-baseline.md) → `.claude\u002Frules\u002Fopenapi.md` and tell the user «I wrote a baseline API rules file; edit it if your team disagrees with any default.» Reporting this bootstrap is mandatory (same mechanism as `generate-data-model` → `.claude\u002Frules\u002Fmigrations.md`). If the file already exists, read it — a team edit there overrides the Defaults table below the same way an ADR does, and the report records the deviation. Skip this step for CLI \u002F library \u002F event-only surfaces.\n\n3. **Copy the template.** [`.\u002Ftemplates\u002Fopenapi.yaml`](.\u002Ftemplates\u002Fopenapi.yaml) → `docs\u002Ffeatures\u002F\u003Cslug>\u002Fcontracts\u002Fopenapi.yaml`. If async flows exist, also [`.\u002Ftemplates\u002Fevents.md`](.\u002Ftemplates\u002Fevents.md) → `contracts\u002Fevents.md`. If CLI surface, [`.\u002Ftemplates\u002Fcli.md`](.\u002Ftemplates\u002Fcli.md) → `contracts\u002Fcli.md`. If library-sdk surface, [`.\u002Ftemplates\u002Fpublic-api.md`](.\u002Ftemplates\u002Fpublic-api.md) → `contracts\u002Fpublic-api.md`. Fill `info.description` from PRD §1 (why this API exists).\n\n4. **Derive endpoints + schemas.** One endpoint (or more) per PRD §4 user story. In scenario A, every request\u002Fresponse field traces to a `data-model.md` entity column — copy its constraints across (`maxLength`\u002F`pattern`\u002F`enum` from the model's bounded types). In scenario B, schemas are derived from PRD field names + sequence message names; `unresolved_origins` is populated. **Never invent a field with no origin in any input** — ask the user where it comes from. `$ref` every shared schema; no inline duplication. Lists paginate by cursor (`?after=&before=&limit=`), wrapped in `{items, has_next, has_prev, next_cursor}`.\n\n5. **Derive error responses from the sequences.** Each endpoint covered by a §6 flow: turn every `alt … else … end` branch into a `responses` entry. The error body is the unified envelope **`{code, message, details?}`**; `code` follows the **neutral** convention `module.error_name` (snake_case, e.g. `lesson.not_owned`, `lesson.invalid_state`). Map status by class (4xx client \u002F 5xx server). This closes the PRD's usual blind spot — PRD lists the happy path + a couple of errors; the sequences enumerate the authorization and concurrent-state branches the PRD omits.\n\n6. **Async + idempotency.** A mutating endpoint whose §6 flow shows a retry note or an async actor is marked `Idempotency-Key`-required (state the TTL). For each async message, fill an `events.md` entry: event name `module.action.vN`, payload schema, producer, consumers, retry \u002F dead-letter behaviour.\n\n7. **Examples + placeholder data.** Every operation carries a request example + a success example + an error example, using placeholder values only (`\u003C...>@example.test`, `+380 00 000 00 00`, `Test User`) — never real PII.\n\n8. **Inline DRIFT CHECK (bidirectional) + write the report.** Compare the generated contract against the read artifacts and write `docs\u002Ffeatures\u002F\u003Cslug>\u002Fcontracts\u002Fapi-sync-report.md` — see [`.\u002Freferences\u002Fdrift-check.md`](.\u002Freferences\u002Fdrift-check.md). It opens with a **`**Verdict:**` line** (`PASS` | `PASS (with deferrals)` | `FAIL`, rules in the reference), then holds a field-origins table (one row per `operation.field`: `path | origin | confidence`), the **5-point drift checklist**, `unresolved_origins`, and a `Deferrals` list. Each point is marked ✓, ✓ (deferred: one line) or ✗ (one-line diagnostic). The check runs **both directions**:\n   - **forward** (contract derived correctly) — points 1–3, *core*: endpoint↔model, error-code↔repo, validation↔constraint.\n   - **back-feed (coverage cross-check)** — points 4–5, *supporting*: **4** every `data-model.md` entity is surfaced by ≥1 operation or marked intentionally internal, every PRD §5 AC maps to ≥1 operation\u002Fresponse, every operation maps to a §4 user story + ≥1 AC; **5** OpenAPI↔sequence — every `sad.md` §6 `alt`-branch has a response, and any error\u002Fauthorization response the contract needs but no §6 flow shows is a **sequence gap**. A gap here is not an api bug — it's a hole upstream: surface it and offer **Fix-the-source-first**, which re-opens `write-prd` (add the missing AC) or `complete-sequence-diagrams` (draw the missing branch) before the contract is finalized.\n   A **core** finding failing (or ≥3 flags total) pauses the run — resolve each via the 4-state actions: Accept-as-is \u002F Fix-the-contract \u002F Save-as-OQ \u002F Fix-the-source-first. Never silently edit the sources — surface the mismatch and let the human pick the right artifact (the contract, the PRD's AC, or the sequence). Then set the verdict from what is left: all 5 ✓ and nothing parked → `PASS`; core 1–3 ✓ but something consciously parked (scenario B, a deferred supporting point, a Save-as-OQ, a sequence gap) → `PASS (with deferrals)`; a core point still ✗, ≥3 open flags, or a field with no origin → `FAIL`. **The report is written on every run, FAIL included** — a FAIL that lives only in the chat is lost by the next `\u002Fclear`.\n\n9. **Lint + write + commit.** Suggest `spectral lint contracts\u002Fopenapi.yaml` (add it to the project's check target if not yet wired). Write the files, propose commit `api: \u003Cslug> contract`. Then **emit the stage-handoff block** per [`..\u002F_shared\u002Fhandoff.md`](..\u002F_shared\u002Fhandoff.md) — *What I did* (incl. the verdict and whether `.claude\u002Frules\u002Fopenapi.md` was bootstrapped) + *Review* (`contracts\u002Fopenapi.yaml`, `api-sync-report.md`, + `events.md` if async, + `cli.md` if CLI, + `public-api.md` if library) + *Run next*: on `PASS` \u002F `PASS (with deferrals)` → `\u002Fclear`, then `\u002Fsdlc:break-tasks \u003Cslug>`; on `FAIL` → the fix-the-source command the report names (`\u002Fsdlc:write-prd`, `\u002Fsdlc:complete-sequence-diagrams` or `\u002Fsdlc:generate-data-model \u003Cslug>`), then `\u002Fsdlc:api-forge \u003Cslug> --reconcile`. A `FAIL` never hands off to `break-tasks`.\n\n### Reconcile mode\n\n`\u002Fsdlc:api-forge \u003Cslug> --reconcile`. Re-derives after an upstream artifact changed (typically `data-model.md` arrived or was tightened after a thinner first pass). It re-reads inputs, tightens loose types where the model now has a constraint, refreshes the field-origins confidence column, and — the load-bearing part — surfaces any field that **had** an inferred origin but **now disagrees** with the model. That disagreement is real drift, not stale incompleteness.\n\n## Definition of Done\n\n- `docs\u002Ffeatures\u002F\u003Cslug>\u002Fcontracts\u002Fopenapi.yaml` written: OpenAPI 3.1, `BearerAuth` global with public endpoints declaring explicit `security: []`, every error response the `{code, message, details?}` envelope, every operation with examples, all shared types via `$ref`.\n- `api-sync-report.md` written alongside: `**Verdict:**` line first, field-origins table, the 5-point drift checklist (1–3 core, 4–5 supporting), scenario recorded, every core finding ✓ or explicitly resolved, `unresolved_origins` empty (A) or listed (B), `Deferrals` listed with a next step (or \"none\").\n- Verdict is `PASS` or `PASS (with deferrals)`. A `FAIL` report is a valid artifact but the stage is **not done** — the report names what to fix and the run is repeated with `--reconcile`.\n- On the HTTP path, `.claude\u002Frules\u002Fopenapi.md` exists in the repo root (bootstrapped from the baseline on first run and reported, or already there and read).\n- Every endpoint maps to a PRD §4 user story; every field traces to a `data-model.md` column (scenario A) or has an explicit inferred origin noted (scenario B); every error `code` exists in the repo's error definitions.\n- `contracts\u002Fevents.md` present iff the feature has async flows; each event has a payload schema, producer, consumers, retry \u002F DLQ note.\n- `contracts\u002Fcli.md` present iff the surface is `cli`; `contracts\u002Fpublic-api.md` present iff the surface is `library-sdk`.\n\n## Conflicts — human in the loop\n\n| Conflict | Skill action |\n|---|---|\n| Field in `data-model.md` with no story in PRD covering it | Add it to the schema with a `# unused-in-prd` note in the report; ask the user. |\n| A §6 sequence references a flow that maps to no endpoint | Flag `# orphan-sequence` in the report; ask (forgotten endpoint? internal job?). |\n| PRD §5 constraint contradicts a `data-model.md` constraint | Take the stricter value; flag both; the human resolves which artifact is wrong. |\n| Existing `openapi.yaml` has a field absent from every source | Keep it with a `# manual-addition` note; flag in the report. |\n| A field disappeared from `data-model.md` | Keep it in the YAML with a `# stale` note; surface it — the human removes from the contract or restores in the model. |\n\nIf ≥3 flags appear in one run, pause, list them, and ask whether to continue or fix the sources first.\n\n## Anti-patterns\n\n- **Contract written by hand**, then the model\u002Fsequences bent to fit it. The arrow is one-way: model + sequences + PRD → contract.\n- **Skipping the drift check** because \"it was just generated, of course it matches\". Generation can match the PRD-as-read while diverging from the model or the sequences — different files, different authors. A clean 5\u002F5 ✓ is cheap; a silent ✗ in prod is not.\n- **Writing `PASS` over an open finding.** A core ✗ that was not resolved through the 4-state actions is a `FAIL`; a parked item without a `Deferrals` entry is a hidden deferral. The verdict is derived from the checklist, never typed from a feeling.\n- **Bootstrapping `.claude\u002Frules\u002Fopenapi.md` and forgetting to tell the user.** Report it when it happens — the user owns that file from then on.\n- **Error responses from the PRD only.** PRD lists happy + a couple of errors; the §6 sequences hold the authorization and concurrent-state branches. Skipping them leaves blind spots.\n- **Inventing a field** with no origin in any input, or **silently dropping** one that left `data-model.md` (keep it with a `# stale` note and surface it — the human decides).\n- **Stack-specific schema or error names.** Schemas use the domain language from `data-model.md`; error codes are the neutral `module.error_name` convention — not a Go\u002FTS\u002FPython idiom and not tied to any driver's error type.\n- **Free-text errors** (`{\"error\": \"failed\"}`), `?v=2` query versioning, `nullable: true` (3.0 style — use `type: [string, null]`), offset pagination, or real PII in examples.\n- **Re-deriving the interface kind when `architecture-design` already declared it.** `target_surfaces` in `sad.md` is the primary signal — read it; the architecture-map derivation is the **fallback only** when the SAD\u002Ffield is absent. Silently re-inferring HTTP-vs-events on every run is the double-derivation this skill's surface-awareness removes.\n- **Hiding scenario B as if it were complete.** Scenario B is a valid state, not a half-baked one. `unresolved_origins` must be visible. Pretending the contract is fully typed when it isn't sets the team up for silent drift when the model arrives.\n\n## Sources of best practices\n\n- **Microsoft REST API Guidelines** — https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fapi-guidelines. Error shape with machine-readable `code`, URL versioning, `BearerAuth` default.\n- **Google AIP (API Improvement Proposals)** — https:\u002F\u002Fgoogle.aip.dev\u002F. Resource-oriented paths, snake_case field names, domain-namespaced error codes.\n- **Zalando RESTful API Guidelines** — https:\u002F\u002Fopensource.zalando.com\u002Frestful-api-guidelines\u002F. Cursor pagination via next-link, JSON-only responses, snake_case JSON.\n- **OpenAPI 3.1 specification** — https:\u002F\u002Fspec.openapis.org\u002Foas\u002Fv3.1.0. Full JSON Schema 2020-12 compatibility.\n\n## References & templates\n\n- [`..\u002F_shared\u002Fsurfaces.md`](..\u002F_shared\u002Fsurfaces.md) — the declared `target_surfaces` (read from `sad.md`) pick the contract form; this skill reads, never re-derives.\n- [`..\u002F_shared\u002Fsize-matrix.md`](..\u002F_shared\u002Fsize-matrix.md) — MVP (one resource, events only if async) vs Full surface depth.\n- [`..\u002F_shared\u002Fhandoff.md`](..\u002F_shared\u002Fhandoff.md) — stage-handoff block format.\n- [`.\u002Freferences\u002Fdrift-check.md`](.\u002Freferences\u002Fdrift-check.md) — report shape: verdict rules, field-origins table, 5-point drift checklist, deferrals, reconcile semantics, conflict table.\n- [`.\u002Ftemplates\u002Frules-openapi-baseline.md`](.\u002Ftemplates\u002Frules-openapi-baseline.md) — baseline `.claude\u002Frules\u002Fopenapi.md` copied at step 2 when missing (HTTP path).\n- [`.\u002Ftemplates\u002Fopenapi.yaml`](.\u002Ftemplates\u002Fopenapi.yaml) — OpenAPI 3.1 scaffold: `BearerAuth`, cursor page wrapper, `{code, message, details?}` Error schema.\n- [`.\u002Ftemplates\u002Fevents.md`](.\u002Ftemplates\u002Fevents.md) — async event-contract scaffold (producer \u002F consumers \u002F payload \u002F retry \u002F DLQ).\n- [`.\u002Ftemplates\u002Fcli.md`](.\u002Ftemplates\u002Fcli.md) — CLI surface contract scaffold (commands \u002F flags \u002F exit codes).\n- [`.\u002Ftemplates\u002Fpublic-api.md`](.\u002Ftemplates\u002Fpublic-api.md) — library\u002FSDK public-API contract scaffold (public signatures \u002F types).\n",{"name":5,"stage":24,"triggers":25,"description":27},"10",[26],"\u002Fsdlc:api-forge","Use to derive the API contract for a feature — an OpenAPI 3.1 document at docs\u002Ffeatures\u002F{slug}\u002Fcontracts\u002Fopenapi.yaml plus a drift\u002Fsync 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\u002FSDK), and — on the HTTP path, first run only — a baseline .claude\u002Frules\u002Fopenapi.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}\", \"\u002Fsdlc: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\u002Ffeatures\u002F{slug}\u002FPRD.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.\n","main","2dc9bdfa5d508a04d414fb0991617e6722ec635a","modules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge",13,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public","https:\u002F\u002Ft.me\u002Fgenkovich","https:\u002F\u002Fgithub.com\u002Fgenkovich","https:\u002F\u002Ft.me\u002Fbeerphp","Beer::PHP 🍺 telegram-channel author \r\n","2026-11-12 03:03:13",{"source":8,"skillName":5,"commands":39,"prompt":49,"zipAvailable":50},[40,43,46],{"tool":41,"command":42},"npx","npx skills add genkovich\u002Fagentic-engineering-course-public --skill api-forge",{"tool":44,"command":45},"bunx","bunx skills add genkovich\u002Fagentic-engineering-course-public --skill api-forge",{"tool":47,"command":48},"pnpm","pnpm dlx skills add genkovich\u002Fagentic-engineering-course-public --skill api-forge","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002FSKILL.md",true,[52,58,62,66,70,74],{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fdrift-check.md","REFERENCE","参考文档",12296,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002Freferences\u002Fdrift-check.md",{"path":59,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":60,"sourceHtmlUrl":61},"templates\u002Fcli.md",2796,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002Ftemplates\u002Fcli.md",{"path":63,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":64,"sourceHtmlUrl":65},"templates\u002Fevents.md",2427,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002Ftemplates\u002Fevents.md",{"path":67,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":68,"sourceHtmlUrl":69},"templates\u002Fopenapi.yaml",5654,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002Ftemplates\u002Fopenapi.yaml",{"path":71,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":72,"sourceHtmlUrl":73},"templates\u002Fpublic-api.md",2966,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002Ftemplates\u002Fpublic-api.md",{"path":75,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":76,"sourceHtmlUrl":77},"templates\u002Frules-openapi-baseline.md",2781,"https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F6-sdlc\u002Fsdlc\u002Fplugin\u002Fskills\u002Fapi-forge\u002Ftemplates\u002Frules-openapi-baseline.md",[79,87,94,101,108,115],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":86},"01M72YGBW5JKECT8WSRHK1YBCJ","release","Run the whole local release pipeline in order, stopping at each human gate. Triggers on \"run the release\", \"prepare a release\", \"\u002Frelease\", \"зроби реліз\", \"підготуй реліз\". Drives the four stages back to back — bump-version → curate-changelog → release-notes → check-docs-drift — pausing after each so the human reviews the diff before the next stage. Prepares everything in the working tree; never tags, commits, or pushes. The tag push (which fires CI) stays the human's action.","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F9-collaboration\u002F9.7-release-docs\u002F.claude\u002Fskills\u002Frelease\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":86},"01M72YG87VQ89PRCYQSMNAP5RW","release-notes","Draft partner-facing release notes from the same commits as the changelog. Triggers on \"draft release notes\", \"release notes for the next version\", \"\u002Frelease-notes\", \"нотатки релізу\", \"release notes партнеру\". Same input as curate-changelog, different audience and tone: a short, benefit-first narrative for a user or partner — \"what's new for you\" — not a categorized engineer's list. Keeps only changes a user actually notices; drops internal refactors and tooling. Prints the notes to the chat to seed a GitHub Release description or a partner announcement. Writes no file.","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F9-collaboration\u002F9.7-release-docs\u002F.claude\u002Fskills\u002Frelease-notes\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":86},"01M72YG4BXJH9R6QQZD3G8E358","curate-changelog","Curate the [Unreleased] section of docs\u002FCHANGELOG.md from git history. Triggers on \"curate the changelog\", \"update the changelog\", \"\u002Fcurate-changelog\", \"онови changelog\", \"курування журналу\". Reads git log since the last tag, FILTERS out what a reader never feels (test\u002Fci\u002Fchore\u002Fmerge), GROUPS commits about one feature into one bullet, and REWRITES technical subjects into plain language under the six Keep a Changelog categories (Added\u002FChanged\u002FDeprecated\u002F Removed\u002FFixed\u002FSecurity). The result must have FEWER lines than the raw log — that is the proof of curation, not a dump. Leaves the edit in the working tree; never commits or pushes.","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F9-collaboration\u002F9.7-release-docs\u002F.claude\u002Fskills\u002Fcurate-changelog\u002FSKILL.md",[],[],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":86},"01M72YFZDKNXQ7WF9ARC5KQ4F5","codify-rule","Turn a repeated mistake into a durable, path-scoped rule in .claude\u002Frules\u002F. Triggers on \"codify this rule\", \"make a rule so this doesn't happen again\", \"\u002Fcodify-rule\", \"закодифікуй правило\", \"петля помилка-правило\". Use only when the same mistake showed up TWICE (twice = a pattern, once = noise). Names the wrong shape and the right shape with one short example of each, scopes the rule to the paths that matter, and leaves the edit in the working tree so the next agent on this repo inherits the fix. Edits only .claude\u002Frules\u002F; never commits or pushes.","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F9-collaboration\u002F9.7-release-docs\u002F.claude\u002Fskills\u002Fcodify-rule\u002FSKILL.md",[],[],{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":114,"publishedAt":86},"01M72YFVKC19NCQDD30R1C282Q","check-docs-drift","Find and fix where docs\u002Fapi.md fell behind the code. Triggers on \"check for doc drift\", \"is the API doc up to date\", \"\u002Fcheck-docs-drift\", \"перевір дрейф документації\", \"docs drift\". Runs the deterministic scripts\u002Fcheck-docs-drift.py (parses the public NoteBook methods with ast, compares to what docs\u002Fapi.md documents — NO LLM finds the gap), reports the drift, and PROPOSES the doc edit that closes it. The gap is found by parsing; the agent writes the missing documentation in the doc's existing style. Edits only docs\u002F; never commits or pushes.","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F9-collaboration\u002F9.7-release-docs\u002F.claude\u002Fskills\u002Fcheck-docs-drift\u002FSKILL.md",[],[],{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":86},"01M72YFQSJ21QX4SQADQ1SQDZR","bump-version","Decide and apply the next semver for a release. Triggers on \"bump the version\", \"what version is next\", \"\u002Fbump-version\", \"простав версію\", \"яка наступна версія\". Reads the next number from the deterministic scripts\u002Fnext-version.sh (NEVER guesses it), explains in plain language WHICH part moved and why (e.g. \"MINOR, because a feat landed: filter notes by tag\"), edits the version line in pyproject.toml, and proposes the matching `git tag vX.Y.Z`. The number is decided by a rule; the agent explains and applies — the human confirms the tag. Never pushes a tag itself.","https:\u002F\u002Fgithub.com\u002Fgenkovich\u002Fagentic-engineering-course-public\u002Fblob\u002Fmain\u002Fmodules\u002F9-collaboration\u002F9.7-release-docs\u002F.claude\u002Fskills\u002Fbump-version\u002FSKILL.md",[],[]]