/everything-backend:backend-api-designfrom everything-backend
Designs API contracts before code is written: resources, endpoints, request/response schemas, error format, pagination, versioning, and per-endpoint authorization rules. Writes to OpenAPI spec and records conventions in api-patterns.md memory. Covers REST fully; basic guidance for GraphQL and gRPC.
Ships in everything-backend. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Design the contract first. This skill produces a reviewed API contract and the memory entries that downstream skills consume. It does not write handler code.
Coverage: REST and OpenAPI are fully covered. GraphQL and gRPC guidance is basic (schema shape, errors, limits, breaking-change checks); rely on the framework's own docs for anything deeper.
.proto file.Not for:
backend-implement after this skill.backend-auth. This skill records only which endpoints need auth and which role or ownership rule applies.backend-security.backend-debug._shared/ inside this skill's folder (bundled installs), then ../_shared/ next to it; other fallbacks are in <shared>/context-loading.md -> Resolving _shared/ Files. A missing shared doc is a warning, not a stop.<shared>/tool-rules.md (mode=auto contract, checkpoints) and <shared>/host-tools.md if the action names below don't match your host's tools. Read <shared>/principles.md -> API and Security; apply them to every endpoint. Read <shared>/memory-schema.md -> api-patterns.md before writing memory.<shared>/context-loading.md: project-overview.md, tech-stack.md, api-patterns.md (conventions and endpoint inventory), db-schema.md (the data the API exposes), and decisions.md (prior protocol and versioning decisions). If memory is empty or stale, suggest running backend-scan first; if the user declines, continue with what the codebase shows.<shared>/stacks/, read it.<shared>/sql-safety.md -> The Rules (rules 2-6 and 10 shape the contract) and <shared>/secure-coding.md -> S1, S2, S3, S9, S14, S15 and S16 (strict schemas with unknown fields rejected, separate input and output schemas, per-operation auth, redirect and URL parameters, CORS, size and page limits, webhook signatures). The contract is the first line of defense against injection and BOLA; Step 4a turns those rules into schema constraints.Ask once, in a single message, only for what memory and the request do not already answer:
Confirm the resource list back: "Resources: [list]. Did I miss any?"
Stop and ask if no resource or no consumer can be identified. Do not invent a domain.
Output: a confirmed list of resources, operations, consumers and access rules.
Before proposing anything, look at what exists:
**/openapi*.{yaml,yml,json}, **/swagger*.{yaml,yml,json}, **/*.proto, **/*.graphql, **/*.gql, buf.yaml. Skip node_modules, vendor and build output.@app.get, router., @GetMapping, HandleFunc, resolver and service definitions).api-patterns.md endpoint inventory. Note drift in either direction.Rules:
Output: the contract file path to use, the conventions to follow, and any drift found.
Default to REST unless the project already uses another protocol or the needs clearly call for one.
| Protocol | Choose when | Watch out for |
|---|---|---|
| REST | CRUD, web and mobile clients, third-party consumers, HTTP caching matters | Over- or under-fetching, many round trips |
| GraphQL | Many clients with different data needs over one graph | N+1 queries, query cost abuse, harder HTTP caching |
| gRPC | Internal service-to-service calls, streaming, strict typed contracts | Limited browser support (needs gRPC-Web or a gateway), harder debugging |
Mixed is fine (for example REST for public clients, gRPC between services). Record a protocol choice that is new to the project in decisions.md in Step 7.
Output: the protocol per consumer group, with a one-line reason.
Apply references/rest-conventions.md (naming, methods, status codes, pagination, casing). For GraphQL use references/graphql.md; for gRPC use references/grpc.md.
For every endpoint or operation, define:
id, role, ownerId, createdAt, status set by workflows) are never accepted from the body.references/errors.md)./{id} resource.Idempotency-Key header.Cache-Control for the response. Authenticated responses default to private, no-store.Feature-specific patterns (file upload, real-time, search, bulk, long-running jobs, inbound webhooks, user-supplied URLs) are in references/feature-patterns.md.
Output: an endpoint table with the nine items above for each endpoint.
Any parameter a public client can send will be tried with hostile input. Constrain it in the spec so generated validators reject it at the boundary (<shared>/sql-safety.md rule 10: defense in depth, never the fix itself):
| Input | Contract rule | sql-safety.md |
|---|---|---|
sort, order | enum of public sort keys (createdAt, -createdAt, ...); direction is asc/desc or a - prefix, never free text | rule 2 |
fields, include, expand | array of enum values with maxItems; never a column or relation name passed through | rule 2 |
| Filters | one named parameter per allowed field, each with a type and format/enum; no generic filter=<expression>, where= or raw JSON query object | rules 2, 4, 9 |
| Ids (path, query, body) | typed: format: uuid, or a digit pattern (^[1-9][0-9]{0,18}$) for integer ids sent as strings | rule 1 |
Id lists (ids, bulk bodies) | array of typed ids with maxItems (for example 100) and uniqueItems | rules 4, 5 |
Search (q, nameContains) | minLength, maxLength (for example 100); document that % and _ match literally | rule 6 |
Page size (limit, pageSize, first) | minimum: 1, maximum (for example 100), a default | rule 4 |
| Cursor | maxLength; opaque to the client; the server decodes it, validates every key, and returns 400 when malformed | rule 1 |
Rules for the design:
createdAt); the server maps it to a column through a fixed allowlist. The API layer never forwards a raw client string into a query, an ORDER BY, a column list or a NoSQL filter. Record this under Conventions in api-patterns.md so backend-implement builds the map./{id} operation's access rule (item 6) names the owner or tenant key the server binds from the authenticated principal (sql-safety.md rule 3). The id in the path selects the row; it does not authorize it. A row owned by someone else returns 404 (or 403, per the project convention).ownerId, tenantId or userId as a filter that widens access. A client may narrow its own results, not choose whose rows it reads.sql-safety.md rule 12).Output: every list, search and /{id} endpoint in the table shows its allowlisted sort/field/filter values, typed ids, page-size maximum, search length limit and owner binding.
Decide once per API and reuse the existing choice when there is one:
references/errors.md.references/rest-conventions.md.references/versioning.md.Retry-After (algorithm and store are an ops concern; flag them for backend-ops).Output: a short conventions list that goes into api-patterns.md.
mode=interactive, wait for approval. In mode=auto, continue and list any assumptions in the final report.node <shared>/scripts/checkpoint.js start --skill backend-api-design --feature <slug>. Record each file you create or edit (checkpoint.js record), snapshot after each step, and close it when done. If the start exits with code 3, an open checkpoint exists: offer to resume it or restart. If Node is unavailable, follow <shared>/tool-rules.md -> Concurrent & Partial Work by hand.docs/api/openapi.yaml from references/openapi-template.md.docs/api/schema.graphql.proto/<package>/v1/<service>.proto.$ref resolves, every operation has an operationId, every protected operation has security, and every error response has a schema.sort/order/fields/filter (each is an enum or array of enum), every page-size parameter has a maximum, every search or free-text string has a maxLength, every id has a format or pattern, every array has maxItems. Each operation that takes these parameters lists a 400 response.buf lint for proto). Installing one is a dependency install and needs approval first (see <shared>/tool-rules.md -> Always Ask First). If none is available, do the checks above by reading the file.db-schema.md. List any field that has no backing column or derivation, and any table the design needs that does not exist yet.references/versioning.md). A breaking change needs explicit user approval and a version or deprecation plan.Output: the written contract file, lint or manual-check results, and the db-schema gap list.
Update .opencode/everything-backend-memory/ using the formats in <shared>/memory-schema.md:
api-patterns.md: Protocol, Base Path, Authentication (the requirement per endpoint family; the mechanism comes from backend-auth), Conventions (casing, pagination, error shape, versioning), Error Codes, Rate Limiting, and the Endpoints inventory. The inventory is append-only; mark removed endpoints deprecated.decisions.md: one entry per new decision (protocol, versioning scheme, error format, design-first vs code-first), with context and consequences.Record each memory file in the checkpoint (checkpoint.js record --memory <file>), then close it (checkpoint.js close --skill backend-api-design --feature <slug>).
State the next skill and what it consumes:
backend-auth: the auth mechanism and login, refresh, logout and password endpoints, when the design needs auth and none is recorded yet.backend-db-design: tables or columns from the db-schema gap list.backend-implement: builds the endpoints from the contract file and the endpoint table.backend-test: contract tests against the spec (status codes, error shapes, access rules) and the hostile-input negative tests in <shared>/sql-safety.md -> Verification, step 4, for every sort, filter, search and id parameter.backend-security: review before a public or third-party launch.api-patterns.md and, for new decisions, decisions.md.Done when:
api-patterns.md inventory./users/{id}/orders); link deeper relations by ID, or consider GraphQL.backend-ops.references/versioning.md).backend-auth.references/rest-conventions.md: read when designing REST paths, methods, status codes, pagination, casing, PATCH semantics, concurrency (ETag/If-Match), caching or idempotency keys.references/errors.md: read when defining the error format, error codes, or headers on 401, 429 and 503.references/openapi-template.md: read when creating a new OpenAPI spec, checking that an existing one is complete, or writing sort, field, filter, search or id parameters (it has ready-made allowlisted components).<shared>/sql-safety.md: read before Step 4 and whenever a parameter feeds a query (sort, filter, search, ids, bulk).references/versioning.md: read when choosing a versioning scheme, changing an existing endpoint, or deprecating one.references/feature-patterns.md: read when the feature includes file upload, real-time (WebSocket/SSE), search, bulk operations, long-running jobs, inbound webhooks or user-supplied URLs.references/graphql.md: read when the protocol is GraphQL.references/grpc.md: read when the protocol is gRPC or the contract is a .proto file.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
api-design, openapi, contract-first, api-planning, endpoint-design
npx claudepluginhub codeworksid/everything-backend --plugin everything-backend16 skills in this plugin
/backend-architectDesigns backend architecture for new and existing systems, including architecture pattern (monolith, modular monolith, microservices, serverless), tech stack, module boundaries, consistency rules and non-functional targets, then records the result as docs/architecture/overview.md, numbered ADR files in docs/adr/ and project memory. Use when the user says "design the architecture", "plan the backend", "how should I structure this", "what tech stack should I use", "should we split into microservices", "write an ADR", "redesign this system", or is starting a new project or a major feature. Hands diagrams to backend-visualize and detailed schema and API work to backend-db-design and backend-api-design./backend-authDesigns, implements and hardens authentication and authorization for backend services, covering sessions, JWT and opaque tokens, OAuth 2.0/OIDC and SSO, API keys, password hashing, account recovery, MFA, RBAC/ABAC, tenant isolation, CSRF and session hardening. Writes the auth core (verifier, middleware, authorization gate), records the auth decision in project memory, and defines the negative tests that prove it. Use when the user says auth, authentication, authorization, login, sign up, sign in, logout, session, JWT, refresh token, OAuth, OIDC, SSO, SAML, SCIM, API key, MFA, 2FA, passkey, WebAuthn, password reset, CSRF, roles, permissions, RBAC, access control, multi-tenant access, or asks to review or harden an existing auth flow.Other plugins' skills for the same job