[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EBQADA7F5ZNBX2A4MFEZ01":3,"skill-same:01M7EBQADA7F5ZNBX2A4MFEZ01":81},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M7EBQADA7F5ZNBX2A4MFEZ01","api-design",null,"Stable consumer-facing API and interface design patterns. Use when designing REST endpoints, cross-team boundaries, or any externally consumed or versioned service contract. Covers contract-first development, error semantics (RFC 9457), REST conventions, pagination, idempotency, rate limiting, and backward compatibility. For an in-process feature or module's coherent responsibility and interface depth, use codebase-design. For TypeScript type patterns and trust-boundary validation, see typescript-strict.","conjurer-rich\u002Fskills","conjurer-rich","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F73941040?v=4","01M7EBNSGM9WBQSJWM8FQ5VNTR","Richard Allen","01M7EBNSH8C5824CFBXA3EK2H1",1,"MIT","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: api-design\ndescription: Stable consumer-facing API and interface design patterns. Use when designing REST endpoints, cross-team boundaries, or any externally consumed or versioned service contract. Covers contract-first development, error semantics (RFC 9457), REST conventions, pagination, idempotency, rate limiting, and backward compatibility. For an in-process feature or module's coherent responsibility and interface depth, use codebase-design. For TypeScript type patterns and trust-boundary validation, see typescript-strict.\n---\n\n# API and Interface Design\n\nUse this skill for consumer compatibility and protocol semantics. For an in-process module's responsibility, full caller burden, information hiding, and depth, load `codebase-design`; use both when an internal module also exposes a public or cross-team contract. Use `evaluate-existing-solutions` only when a material gateway, framework, SDK, provider, or protocol-implementation choice remains unresolved; API semantics and compatibility stay here.\n\nFor TypeScript type patterns (branded types, discriminated unions, schema-first), see the `typescript-strict` skill. For immutability patterns, see the `functional` skill. For testing API behavior, see the `testing` skill. For OAuth 2.0 or OpenID Connect, load the `secure-oauth-oidc` skill rather than treating authentication as an ordinary API-key decision. For browser-facing BFF entry points — public\u002Fprotected access classification, session cookies, CSRF\u002FOrigin\u002FFetch Metadata policy, protected SSE\u002FWebSocket registration, and endpoint-protection enforcement — load the `bff-entry-points` skill; error shape and REST semantics stay here. A single-consumer BFF deployed in lockstep with its frontend legitimately relaxes the versioning discipline this skill mandates for externally consumed contracts.\n\n**Supporting resources** are in the `resources\u002F` directory. Load them on demand:\n\n| Resource | Load when... |\n|----------|-------------|\n| `problem-details.md` | Implementing RFC 9457 error responses — member semantics, single-error and validation-error JSON examples, extension members, §5 security guidance |\n| `api-evolution.md` | Versioning strategies and deprecation patterns |\n| `api-security.md` | Securing the API boundary |\n| `auth-security.md` | JWT BCP security and routing to the dedicated OAuth\u002FOIDC skill |\n| `http-fundamentals.md` | HTTP protocol fundamentals — caching directives, content negotiation, browser security, status codes, header design |\n| `source-notes.md` | Reviewing provenance, the immutable audit baseline, license scope, and local departures |\n\n## When to Use\n\n- Designing new API endpoints\n- Defining contracts between teams or independently released consumers\n- Changing existing public interfaces\n- Establishing database schema that informs API shape\n\n## Core Principles\n\n### Hyrum's Law\n\n> With a sufficient number of users of an API, all observable behaviors of your system will be depended on by somebody, regardless of what you promise in the contract.\n\nEvery public behavior — including undocumented quirks, error message text, timing, and ordering — becomes a de facto contract once users depend on it.\n\n- **Be intentional about what you expose.** Every observable behavior is a potential commitment.\n- **Don't leak implementation details.** If users can observe it, they will depend on it.\n- **Plan for deprecation at design time, and record it the moment it happens.** Removing things users depend on always costs more than expected. When a published name is superseded, write that down where a consumer will see it: a deprecation comment on the field or its type, `Deprecation`\u002F`Sunset` headers on responses that still carry it, and a line in the README or API docs naming the replacement. A supersession nobody recorded is an undocumented change — see `resources\u002Fapi-evolution.md` for the header syntax and the deprecation checklist.\n- **Tests are not enough.** Even with perfect contract tests, Hyrum's Law means \"safe\" changes can break real users who depend on undocumented behavior.\n\n### The One-Version Rule\n\nAvoid forcing consumers to choose between multiple versions of the same dependency or API. Diamond dependency problems arise when different consumers need different versions of the same thing. Design for a world where only one version exists at a time — extend rather than fork.\n\n### Contract First\n\nDefine the interface before implementing it. The contract is the spec — implementation follows.\n\n```typescript\ntype TaskAPI = {\n  readonly createTask: (input: CreateTaskInput) => Promise\u003CTask>;\n  readonly listTasks: (params: ListTasksParams) => Promise\u003CPaginatedResult\u003CTask>>;\n  readonly getTask: (id: TaskId) => Promise\u003CTask>;\n  readonly updateTask: (id: TaskId, input: UpdateTaskInput) => Promise\u003CTask>;\n  readonly deleteTask: (id: TaskId) => Promise\u003Cvoid>;\n};\n```\n\nThis aligns with TDD: define the contract (what you want), write tests against it, then implement.\n\n### Prefer Addition Over Modification\n\nExtend interfaces without breaking existing consumers.\n\n**This rule outranks the wording of the request.** A request to rename, retype, narrow or remove something a shipped contract already publishes — a response field, a header, a status, a route — is a request for the new shape, not for the outage. Deliver the additive form: add the new name alongside the old, keep the old one working and carrying the same value, record the old one as superseded, and say in your reply that you added rather than replaced and what retiring the old name would take. Do not perform the break and note it afterwards, and do not stop to ask which was meant — the additive change delivers what was asked for, satisfies compatibility, and stays reversible if the requester did want the break.\n\nExtend interfaces this way:\n\n```typescript\ntype CreateTaskInput = {\n  readonly title: string;\n  readonly description?: string;\n  readonly priority?: 'low' | 'medium' | 'high';  \u002F\u002F Added later, optional\n  readonly labels?: ReadonlyArray\u003Cstring>;           \u002F\u002F Added later, optional\n};\n```\n\nWhat breaks backward compatibility:\n- Removing fields\n- Changing field types\n- Making optional fields required\n- Changing enum values\n\nWhat preserves backward compatibility:\n- Adding new optional fields\n- Adding new enum values (if consumers handle unknown values)\n- Adding new endpoints\n\n## Consistent Error Semantics\n\nPick one error strategy and use it everywhere. Don't mix patterns where some endpoints throw, others return null, and others return `{ error }`.\n\n### Choosing an Error Format\n\nWithin one versioned API contract, use one documented error shape unless a\nprotocol-specific endpoint requires another. Consistency matters more than\nwhich compatible format you choose.\n\n**For public APIs with external consumers**, use RFC 9457 (Problem Details). It's the industry standard, machine-readable, and what third-party developers expect. Use `application\u002Fproblem+json` as the Content-Type.\n\n**For internal APIs with a single frontend**, a simpler consistent shape is a valid choice. The minimum viable error response needs: a machine-readable error code, an optional human-readable message, and the correct HTTP status code. This is less ceremony than RFC 9457 while still being consistent and actionable.\n\n```typescript\n\u002F\u002F Simpler shape — sufficient for internal APIs\ntype ApiError = {\n  readonly error: string;                          \u002F\u002F Machine-readable code (UPPER_SNAKE_CASE)\n  readonly message?: string;                       \u002F\u002F Human-readable description\n  readonly fieldErrors?: Record\u003Cstring, string>;   \u002F\u002F For validation errors\n};\n```\n\nIf you start with a simpler format, design it so it can evolve toward RFC 9457 later (e.g., `error` maps to `title`, `message` maps to `detail`). Don't paint yourself into a corner.\n\n### RFC 9457 (Problem Details for HTTP APIs)\n\nThe standard format for machine-readable API errors for public APIs. Use `application\u002Fproblem+json` as the Content-Type. Standard members: `type` (URI identifying the error type), `title` (stable, human-readable summary), `status` (must match the actual HTTP status), `detail` (occurrence-specific explanation), `instance` (optional occurrence URI). Extension members are allowed — clients must ignore extensions they don't recognize.\n\nErrors should be **actionable**: the consumer should know what went wrong, why, and what to do about it. Error responses are not a debugging tool — never expose stack traces, internal paths, or implementation details.\n\nInclude a correlation identifier (the trace ID, or an opaque reference to it) as an extension member or via `instance`, so a user-reported error joins to its trace and canonical log event — see the `observability` skill. The trace ID reveals nothing internal; it is a lookup key, not a detail leak.\n\nSee `resources\u002Fproblem-details.md` for full member semantics, single-error and validation-error JSON examples, extension member rules, when NOT to use Problem Details, and RFC 9457 §5 security guidance.\n\n### HTTP Status Code Mapping\n\n| Status | Meaning | When to use |\n|--------|---------|-------------|\n| 400 | Bad Request | Client sent malformed data |\n| 401 | Unauthorized | Not authenticated |\n| 403 | Forbidden | Authenticated but not authorized |\n| 404 | Not Found | Resource doesn't exist |\n| 409 | Conflict | Duplicate, version mismatch |\n| 422 | Unprocessable Content | Validation failed (semantically invalid) |\n| 429 | Too Many Requests | Rate limit exceeded; include `Retry-After` when a meaningful retry time is known |\n| 500 | Internal Server Error | Server error (never expose internal details) |\n\n### Validation at API Boundaries\n\nValidate untrusted representation and endpoint-schema input where it enters the\nsystem, then pass the derived type through internal code. This does not replace\ndomain smart constructors or transition checks: invariant enforcement remains\nwith the model that owns the value. See `typescript-strict` and\n`domain-driven-design`.\n\nReturn 400 when the representation itself cannot be parsed (for example malformed JSON). Once parsing succeeds, return 422 when the value fails the endpoint schema or business validation. Pick and document a different house mapping only when every example, error translator, and consumer uses it consistently.\n\n```typescript\napp.post('\u002Fapi\u002Ftasks', async (req, res) => {\n  const result = CreateTaskSchema.safeParse(req.body);\n  if (!result.success) {\n    return res.status(422).json({\n      type: 'https:\u002F\u002Fapi.example.com\u002Fproblems\u002Fvalidation-error',\n      title: 'Validation Error',\n      status: 422,\n      detail: 'Invalid task data',\n      errors: result.error.flatten(),\n    });\n  }\n\n  const task = await taskService.create(result.data);\n  return res.status(201).json(task);\n});\n```\n\nThird-party API responses are untrusted data — always validate their shape and content before use.\n\n## Idempotency\n\nNetwork failures happen. Clients retry. Without idempotency, retries create duplicate charges, duplicate orders, duplicate records.\n\n### HTTP Method Idempotency\n\n| Method | Safe | Idempotent | Notes |\n|--------|------|------------|-------|\n| GET | Yes | Yes | Read-only requested semantics; incidental logging\u002Fmetrics are allowed |\n| PUT | No | Yes | Same request has the same intended effect; response status\u002Fbody may differ |\n| DELETE | No | Yes | Deleting twice = same outcome |\n| POST | No | **No** | Needs explicit idempotency handling |\n| PATCH | No | Not guaranteed | Depends on implementation |\n\n### Idempotency Keys for POST\n\nFor non-idempotent operations (especially those involving money, orders, or state changes), use client-provided idempotency keys:\n\n```typescript\napp.post('\u002Fapi\u002Fpayments', async (req, res) => {\n  const rawIdempotencyKey = req.headers['idempotency-key'];\n  const idempotencyKey =\n    typeof rawIdempotencyKey === 'string' &&\n    \u002F^[\\x21-\\x7e]{1,128}$\u002F.test(rawIdempotencyKey)\n      ? rawIdempotencyKey\n      : undefined;\n  if (!idempotencyKey) {\n    return res.status(400).json({\n      type: 'https:\u002F\u002Fapi.example.com\u002Fproblems\u002Finvalid-idempotency-key',\n      title: 'Invalid Idempotency Key',\n      status: 400,\n      detail: 'POST \u002Fapi\u002Fpayments requires one visible-ASCII Idempotency-Key of at most 128 characters',\n    });\n  }\n\n  const result = CreatePaymentSchema.safeParse(req.body);\n  if (!result.success) {\n    return res.status(422).json(toValidationProblem(result.error));\n  }\n\n  const scope = req.user.id;\n  const fingerprint = stableHash(result.data);\n  const claim = await idempotencyStore.claim({\n    scope,\n    key: idempotencyKey,\n    fingerprint,\n  });\n\n  if (claim.status === 'parameters-mismatch') {\n    return res.status(409).json(toProblem('IDEMPOTENCY_PARAMETERS_MISMATCH'));\n  }\n  if (claim.status === 'completed') {\n    return res.status(claim.response.status).json(claim.response.body);\n  }\n  if (claim.status === 'in-progress') {\n    res.setHeader('Retry-After', '1');\n    return res.status(409).json(toProblem('IDEMPOTENCY_REQUEST_IN_PROGRESS'));\n  }\n\n  \u002F\u002F createOnce durably owns operationId + fingerprint beyond response-cache\n  \u002F\u002F expiry. For an external provider it also persists\u002Freuses the provider's\n  \u002F\u002F payment\u002Fintent ID, so recovery never depends on a time-limited request key.\n  const payment = await paymentService.createOnce({\n    operationId: claim.operationId,\n    input: result.data,\n  });\n  await idempotencyStore.complete(claim.id, { status: 201, body: payment });\n\n  return res.status(201).json(payment);\n});\n```\n\nDesign principles:\n- Keys should be scoped to the API key \u002F authenticated user\n- Choose response-cache and claim retention from the documented maximum client\n  retry\u002Freconciliation window and effect risk; 24 hours is not a universal rule\n- Keep a durable operation identity (and fingerprint or tombstone) after cached\n  response eviction, or return an explicit expired\u002Funknown outcome until\n  non-duplication can be established — never silently treat a risky reused key\n  as a fresh operation\n- If parameters differ on retry with the same key, return an error\n- Claim a key atomically; a separate read-then-create sequence is race-prone\n- Coordinate the business effect with the claim through one transaction or a durable downstream operation ID\n- For external payments, persist and reconcile the provider payment\u002Fintent ID;\n  bound any request-idempotency-key retry to the provider's documented retention\n- Represent in-progress claims explicitly and define retry\u002Frecovery for a worker that fails after claiming\n- Design for \"at-least-once\" delivery — assume every request might be sent multiple times\n\n### Making DELETE Idempotent\n\nDELETE must have an idempotent effect: repeating it does not delete anything\nelse or create a second side effect. The repeated response may remain `204`,\nor it may be `404` when absence is meaningful to clients. Choose and document\none contract:\n\n```typescript\napp.delete('\u002Fapi\u002Ftasks\u002F:id', async (req, res) => {\n  const deleted = await taskService.delete(req.params.id);\n  \u002F\u002F This API deliberately treats already-absent as success.\n  return res.status(204).send();\n});\n```\n\n## Rate Limiting\n\nWhen an API exposes a quota policy, communicate the applicable policy and\nremaining state consistently on responses where that information is useful\nto clients. Do not invent quota headers for endpoints without such a policy.\n\n### Standard Headers (IETF draft — not yet an RFC)\n\nThe IETF standardization effort is `draft-ietf-httpapi-ratelimit-headers` (version 11, May 2026 — still an active working group draft). Current drafts define two structured fields:\n\n```\nRateLimit-Policy: \"hour\";q=1000;w=3600   # Policy: quota of 1000 per 3600s window\nRateLimit: \"hour\";r=742;t=60             # Current state: 742 remaining, resets in 60s\n```\n\nEarlier drafts used a triplet — `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` — and many shipped APIs still use that triplet or the unstandardized `X-RateLimit-*` family. Expect any of these when consuming APIs. For new APIs, prefer the current draft fields; whichever names you choose, document them — header names are part of your contract, and the draft may still change before becoming an RFC.\n\nOn 429 responses, include `Retry-After` when the server can give a meaningful\nretry time. It is a stable, standard HTTP header, but HTTP permits a 429\nresponse without it:\n\n```\nHTTP\u002F1.1 429 Too Many Requests\nRetry-After: 30\nRateLimit-Policy: \"hour\";q=1000;w=3600\nRateLimit: \"hour\";r=0;t=30\nContent-Type: application\u002Fproblem+json\n\n{\n  \"type\": \"https:\u002F\u002Fapi.example.com\u002Fproblems\u002Frate-limit-exceeded\",\n  \"title\": \"Rate Limit Exceeded\",\n  \"status\": 429,\n  \"detail\": \"You have exceeded 1000 requests per hour. Retry after 30 seconds.\"\n}\n```\n\n### Design Considerations\n\n- **Different limits for different operations** — reads are cheaper than writes\n- **Communicate limits in documentation** — don't make consumers discover them by hitting 429s\n- **Recommend exponential backoff with jitter** in your docs — naive retry loops cause thundering herds\n\n## HTTP Caching\n\nAssign explicit freshness lifetimes on responses. Don't rely on heuristic freshness.\n\nPractical rules:\n- Prefer `Cache-Control: max-age=N` over `Expires` — even short freshness (e.g., `max-age=5`) enables reuse across multiple clients\n- Assign ETags for efficient revalidation without re-transferring the body\n- If a request header changes the response, use `Vary` on ALL responses from that resource (including the default)\n- Use `no-store` for responses containing sensitive data — `no-cache` does NOT mean \"don't cache\" (it means \"stored but revalidate before use\")\n\nSee `resources\u002Fhttp-fundamentals.md` for the full `Cache-Control` directive table plus content negotiation, header design, and protocol version independence.\n\n## REST Conventions\n\n### Resource Naming\n\n| Pattern | Convention | Example |\n|---------|-----------|---------|\n| Endpoints | Plural nouns, no verbs | `GET \u002Fapi\u002Ftasks`, `POST \u002Fapi\u002Ftasks` |\n| Query params | camelCase | `?sortBy=createdAt&pageSize=20` |\n| Response fields | camelCase | `{ createdAt, updatedAt, taskId }` |\n| Boolean fields | is\u002Fhas\u002Fcan prefix | `isComplete`, `hasAttachments` |\n| Enum values | UPPER_SNAKE | `\"IN_PROGRESS\"`, `\"COMPLETED\"` |\n| Headers | No `X-` prefix (RFC 6648\u002FBCP 178) | `Example-Request-Id` |\n\n### Resource Design\n\n```\nGET    \u002Fapi\u002Ftasks              → List tasks (with query params for filtering)\nPOST   \u002Fapi\u002Ftasks              → Create a task\nGET    \u002Fapi\u002Ftasks\u002F:id          → Get a single task\nPATCH  \u002Fapi\u002Ftasks\u002F:id          → Update a task (partial)\nDELETE \u002Fapi\u002Ftasks\u002F:id          → Delete a task\n\nGET    \u002Fapi\u002Ftasks\u002F:id\u002Fcomments → List comments for a task (sub-resource)\nPOST   \u002Fapi\u002Ftasks\u002F:id\u002Fcomments → Add a comment to a task\n```\n\nUse PATCH for partial updates (only provided fields change). Use PUT only when the client sends the complete object.\n\n### Pagination\n\nPaginate list endpoints whose result can grow beyond a bounded, safe response.\nSmall closed enumerations may return the complete set when that bound is part\nof the contract:\n\n```typescript\n\u002F\u002F Request\n\u002F\u002F GET \u002Fapi\u002Ftasks?page=1&pageSize=20&sortBy=createdAt&sortOrder=desc\n\n\u002F\u002F Response shape\ntype PaginatedResult\u003CT> = {\n  readonly data: ReadonlyArray\u003CT>;\n  readonly pagination: {\n    readonly page: number;\n    readonly pageSize: number;\n    readonly totalItems: number;\n    readonly totalPages: number;\n  };\n};\n```\n\n### Filtering\n\nUse query parameters for filters:\n\n```\nGET \u002Fapi\u002Ftasks?status=in_progress&assignee=user123&createdAfter=2025-01-01\n```\n\n### Input\u002FOutput Separation\n\nSeparate what the caller provides from what the system returns:\n\n```typescript\n\u002F\u002F Input: what the caller provides\ntype CreateTaskInput = {\n  readonly title: string;\n  readonly description?: string;\n};\n\n\u002F\u002F Output: includes server-generated fields\ntype Task = {\n  readonly id: TaskId;\n  readonly title: string;\n  readonly description: string | null;\n  readonly createdAt: Date;\n  readonly updatedAt: Date;\n  readonly createdBy: UserId;\n};\n```\n\n## Common Rationalizations\n\n| Rationalization | Reality |\n|---|---|\n| \"We'll document the API later\" | The types ARE the documentation. Define them first. |\n| \"We don't need a bound for this growing list\" | Define pagination or another documented safe bound before the result can grow beyond one response. Closed, contractually bounded lists do not need ceremonial pagination. |\n| \"PATCH is complicated, let's just use PUT\" | PUT requires the full object every time. PATCH is what clients actually want. |\n| \"We'll version the API when we need to\" | Breaking changes without versioning break consumers. Design for extension from the start. |\n| \"They asked for the rename, so the break is authorised\" | A request for a clearer name is a request for the name, not for the breakage. Add the new name, keep the old one working, record it as superseded, and explain that choice in the reply — don't ship the break, and don't stall the work asking which was meant. |\n| \"Nobody uses that undocumented behavior\" | Hyrum's Law: if it's observable, somebody depends on it. |\n| \"Internal APIs don't need contracts\" | Internal consumers are still consumers. Contracts prevent coupling and enable parallel work. |\n| \"Retries are the client's problem\" | Without idempotency, retries create duplicates. Design for at-least-once delivery. |\n| \"We'll add an abuse control after this expensive public operation is attacked\" | Protect unauthenticated, costly, or abuse-prone operations from the start. Publish quota headers only when a client-visible quota is actually part of the contract. |\n| \"Error messages are just for debugging\" | Errors are part of your API's developer experience. Make them actionable, not diagnostic. |\n\n## Red Flags\n\n- Endpoints that return different shapes depending on conditions\n- Inconsistent error formats across endpoints\n- Error responses that expose stack traces or internal paths\n- Breaking changes to existing fields (type changes, removals)\n- Potentially unbounded list endpoints without pagination or another explicit bound\n- Verbs in REST URLs (`\u002Fapi\u002FcreateTask`, `\u002Fapi\u002FgetUsers`)\n- Third-party API responses used without validation\n- No typed input\u002Foutput schemas for endpoints\n- Retriable POST operations where duplicate attempts can repeat a state-changing effect and no idempotency strategy is defined\n- Documented quota policies whose responses do not expose enough state for clients to behave correctly\n- Retry logic without exponential backoff\n- Browser-served responses missing the entry point's applicable security headers\n- Custom `X-` prefixed headers (deprecated by RFC 6648)\n\n## Verification\n\nAfter designing an API:\n\n- [ ] Every endpoint has a typed output contract and typed input where input exists\n- [ ] Error responses follow a single consistent format (RFC 9457 for public APIs, or a simpler consistent shape for internal APIs)\n- [ ] Error responses never leak implementation details (stack traces, internal paths)\n- [ ] Untrusted representation\u002Fschema validation happens at trust boundaries; domain invariants remain enforced by their owner\n- [ ] Growing list endpoints have pagination or another documented safe bound\n- [ ] New fields are additive and optional (backward compatible), and no published name, type, status or route has been removed or repurposed by this change\n- [ ] Every superseded name is still served with its old value and is recorded as superseded where a consumer can see it\n- [ ] Naming follows consistent conventions across all endpoints\n- [ ] Contract defined before implementation (contract-first)\n- [ ] Retriable POST operations define how duplicate attempts avoid repeated effects\n- [ ] APIs with documented quota policies expose the client-visible limit state consistently\n- [ ] Content-Type is `application\u002Fproblem+json` for RFC 9457 responses, `application\u002Fjson` for simpler formats\n- [ ] Browser-facing entry points apply security headers suited to the served content and deployment policy\n- [ ] Caching strategy defined (explicit `Cache-Control`, ETags for revalidation, `Vary` where needed)\n\n## Attribution\n\nThis skill adapts Addy Osmani's MIT-licensed `api-and-interface-design` skill. Local history records the adaptation but not the original upstream import revision. See `resources\u002Fsource-notes.md` for the immutable audit baseline (which is not an import-revision claim), retained ideas, and local departures; see `LICENSE` for the applicable upstream notice.\n","# API and Interface Design\n\nUse this skill for consumer compatibility and protocol semantics. For an in-process module's responsibility, full caller burden, information hiding, and depth, load `codebase-design`; use both when an internal module also exposes a public or cross-team contract. Use `evaluate-existing-solutions` only when a material gateway, framework, SDK, provider, or protocol-implementation choice remains unresolved; API semantics and compatibility stay here.\n\nFor TypeScript type patterns (branded types, discriminated unions, schema-first), see the `typescript-strict` skill. For immutability patterns, see the `functional` skill. For testing API behavior, see the `testing` skill. For OAuth 2.0 or OpenID Connect, load the `secure-oauth-oidc` skill rather than treating authentication as an ordinary API-key decision. For browser-facing BFF entry points — public\u002Fprotected access classification, session cookies, CSRF\u002FOrigin\u002FFetch Metadata policy, protected SSE\u002FWebSocket registration, and endpoint-protection enforcement — load the `bff-entry-points` skill; error shape and REST semantics stay here. A single-consumer BFF deployed in lockstep with its frontend legitimately relaxes the versioning discipline this skill mandates for externally consumed contracts.\n\n**Supporting resources** are in the `resources\u002F` directory. Load them on demand:\n\n| Resource | Load when... |\n|----------|-------------|\n| `problem-details.md` | Implementing RFC 9457 error responses — member semantics, single-error and validation-error JSON examples, extension members, §5 security guidance |\n| `api-evolution.md` | Versioning strategies and deprecation patterns |\n| `api-security.md` | Securing the API boundary |\n| `auth-security.md` | JWT BCP security and routing to the dedicated OAuth\u002FOIDC skill |\n| `http-fundamentals.md` | HTTP protocol fundamentals — caching directives, content negotiation, browser security, status codes, header design |\n| `source-notes.md` | Reviewing provenance, the immutable audit baseline, license scope, and local departures |\n\n## When to Use\n\n- Designing new API endpoints\n- Defining contracts between teams or independently released consumers\n- Changing existing public interfaces\n- Establishing database schema that informs API shape\n\n## Core Principles\n\n### Hyrum's Law\n\n> With a sufficient number of users of an API, all observable behaviors of your system will be depended on by somebody, regardless of what you promise in the contract.\n\nEvery public behavior — including undocumented quirks, error message text, timing, and ordering — becomes a de facto contract once users depend on it.\n\n- **Be intentional about what you expose.** Every observable behavior is a potential commitment.\n- **Don't leak implementation details.** If users can observe it, they will depend on it.\n- **Plan for deprecation at design time, and record it the moment it happens.** Removing things users depend on always costs more than expected. When a published name is superseded, write that down where a consumer will see it: a deprecation comment on the field or its type, `Deprecation`\u002F`Sunset` headers on responses that still carry it, and a line in the README or API docs naming the replacement. A supersession nobody recorded is an undocumented change — see `resources\u002Fapi-evolution.md` for the header syntax and the deprecation checklist.\n- **Tests are not enough.** Even with perfect contract tests, Hyrum's Law means \"safe\" changes can break real users who depend on undocumented behavior.\n\n### The One-Version Rule\n\nAvoid forcing consumers to choose between multiple versions of the same dependency or API. Diamond dependency problems arise when different consumers need different versions of the same thing. Design for a world where only one version exists at a time — extend rather than fork.\n\n### Contract First\n\nDefine the interface before implementing it. The contract is the spec — implementation follows.\n\n```typescript\ntype TaskAPI = {\n  readonly createTask: (input: CreateTaskInput) => Promise\u003CTask>;\n  readonly listTasks: (params: ListTasksParams) => Promise\u003CPaginatedResult\u003CTask>>;\n  readonly getTask: (id: TaskId) => Promise\u003CTask>;\n  readonly updateTask: (id: TaskId, input: UpdateTaskInput) => Promise\u003CTask>;\n  readonly deleteTask: (id: TaskId) => Promise\u003Cvoid>;\n};\n```\n\nThis aligns with TDD: define the contract (what you want), write tests against it, then implement.\n\n### Prefer Addition Over Modification\n\nExtend interfaces without breaking existing consumers.\n\n**This rule outranks the wording of the request.** A request to rename, retype, narrow or remove something a shipped contract already publishes — a response field, a header, a status, a route — is a request for the new shape, not for the outage. Deliver the additive form: add the new name alongside the old, keep the old one working and carrying the same value, record the old one as superseded, and say in your reply that you added rather than replaced and what retiring the old name would take. Do not perform the break and note it afterwards, and do not stop to ask which was meant — the additive change delivers what was asked for, satisfies compatibility, and stays reversible if the requester did want the break.\n\nExtend interfaces this way:\n\n```typescript\ntype CreateTaskInput = {\n  readonly title: string;\n  readonly description?: string;\n  readonly priority?: 'low' | 'medium' | 'high';  \u002F\u002F Added later, optional\n  readonly labels?: ReadonlyArray\u003Cstring>;           \u002F\u002F Added later, optional\n};\n```\n\nWhat breaks backward compatibility:\n- Removing fields\n- Changing field types\n- Making optional fields required\n- Changing enum values\n\nWhat preserves backward compatibility:\n- Adding new optional fields\n- Adding new enum values (if consumers handle unknown values)\n- Adding new endpoints\n\n## Consistent Error Semantics\n\nPick one error strategy and use it everywhere. Don't mix patterns where some endpoints throw, others return null, and others return `{ error }`.\n\n### Choosing an Error Format\n\nWithin one versioned API contract, use one documented error shape unless a\nprotocol-specific endpoint requires another. Consistency matters more than\nwhich compatible format you choose.\n\n**For public APIs with external consumers**, use RFC 9457 (Problem Details). It's the industry standard, machine-readable, and what third-party developers expect. Use `application\u002Fproblem+json` as the Content-Type.\n\n**For internal APIs with a single frontend**, a simpler consistent shape is a valid choice. The minimum viable error response needs: a machine-readable error code, an optional human-readable message, and the correct HTTP status code. This is less ceremony than RFC 9457 while still being consistent and actionable.\n\n```typescript\n\u002F\u002F Simpler shape — sufficient for internal APIs\ntype ApiError = {\n  readonly error: string;                          \u002F\u002F Machine-readable code (UPPER_SNAKE_CASE)\n  readonly message?: string;                       \u002F\u002F Human-readable description\n  readonly fieldErrors?: Record\u003Cstring, string>;   \u002F\u002F For validation errors\n};\n```\n\nIf you start with a simpler format, design it so it can evolve toward RFC 9457 later (e.g., `error` maps to `title`, `message` maps to `detail`). Don't paint yourself into a corner.\n\n### RFC 9457 (Problem Details for HTTP APIs)\n\nThe standard format for machine-readable API errors for public APIs. Use `application\u002Fproblem+json` as the Content-Type. Standard members: `type` (URI identifying the error type), `title` (stable, human-readable summary), `status` (must match the actual HTTP status), `detail` (occurrence-specific explanation), `instance` (optional occurrence URI). Extension members are allowed — clients must ignore extensions they don't recognize.\n\nErrors should be **actionable**: the consumer should know what went wrong, why, and what to do about it. Error responses are not a debugging tool — never expose stack traces, internal paths, or implementation details.\n\nInclude a correlation identifier (the trace ID, or an opaque reference to it) as an extension member or via `instance`, so a user-reported error joins to its trace and canonical log event — see the `observability` skill. The trace ID reveals nothing internal; it is a lookup key, not a detail leak.\n\nSee `resources\u002Fproblem-details.md` for full member semantics, single-error and validation-error JSON examples, extension member rules, when NOT to use Problem Details, and RFC 9457 §5 security guidance.\n\n### HTTP Status Code Mapping\n\n| Status | Meaning | When to use |\n|--------|---------|-------------|\n| 400 | Bad Request | Client sent malformed data |\n| 401 | Unauthorized | Not authenticated |\n| 403 | Forbidden | Authenticated but not authorized |\n| 404 | Not Found | Resource doesn't exist |\n| 409 | Conflict | Duplicate, version mismatch |\n| 422 | Unprocessable Content | Validation failed (semantically invalid) |\n| 429 | Too Many Requests | Rate limit exceeded; include `Retry-After` when a meaningful retry time is known |\n| 500 | Internal Server Error | Server error (never expose internal details) |\n\n### Validation at API Boundaries\n\nValidate untrusted representation and endpoint-schema input where it enters the\nsystem, then pass the derived type through internal code. This does not replace\ndomain smart constructors or transition checks: invariant enforcement remains\nwith the model that owns the value. See `typescript-strict` and\n`domain-driven-design`.\n\nReturn 400 when the representation itself cannot be parsed (for example malformed JSON). Once parsing succeeds, return 422 when the value fails the endpoint schema or business validation. Pick and document a different house mapping only when every example, error translator, and consumer uses it consistently.\n\n```typescript\napp.post('\u002Fapi\u002Ftasks', async (req, res) => {\n  const result = CreateTaskSchema.safeParse(req.body);\n  if (!result.success) {\n    return res.status(422).json({\n      type: 'https:\u002F\u002Fapi.example.com\u002Fproblems\u002Fvalidation-error',\n      title: 'Validation Error',\n      status: 422,\n      detail: 'Invalid task data',\n      errors: result.error.flatten(),\n    });\n  }\n\n  const task = await taskService.create(result.data);\n  return res.status(201).json(task);\n});\n```\n\nThird-party API responses are untrusted data — always validate their shape and content before use.\n\n## Idempotency\n\nNetwork failures happen. Clients retry. Without idempotency, retries create duplicate charges, duplicate orders, duplicate records.\n\n### HTTP Method Idempotency\n\n| Method | Safe | Idempotent | Notes |\n|--------|------|------------|-------|\n| GET | Yes | Yes | Read-only requested semantics; incidental logging\u002Fmetrics are allowed |\n| PUT | No | Yes | Same request has the same intended effect; response status\u002Fbody may differ |\n| DELETE | No | Yes | Deleting twice = same outcome |\n| POST | No | **No** | Needs explicit idempotency handling |\n| PATCH | No | Not guaranteed | Depends on implementation |\n\n### Idempotency Keys for POST\n\nFor non-idempotent operations (especially those involving money, orders, or state changes), use client-provided idempotency keys:\n\n```typescript\napp.post('\u002Fapi\u002Fpayments', async (req, res) => {\n  const rawIdempotencyKey = req.headers['idempotency-key'];\n  const idempotencyKey =\n    typeof rawIdempotencyKey === 'string' &&\n    \u002F^[\\x21-\\x7e]{1,128}$\u002F.test(rawIdempotencyKey)\n      ? rawIdempotencyKey\n      : undefined;\n  if (!idempotencyKey) {\n    return res.status(400).json({\n      type: 'https:\u002F\u002Fapi.example.com\u002Fproblems\u002Finvalid-idempotency-key',\n      title: 'Invalid Idempotency Key',\n      status: 400,\n      detail: 'POST \u002Fapi\u002Fpayments requires one visible-ASCII Idempotency-Key of at most 128 characters',\n    });\n  }\n\n  const result = CreatePaymentSchema.safeParse(req.body);\n  if (!result.success) {\n    return res.status(422).json(toValidationProblem(result.error));\n  }\n\n  const scope = req.user.id;\n  const fingerprint = stableHash(result.data);\n  const claim = await idempotencyStore.claim({\n    scope,\n    key: idempotencyKey,\n    fingerprint,\n  });\n\n  if (claim.status === 'parameters-mismatch') {\n    return res.status(409).json(toProblem('IDEMPOTENCY_PARAMETERS_MISMATCH'));\n  }\n  if (claim.status === 'completed') {\n    return res.status(claim.response.status).json(claim.response.body);\n  }\n  if (claim.status === 'in-progress') {\n    res.setHeader('Retry-After', '1');\n    return res.status(409).json(toProblem('IDEMPOTENCY_REQUEST_IN_PROGRESS'));\n  }\n\n  \u002F\u002F createOnce durably owns operationId + fingerprint beyond response-cache\n  \u002F\u002F expiry. For an external provider it also persists\u002Freuses the provider's\n  \u002F\u002F payment\u002Fintent ID, so recovery never depends on a time-limited request key.\n  const payment = await paymentService.createOnce({\n    operationId: claim.operationId,\n    input: result.data,\n  });\n  await idempotencyStore.complete(claim.id, { status: 201, body: payment });\n\n  return res.status(201).json(payment);\n});\n```\n\nDesign principles:\n- Keys should be scoped to the API key \u002F authenticated user\n- Choose response-cache and claim retention from the documented maximum client\n  retry\u002Freconciliation window and effect risk; 24 hours is not a universal rule\n- Keep a durable operation identity (and fingerprint or tombstone) after cached\n  response eviction, or return an explicit expired\u002Funknown outcome until\n  non-duplication can be established — never silently treat a risky reused key\n  as a fresh operation\n- If parameters differ on retry with the same key, return an error\n- Claim a key atomically; a separate read-then-create sequence is race-prone\n- Coordinate the business effect with the claim through one transaction or a durable downstream operation ID\n- For external payments, persist and reconcile the provider payment\u002Fintent ID;\n  bound any request-idempotency-key retry to the provider's documented retention\n- Represent in-progress claims explicitly and define retry\u002Frecovery for a worker that fails after claiming\n- Design for \"at-least-once\" delivery — assume every request might be sent multiple times\n\n### Making DELETE Idempotent\n\nDELETE must have an idempotent effect: repeating it does not delete anything\nelse or create a second side effect. The repeated response may remain `204`,\nor it may be `404` when absence is meaningful to clients. Choose and document\none contract:\n\n```typescript\napp.delete('\u002Fapi\u002Ftasks\u002F:id', async (req, res) => {\n  const deleted = await taskService.delete(req.params.id);\n  \u002F\u002F This API deliberately treats already-absent as success.\n  return res.status(204).send();\n});\n```\n\n## Rate Limiting\n\nWhen an API exposes a quota policy, communicate the applicable policy and\nremaining state consistently on responses where that information is useful\nto clients. Do not invent quota headers for endpoints without such a policy.\n\n### Standard Headers (IETF draft — not yet an RFC)\n\nThe IETF standardization effort is `draft-ietf-httpapi-ratelimit-headers` (version 11, May 2026 — still an active working group draft). Current drafts define two structured fields:\n\n```\nRateLimit-Policy: \"hour\";q=1000;w=3600   # Policy: quota of 1000 per 3600s window\nRateLimit: \"hour\";r=742;t=60             # Current state: 742 remaining, resets in 60s\n```\n\nEarlier drafts used a triplet — `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` — and many shipped APIs still use that triplet or the unstandardized `X-RateLimit-*` family. Expect any of these when consuming APIs. For new APIs, prefer the current draft fields; whichever names you choose, document them — header names are part of your contract, and the draft may still change before becoming an RFC.\n\nOn 429 responses, include `Retry-After` when the server can give a meaningful\nretry time. It is a stable, standard HTTP header, but HTTP permits a 429\nresponse without it:\n\n```\nHTTP\u002F1.1 429 Too Many Requests\nRetry-After: 30\nRateLimit-Policy: \"hour\";q=1000;w=3600\nRateLimit: \"hour\";r=0;t=30\nContent-Type: application\u002Fproblem+json\n\n{\n  \"type\": \"https:\u002F\u002Fapi.example.com\u002Fproblems\u002Frate-limit-exceeded\",\n  \"title\": \"Rate Limit Exceeded\",\n  \"status\": 429,\n  \"detail\": \"You have exceeded 1000 requests per hour. Retry after 30 seconds.\"\n}\n```\n\n### Design Considerations\n\n- **Different limits for different operations** — reads are cheaper than writes\n- **Communicate limits in documentation** — don't make consumers discover them by hitting 429s\n- **Recommend exponential backoff with jitter** in your docs — naive retry loops cause thundering herds\n\n## HTTP Caching\n\nAssign explicit freshness lifetimes on responses. Don't rely on heuristic freshness.\n\nPractical rules:\n- Prefer `Cache-Control: max-age=N` over `Expires` — even short freshness (e.g., `max-age=5`) enables reuse across multiple clients\n- Assign ETags for efficient revalidation without re-transferring the body\n- If a request header changes the response, use `Vary` on ALL responses from that resource (including the default)\n- Use `no-store` for responses containing sensitive data — `no-cache` does NOT mean \"don't cache\" (it means \"stored but revalidate before use\")\n\nSee `resources\u002Fhttp-fundamentals.md` for the full `Cache-Control` directive table plus content negotiation, header design, and protocol version independence.\n\n## REST Conventions\n\n### Resource Naming\n\n| Pattern | Convention | Example |\n|---------|-----------|---------|\n| Endpoints | Plural nouns, no verbs | `GET \u002Fapi\u002Ftasks`, `POST \u002Fapi\u002Ftasks` |\n| Query params | camelCase | `?sortBy=createdAt&pageSize=20` |\n| Response fields | camelCase | `{ createdAt, updatedAt, taskId }` |\n| Boolean fields | is\u002Fhas\u002Fcan prefix | `isComplete`, `hasAttachments` |\n| Enum values | UPPER_SNAKE | `\"IN_PROGRESS\"`, `\"COMPLETED\"` |\n| Headers | No `X-` prefix (RFC 6648\u002FBCP 178) | `Example-Request-Id` |\n\n### Resource Design\n\n```\nGET    \u002Fapi\u002Ftasks              → List tasks (with query params for filtering)\nPOST   \u002Fapi\u002Ftasks              → Create a task\nGET    \u002Fapi\u002Ftasks\u002F:id          → Get a single task\nPATCH  \u002Fapi\u002Ftasks\u002F:id          → Update a task (partial)\nDELETE \u002Fapi\u002Ftasks\u002F:id          → Delete a task\n\nGET    \u002Fapi\u002Ftasks\u002F:id\u002Fcomments → List comments for a task (sub-resource)\nPOST   \u002Fapi\u002Ftasks\u002F:id\u002Fcomments → Add a comment to a task\n```\n\nUse PATCH for partial updates (only provided fields change). Use PUT only when the client sends the complete object.\n\n### Pagination\n\nPaginate list endpoints whose result can grow beyond a bounded, safe response.\nSmall closed enumerations may return the complete set when that bound is part\nof the contract:\n\n```typescript\n\u002F\u002F Request\n\u002F\u002F GET \u002Fapi\u002Ftasks?page=1&pageSize=20&sortBy=createdAt&sortOrder=desc\n\n\u002F\u002F Response shape\ntype PaginatedResult\u003CT> = {\n  readonly data: ReadonlyArray\u003CT>;\n  readonly pagination: {\n    readonly page: number;\n    readonly pageSize: number;\n    readonly totalItems: number;\n    readonly totalPages: number;\n  };\n};\n```\n\n### Filtering\n\nUse query parameters for filters:\n\n```\nGET \u002Fapi\u002Ftasks?status=in_progress&assignee=user123&createdAfter=2025-01-01\n```\n\n### Input\u002FOutput Separation\n\nSeparate what the caller provides from what the system returns:\n\n```typescript\n\u002F\u002F Input: what the caller provides\ntype CreateTaskInput = {\n  readonly title: string;\n  readonly description?: string;\n};\n\n\u002F\u002F Output: includes server-generated fields\ntype Task = {\n  readonly id: TaskId;\n  readonly title: string;\n  readonly description: string | null;\n  readonly createdAt: Date;\n  readonly updatedAt: Date;\n  readonly createdBy: UserId;\n};\n```\n\n## Common Rationalizations\n\n| Rationalization | Reality |\n|---|---|\n| \"We'll document the API later\" | The types ARE the documentation. Define them first. |\n| \"We don't need a bound for this growing list\" | Define pagination or another documented safe bound before the result can grow beyond one response. Closed, contractually bounded lists do not need ceremonial pagination. |\n| \"PATCH is complicated, let's just use PUT\" | PUT requires the full object every time. PATCH is what clients actually want. |\n| \"We'll version the API when we need to\" | Breaking changes without versioning break consumers. Design for extension from the start. |\n| \"They asked for the rename, so the break is authorised\" | A request for a clearer name is a request for the name, not for the breakage. Add the new name, keep the old one working, record it as superseded, and explain that choice in the reply — don't ship the break, and don't stall the work asking which was meant. |\n| \"Nobody uses that undocumented behavior\" | Hyrum's Law: if it's observable, somebody depends on it. |\n| \"Internal APIs don't need contracts\" | Internal consumers are still consumers. Contracts prevent coupling and enable parallel work. |\n| \"Retries are the client's problem\" | Without idempotency, retries create duplicates. Design for at-least-once delivery. |\n| \"We'll add an abuse control after this expensive public operation is attacked\" | Protect unauthenticated, costly, or abuse-prone operations from the start. Publish quota headers only when a client-visible quota is actually part of the contract. |\n| \"Error messages are just for debugging\" | Errors are part of your API's developer experience. Make them actionable, not diagnostic. |\n\n## Red Flags\n\n- Endpoints that return different shapes depending on conditions\n- Inconsistent error formats across endpoints\n- Error responses that expose stack traces or internal paths\n- Breaking changes to existing fields (type changes, removals)\n- Potentially unbounded list endpoints without pagination or another explicit bound\n- Verbs in REST URLs (`\u002Fapi\u002FcreateTask`, `\u002Fapi\u002FgetUsers`)\n- Third-party API responses used without validation\n- No typed input\u002Foutput schemas for endpoints\n- Retriable POST operations where duplicate attempts can repeat a state-changing effect and no idempotency strategy is defined\n- Documented quota policies whose responses do not expose enough state for clients to behave correctly\n- Retry logic without exponential backoff\n- Browser-served responses missing the entry point's applicable security headers\n- Custom `X-` prefixed headers (deprecated by RFC 6648)\n\n## Verification\n\nAfter designing an API:\n\n- [ ] Every endpoint has a typed output contract and typed input where input exists\n- [ ] Error responses follow a single consistent format (RFC 9457 for public APIs, or a simpler consistent shape for internal APIs)\n- [ ] Error responses never leak implementation details (stack traces, internal paths)\n- [ ] Untrusted representation\u002Fschema validation happens at trust boundaries; domain invariants remain enforced by their owner\n- [ ] Growing list endpoints have pagination or another documented safe bound\n- [ ] New fields are additive and optional (backward compatible), and no published name, type, status or route has been removed or repurposed by this change\n- [ ] Every superseded name is still served with its old value and is recorded as superseded where a consumer can see it\n- [ ] Naming follows consistent conventions across all endpoints\n- [ ] Contract defined before implementation (contract-first)\n- [ ] Retriable POST operations define how duplicate attempts avoid repeated effects\n- [ ] APIs with documented quota policies expose the client-visible limit state consistently\n- [ ] Content-Type is `application\u002Fproblem+json` for RFC 9457 responses, `application\u002Fjson` for simpler formats\n- [ ] Browser-facing entry points apply security headers suited to the served content and deployment policy\n- [ ] Caching strategy defined (explicit `Cache-Control`, ETags for revalidation, `Vary` where needed)\n\n## Attribution\n\nThis skill adapts Addy Osmani's MIT-licensed `api-and-interface-design` skill. Local history records the adaptation but not the original upstream import revision. See `resources\u002Fsource-notes.md` for the immutable audit baseline (which is not an import-revision claim), retained ideas, and local departures; see `LICENSE` for the applicable upstream notice.\n",{"name":5,"description":7},"main","9fac81929ac64b90ba023ba56f9f03fed440ebf4","skills\u002Farchitecture\u002Fapi-design",0,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills","https:\u002F\u002Fgithub.com\u002Fconjurer-rich","https:\u002F\u002Fconjurersolutions.co.uk","2026-11-13 18:56:34",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add conjurer-rich\u002Fskills --skill api-design",{"tool":39,"command":40},"bunx","bunx skills add conjurer-rich\u002Fskills --skill api-design",{"tool":42,"command":43},"pnpm","pnpm dlx skills add conjurer-rich\u002Fskills --skill api-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002FSKILL.md",true,[47,53,57,61,65,69,73,77],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"agents\u002Fopenai.yaml","REFERENCE","参考文档",236,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fagents\u002Fopenai.yaml",{"path":54,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":16},"LICENSE","许可证",1385,{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"resources\u002Fapi-evolution.md",6096,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fresources\u002Fapi-evolution.md",{"path":62,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":63,"sourceHtmlUrl":64},"resources\u002Fapi-security.md",13933,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fresources\u002Fapi-security.md",{"path":66,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":67,"sourceHtmlUrl":68},"resources\u002Fauth-security.md",3919,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fresources\u002Fauth-security.md",{"path":70,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":71,"sourceHtmlUrl":72},"resources\u002Fhttp-fundamentals.md",5912,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fresources\u002Fhttp-fundamentals.md",{"path":74,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":75,"sourceHtmlUrl":76},"resources\u002Fproblem-details.md",3425,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fresources\u002Fproblem-details.md",{"path":78,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":79,"sourceHtmlUrl":80},"resources\u002Fsource-notes.md",2465,"https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Farchitecture\u002Fapi-design\u002Fresources\u002Fsource-notes.md",[82,90,98,106,114,122],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":86,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":20},"01M7EC238PW7ZVSEM3KT72ND70","wtf","Re-explain the immediately previous LLM response when it did not land, using plain, precise UK English.","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fwtf\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fwtf\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":20},"01M7EC20Q2R2QA6P90TXSGSKBG","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fwriting-for-agents\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":102,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":20},"01M7EC1MRP6RBC3A15VHMB7JF0","technical-writing","Writing developer-facing prose that can be skimmed first and trusted enough to finish — READMEs, guides, tutorials, reference docs, proposals, PR descriptions, release notes. Load before drafting, rewriting, restructuring, or editing technical documents, when a doc reads as a wall of text, claims need receipts, or docs must serve AI agents. Covers reader-first structure, falsifiable claims, docs-as-behavior verification, and agent-readable reference shape. For sentence-level voice or generic AI-shaped prose use clarity; for plain English, lay readers, translation, or ASD-STE100 use simple-english; for recording a learning use expectations; for diagrams use diagrams; for API semantics use api-design.","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Ftechnical-writing\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Ftechnical-writing\u002FSKILL.md",[],[],{"skillNo":107,"name":108,"nameZh":6,"description":109,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":110,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":20},"01M7EC1H1892N589M88AY2YN44","teach","Teach the user a new skill or concept, within this workspace.","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fteach\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fteach\u002FSKILL.md",[],[],{"skillNo":115,"name":116,"nameZh":6,"description":117,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":118,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":20},"01M7EC1BMMSYAE572Z40WP637S","find-skills","Discover and, with authorization, install agent skills from the open skills ecosystem. Use when the user explicitly asks to find or install a skill from the external skills ecosystem, asks whether an installable agent skill exists for a task, or wants to extend agent capabilities through skills.sh or a skill repository. Not for choosing among already-installed local skills or selecting software libraries, developer tools, applications, services, frameworks, or platform primitives; use evaluate-existing-solutions for technology choices.","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Ffind-skills\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Ffind-skills\u002FSKILL.md",[],[],{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":126,"sourceHtmlUrl":127,"categories":128,"keywords":129,"publishedAt":20},"01M7EBYV7CHGZZAN0NHGF9TWWH","reduce-system-complexity","Reduce total mechanism in a selected existing system or behavior path while conserving its agreed observable behavior and non-functional guarantees. Use when the user explicitly wants fewer branches, states, dependencies, layers, flags, retries, jobs, adapters, or operational moving parts and needs evidence that complexity was removed rather than relocated. Supports read-only diagnosis and authorized reduction slices. Not for routine cleanup, architecture-investment discovery, module-contract design, physical tree design, new behavior, functionality cuts, speculative rewrites, or Redux\u002Ffunctional reducer functions.","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Freduce-system-complexity\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fconjurer-rich\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Freduce-system-complexity\u002FSKILL.md",[],[]]