pwp-api-design

A set of rules for designing web APIs, which are interfaces that let software exchange requests and responses. It covers URL patterns, response codes, errors, filtering, sorting, pagination, and versioning.

In plain words
What is it for?
Use it when creating, reviewing, or planning API endpoints and their request and response formats.
Why use it?
It helps prevent APIs from becoming inconsistent or difficult to use, test, and debug. Clear conventions make their behaviour easier for other developers to predict.

Skill for Claude CodeCodex

Part of the pwp plugin — 11 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/shandar/pwp-plugin/pwp-api-design
Any agent
npx skills add shandar/pwp-plugin --skill pwp-api-design
Clone the repo
git clone --depth 1 https://github.com/shandar/pwp-plugin

Made for: Claude Code, Codex.

Or install pwp, the plugin that ships this one along with the rest of its 11 skills.

Per session 106 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 815 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00106 $0.00815
Opus 5 $0.00053 $0.00407
Sonnet 5 $0.00021 $0.00163
Haiku 4.5 $0.00011 $0.00081

Measured 2d ago against content hash 6f85812c4794, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

pwp-api-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/pwp-api-design/SKILL.md · 92 lines

How it starts

The opening of the file, as written. The whole thing — 92 lines — stays where its author put it; the contents beside it link to each section on GitHub.

API Design Skill

This skill defines standards for designing and reviewing APIs. Consistency and predictability are non-negotiable.

API Design Principles

  1. Consistency over cleverness. Every endpoint follows the same patterns.
  2. Predictability over flexibility. Predictable APIs are easier to consume, test, and debug.
  3. Explicit over implicit. Errors should be clear. Status codes should be correct.

REST API Conventions

URL Structure

GET    /api/v1/{resources}          → List
GET    /api/v1/{resources}/{id}     → Get one
POST   /api/v1/{resources}          → Create
PUT    /api/v1/{resources}/{id}     → Replace
PATCH  /api/v1/{resources}/{id}     → Partial update
DELETE /api/v1/{resources}/{id}     → Delete

Rules: plural nouns, no verbs in URLs, max 2 levels of nesting, query params for filtering/sorting/pagination.

HTTP Status Codes

Code Meaning When to Use
200 OK Successful GET, PUT, PATCH
201 Created Successful POST
204 No Content Successful DELETE
400 Bad Request Invalid input
401 Unauthorized Missing/invalid auth
403 Forbidden Insufficient permissions
404 Not Found Resource doesn't exist
409 Conflict Duplicate/state conflict
422 Unprocessable Semantic errors
429 Too Many Requests Rate limited
500 Server Error Unhandled exception

Response Envelope

// Success
{ "data": { ... }, "meta": { "page": 1, "per_page": 20, "total": 142 } }

// Error
{ "error": { "code": "VALIDATION_ERROR", "message": "Email is required", "details": [...] } }

Pagination

Offset-based: ?page=2&per_page=20 Cursor-based (large datasets): ?cursor=abc123&limit=20

Filtering & Sorting

?category=electronics&min_price=100&sort=-created_at

Versioning

  • Version in URL path: /api/v1/...
  • Old versions supported 6+ months after deprecation

Input Validation

  • Validate at the boundary
  • Return specific errors with field-level details
  • Reject or ignore unknown fields

Read the full file on GitHub · 92 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 92 lines · 106 tokens per session scan A 6f85812c4794

Subscribe to this mod's changes

pwp-api-design is a skill published in the GitHub repository shandar/pwp-plugin (1 stars, last pushed 6mo ago), licensed MIT. It adds 106 tokens to every session and 815 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.