/meta-planning-api-planning:meta-planning-api-planningfrom meta-planning-api-planning
Guides writing backend API specifications: endpoint contracts (method, path, auth, rate limit, request, error catalog), database schema (typed columns, constraints, indexes, migration strategy), and middleware order. Loads when a spec adds or changes an endpoint, table, or request pipeline.
Ships in meta-planning-api-planning. 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.
Read when SKILL.md points to them.
Quick Guide: Specify each endpoint as a contract a consumer can code against without asking: method, path, auth, rate limit, request, success response, and a status for every failure. Specify each table as typed, constrained columns, indexes with the query each serves, and a migration strategy, and state the middleware order. Three facts change the answer more often than expected: a partial update is
PATCH, notPUT; a unique index that includes a nullabledeletedAtdoes not stop duplicate live rows in most SQL databases; and renaming a column without an outage takes three phases, not one migration.
Detailed Resources:
Ask each question on its own; a spec that adds an endpoint and a table carries both sections. A section with nothing to say is left out rather than filled.
<critical_requirements>
Read the closest existing route, schema file and middleware chain, and cite each by file and line range. Their naming, pagination, response envelope and auth wiring are the vocabulary the spec reuses; a shape invented beside them diverges, and every consumer inherits the inconsistency.
Give every endpoint its whole contract — method and path, auth, rate limit, request, success response and error catalog. A part the spec leaves out is decided by the implementer, and decided again, differently, by each consumer.
Name the consumers of every contract the spec changes, and what breaks for each. Frontends, other services and external clients code against these shapes and status codes, and a change that names none ships without knowing who it breaks.
Write schema as typed columns with their constraints, indexes with the query each serves, and a migration strategy. A nullable, unique or foreign-key decision the spec omits is made by whoever writes the migration, and reversing it later is a second migration against production data.
</critical_requirements>
Auto-detection: <api_contract>, <database_schema>, <middleware_requirements>, API spec, endpoint contract, request and response shape, error catalog, status code per condition, auth per endpoint, rate limit, schema spec, soft delete, unique index, migration strategy, backfill, expand and contract, middleware order
Applies to:
Handled elsewhere:
An API contract is a promise to consumers you cannot see. An ambiguous one does not stay ambiguous: the implementer resolves it one way and each consumer another, and the mismatch surfaces later as a bug in someone else's code.
So a backend spec is as much about what it leaves out:
Every endpoint the spec adds or changes carries all six parts.
- [ ] Method and exact path, with path parameters named (`GET /api/v1/users/:userId`)
- [ ] Auth: middleware and permission, or explicitly public (Pattern 2)
- [ ] Rate limit, or explicitly none
- [ ] Request: each parameter's location (path/query/body), type, required flag, constraints
- [ ] Success response: status code and body shape with field types
- [ ] Error catalog: a row per condition (Pattern 3)
BAD: "Create an endpoint for user management"
GOOD: "GET /api/v1/users — cursor pagination as in routes/jobs.ts:45-67, at most 50
per page. Response shape matches JobListResponse."
A list endpoint's constraints include its maximum page size; without one, a client can ask for the whole table in a single request.
Where the codebase generates a machine-readable API description from its routes — an OpenAPI document, say — the changed endpoint appears in it, and the spec's success criteria include that the description still generates. Consumers and client generators read that document, not the spec.
Full template: examples/core.md
Name the middleware and the permission for each endpoint. "Protected" leaves each route to decide for itself, and one ships public.
BAD: "Endpoints should be protected"
GOOD: "GET /api/v1/users requires authMiddleware. DELETE /api/v1/users/:id requires
authMiddleware + adminGuard. Public: POST /api/v1/auth/login."
ownerGuard: the caller's own resource only) or tenancy: the object-level rule where the endpoint takes an id, and the row scope (whose rows the caller sees) where it returns a collection. Authentication alone lets any signed-in caller reach any object by changing the id, which is the first entry in OWASP's API Security Top 10 (2023), and a collection with no stated scope returns every caller's rows.WWW-Authenticate header; 403 says the caller is known and refused, so signing in again changes nothing.Every condition a consumer can hit gets a status and a body, in a table the consumer branches on. Without one, every client wraps every call in a generic catch.
| Status | Condition | Body |
|---|---|---|
| 400 | Request fails schema validation | { error: string, details: [...] } |
| 401 | Missing or expired credentials | { error: string } |
| 403 | Authenticated, but not permitted | { error: string } |
| 404 | Resource not found | { error: string } |
| 409 | Duplicates an existing resource | { error: string } |
| 422 | Valid request a business rule refuses | { error: string } |
| 429 | Rate limit exceeded | { error: string }, with Retry-After |
application/problem+json, with type, title, status, detail and instance) is the standard shape to adopt.Full template: examples/core.md
Specify each table as exact columns, never as prose.
- [ ] Each column: name, type with length or precision, NOT NULL / UNIQUE / FK / default
- [ ] Pattern source: the existing schema file whose conventions it follows
- [ ] Audit and soft-delete columns per that convention, and the `deletedAt is null` filter every query applies — reads, updates and deletes alike
- [ ] Relationships: cardinality, and the FK or join table that carries each
- [ ] Indexes: columns, kind (ordinary, or the full-text / inverted kind a search or containment query needs), unique or not, which rows, and the query or rule each serves
BAD: "Add a users table"
GOOD: "Add users following db/schema/jobs.ts:12-45: audit columns, soft delete
(deletedAt), email unique among live rows — a unique index on email
restricted to rows where deletedAt is null."
Full template: examples/core.md
Every schema change states three things before implementation starts, so an irreversible step is a decision rather than something found during the deploy.
| Concern | State |
|---|---|
| Reversibility | Reversible (and how), or irreversible and why that is acceptable |
| Data migration | None, or describe: source of the backfilled values, and the batch plan |
| Downtime | None, or why it is required and the window |
Full template: examples/core.md
Order is behaviour, so the spec states the pipeline for each route group it touches.
1. Rate limit keyed by IP — if the group has one
2. Auth — which middleware
3. Rate limit keyed by user or API key — if the group has one
4. Input validation — which schema
5. Handler
6. Response serialization
Full template: examples/core.md
<red_flags>
Breaks at runtime:
(email, deletedAt) meant to keep emails unique among live rows — most SQL databases treat NULLs as distinct in a unique index, so two live rows with the same email both insert. Specify the rule as "unique among rows where deletedAt is null" and how the database enforces it: a partial (filtered) unique index, where it has one.PUT whose body fields are all optional — PUT replaces the resource with the body, so a client that omits a field expects it cleared while the server keeps it. Partial updates are PATCH.POST that creates or charges with no retry rule — POST is not idempotent, so a client that times out and retries creates a second one. Specify how a retry is recognised, usually by a client-sent idempotency key.Surprising behaviour:
</red_flags>
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub agents-inc/skills --plugin meta-planning-api-planningOther plugins' skills for the same job