api-conventions
Skill130 starsChanged 5 days agoMITView on GitHub
Response-body conventions for the Platypus backend API — the `error` key for failures, the `message` key for 2xx status messages, and when to throw a typed error instead of returning a response. Use when adding or changing a backend route or its tests.
11 other projects use a version of this.
Adopted by
Most recently taken up by
- LeanMeanCleanApps/CleanModelContextProtocoltheir own version, first seen Nov 8, 2026
- leroyguillaume/claudetheir own version, first seen Oct 30, 2026
- mx-space/coretheir own version, first seen Oct 30, 2026
- DataChuLee/Claude-Code-Settingtheir own version, first seen Oct 29, 2026
- Talkif-ai/skillstheir own version, first seen Sep 13, 2026
- TheDecipherist/claude-code-mastery-project-starter-kittheir own version, first seen Jun 26, 2026
Other versions11 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 11
- mx-space/core★ 567same name
- TheDecipherist/claude-code-mastery-project-starter-kit★ 337same name
- maxyeh0817/Forge★ 34same name
- harness-studio/harness-studio★ 9same name
- leroyguillaume/claude★ 7same name
- CodeWithBehnam/cc-docs★ 2same name
- lodetomasi/claude-code-training-lab★ 2same name
- onejaejae/skills★ 2same name
- DataChuLee/Claude-Code-Setting★ 1same name
- LeanMeanCleanApps/CleanModelContextProtocol★ 1same name
1 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository38 other files it gives its agents.
- .agents/skills/humanizer/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- add-api-endpointSkill
- ask-mattSkill
- card-conventionsSkill
- codebase-designSkill
- code-reviewSkill
- database-schema-changesSkill
- diagnosing-bugsSkill
- docs-auditSkill
- domain-modelingSkill
- form-conventionsSkill
- grillingSkill
- grill-meSkill
- grill-with-docsSkill
- handoffSkill
- humanizerSkill
- implementSkill
- implement-specSkill
- improve-codebase-architectureSkill
- platypus-toolsSkill
- pre-release-checkSkill
- prototypeSkill
- prSkill
- researchSkill
- retroSkill
- setup-matt-pocock-skillsSkill
- tddSkill
- teachSkill
- to-questionnaireSkill
- to-specSkill
- to-ticketsSkill
- triageSkill
- ui-conventionsSkill
- wait-whatSkill
- wayfinderSkill
- wizardSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 18
Never message on a 4xx/5xx — that is the one crossing the codebase does not make.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
API Response Conventions
The two keys
error carries a failure. message carries a 2xx status line for an
operation that has no resource to return.
return c.json({ error: "Workspace not found" }, 404);
return c.json({ message: "Board deleted" });Never message on a 4xx/5xx — that is the one crossing the codebase does not
make.
A delete or action with nothing to return answers 200 { message } — never a
bodiless 204, and never { success: true }.
A failure body is { error } and nothing else: no success, no detail fields
beside it. Three exceptions, each because a frontend client reads the extra shape:
| Failure | Body | Why |
| Request validation | 400 { error: Issue[] } | the form maps each issue's path onto its field |
| Agent promote, blocked | 422 { error, blockers } | the promote dialog lists what to make Shared first |
FileValidationError | 400 { error, files } | the write client parses the offending files |
Validating a request
Validate with validate(target, schema) from src/validate.ts, never with
sValidator directly — its default failure body adds success and echoes the
submitted body back as data.
app.post("/", requireAuth, validate("json", boardCreateSchema), async (c) => {
const data = c.req.valid("json");Choosing the verb
PATCH applies a partial update: only the fields sent change. PUT replaces
the resource whole. A resource has one address and one write verb per
operation — never both PUT and PATCH for the same update.
Checking a response
A route whose response has an exported response schema sends it through
respond(c, schema, value) from src/respond.ts instead of c.json. Under
test it parses the value against the schema, so a dropped field fails the
route's test rather than the frontend; production sends the value untouched.
The error seam
Seven cross-cutting failures are thrown, not returned. A single onError
seam maps each to its status and emits the same { error } body, so a domain
rule states its message once instead of once per caller:
| Throw | Becomes |
NotFoundError | 404 |
ValidationError | 400 |
LockedError | 403 |
ConflictError | 409 |
UnsupportedError | 501 |
UpstreamError | 502 |
RateLimitError | 429 |
A Postgres unique violation also maps to 409 — detect it through the shared
helper rather than re-reading the driver's error shape. So does a foreign-key
violation, as a backstop only: a delete guarded by a restrict reference
should throw a ConflictError naming what still uses the row first.
if (!row) throw new NotFoundError("Card not found");
throw new ValidationError("Invalid user assignee");A resource referenced in the request body that isn't in this Organization, or
isn't Shared, is a NotFoundError (404) naming what couldn't be used — not a
422, and no extra detail fields beside error.
Throwing is what lets one rule serve more than one surface: the Kanban rules
answer both the HTTP routes and the Agent tool set from a single place. Reach
for the seam whenever the failure is one of those six; a 4xx that only one
route can produce still answers inline with c.json({ error }, status). Both
are current and roughly equally common — the seam is not a migration you
should finish.
Test assertions
Assert against the key the response actually uses:
expect(body.error).toBe("Invalid user assignee");
expect(await res.json()).toEqual({ message: "Board deleted" });A service test covering a thrown failure asserts the error, not a body:
await expect(fn()).rejects.toThrow(NotFoundError);Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

