跳到正文
cccskills
免费在 GitHub 公开

api-design

API design: REST conventions, OpenAPI, versioning, pagination, error format, GraphQL, webhooks.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane星标 3(GitHub 3 + cccskills 0)

实测评分 未实测

查看安装方法

包含的文件(3)

  • SKILL.md3.7 KB
  • references/anti-patterns.md1.1 KB
  • references/versioning-deprecation.md983 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

api-design — REST, GraphQL, Versioning & Docs

MANDATORY WORKFLOW

Antes de recomendar o generar cualquier diseño, completar estos pasos en orden.

Step 0: Gather Requirements

Clarificar (o inferir del contexto si ya fue especificado):

  1. ¿API nueva o extensión? (si es extensión, leer la existente primero)
  2. Tipos de clientes: SPA / mobile / third-party / server-to-server
  3. ¿Over-fetch o deeply nested relations? → influye en REST vs GraphQL
  4. Auth: JWT / API Key / OAuth / ninguna
  5. ¿Versioning desde día 1? ¿Hay clientes externos que no podemos romper?

Si el usuario ya especificó estos valores, saltar directamente al Step 1.

Step 1: Recomendar approach

Usar la tabla API Style Decision más abajo para elegir REST / GraphQL / gRPC. Explicar la elección en 1 oración.

Step 2: Diseñar + Verificar

Implementar el diseño. Al terminar, validar contra el Checklist al final de este documento.


API Style Decision

StyleUse when
RESTDefault. CRUD-dominant, cacheable, broad client support
GraphQLMultiple clients with very different shapes, deep nested relations, significant over-fetch
gRPCInternal service-to-service, streaming, strict contracts, performance-critical

REST Conventions

  • URLs: plural nouns, kebab-case, nesting max 2 levels, no verbs. Pattern: /api/v1/resources/{id}/sub-resources
  • Verbs: GET (read), POST (create, use Idempotency-Key if critical), PUT (full replace), PATCH (partial), DELETE
  • Pagination: cursor keyset over offset (offset drifts with concurrent writes, re-scans rows)
  • Response wrapper: { "data": [...], "pagination": { "cursor": "...", "hasMore": true } }
  • Filtering/sorting: ?filter[status]=active&sort=-createdAt&fields=id,name
  • Dates: ISO 8601 UTC. IDs: opaque (never auto-increment — reveals volume)
  • Rate limiting headers: X-RateLimit-Limit, X-RateLimit-Remaining, Retry-After

Error Format — RFC 9457 Problem Details

Fields: type (URI), title, status, detail, traceId (log correlation). Never invent a custom format. Never expose stack traces in production.

Schema-first Approach

  1. Recommended: OpenAPI spec first, generate types + client code
  2. Alternative (Fastify): Code-first with Zod, auto-generate OpenAPI via @fastify/swagger
  3. Monorepo: Share schemas in packages/api-types between backend and frontend
  4. Tooling: Lint (Spectral), mock (Prism), docs (Redocly/Scalar)

Versioning

  • Default: URL path (/v1/) — simple, cacheable, grep-friendly
  • Non-breaking (no bump): add optional field, new endpoint, new enum value
  • Breaking (requires bump): remove/rename field, change type, change status codes

→ Read references/versioning-deprecation.md for deprecation flow, support windows, and webhook outbound details

Anti-patterns

→ Read references/anti-patterns.md for 10 common API design anti-patterns with corrections

Checklist

  • URLs plural, no verbs, nesting max 2
  • Correct status codes, RFC 9457 errors with traceId
  • Cursor pagination with { data, pagination } wrapper
  • OpenAPI spec up-to-date and linted, generated types in client
  • Breaking changes trigger version bump
  • Deprecation headers + usage monitoring on old endpoints
  • Rate limit headers, auth documented per endpoint
  • Webhooks signed with HMAC

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Plan, design, and implement A/B tests and experiments with statistical rigor. Covers hypothesis frameworks, sample sizing, metrics, and result analysis.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Web/mobile accessibility decision guide: WCAG 2.2 AA, ARIA, keyboard nav, focus management, contrast, testing. Use for: a11y, accessibility, wcag, aria, screen reader, keyboard, contrast.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Generate, iterate, and scale ad creative for paid advertising across Google, Meta, LinkedIn, and X. Covers platform specs, creative frameworks, and quality validation.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Musica interactiva para juegos: layering vertical, re-secuenciacion horizontal, stingers, reglas de transicion con sync points, y mapeo de estados de gameplay a musica. Usar para: musica adaptativa, sistema de musica dinamica, transiciones musicales, combat music.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Design multi-agent systems, create agent architectures, define communication patterns, and build autonomous agent workflows with structured evaluation frameworks.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane32026年10月27日 更新

Inter-agent communication protocol for C-suite agent teams. Defines invocation syntax, loop prevention, isolation rules, response formats, and quality loops.

中文简介正在准备中。当前显示原文说明。

SebastianLuser/claude-code-arcane32026年10月27日 更新

查看 SebastianLuser 的全部技能

报告此技能的问题