This file is byte-identical to the first copy the registry indexed, one of 9 indexed copies. Same content hash, so the same checks give both the same grade.
api-endpoint from globalmpc/backendskills is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.
Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status codes), especially login and ones that read or change other users' data.
Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.
What the file says
# API endpoint
Examples are TypeScript with `pg`. The rules apply to any stack.
Anything that changes money, stock or balances, or calls a payment provider or email: also follow the
`data-integrity` skill (transactions, locks, idempotency).
## 1. Check who may call it, not just that they're logged in
Why: a logged-in user who changes the id in the URL reads or edits someone else's data (IDOR).
```ts
// Bad: any logged-in user can read any invoice
const { rows } = await pool.query("select * from invoices where id = $1", [id]);
// Good: scope the query to the caller; someone else's invoice looks the same as a missing one
const { rows } = await pool.query("select * from invoices where id = $1 and account_id = $2", [id, user.accountId]);
if (rows.length === 0) return sendError(res, 404, "not_found", "Invoice not found");
```
Admins or other roles get access through an explicit role check, never by skipping the filter.
## 2. Bad input is a 4xx, never a 500
Why: a 500 on bad input hides real errors in the noise. Bad values that slip through (negative amounts,
fractions) corrupt data.
…
The line at the top of this page pins the label git:20261105.6131a31, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.
GET https://markdownregistry.com/api/v1/artifacts/art_4xzd7kxper5ma2uq
GET https://markdownregistry.com/api/v1/resolve?ref=globalmpc/backendskills/api-endpoint
GET https://markdownregistry.com/api/v1/blob/c6cbb040af6956def1a6fc7e319305fb8bd7aab2f2ed3f03a0f4ce2e2bcc1a56
Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104173809-28998/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104173809-28998/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261105081443-28376/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261105081443-28376/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261105081443-28376/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/data-integrity/SKILL.md · Rules for code that writes to the database where two requests, retries or jobs can run at once. Use for anything that…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/db-migration/SKILL.md · Rules for database schema changes. Use for any new table, column, index, constraint, enum or trigger, any data…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104173809-13068/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-3-20261105081443-29284/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-3-20261104164959-7407/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104164959-23336/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261104164959-6498/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-3-20261104173809-29907/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261104173809-13068/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-2-20261105081443-12446/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…
globalmpc/backendskills · bench/results/2026-11-04/checkout-with-1-20261105081443-28376/skills/api-endpoint/SKILL.md · Rules for HTTP API endpoints. Use when adding or changing any endpoint (route, request or response shape, status…