mcpbeat Sign in

API Design Agent Skill

Backend API design specialist. Use when building REST/GraphQL APIs, designing endpoints, data models, or backend architecture. Covers RESTful principles, HTTP semantics, error handling, versioning, and OWASP-aligned security.

1k tokens
context cost
the whole folder, loaded on every use
1
files
instructions only
0
copies elsewhere
how many repositories repackaged it
112
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/selmakcby/claude-agents-skills --skill api-design

The instruction itself

15 sections, as written by the author

<!--

Source: wshobson/agents (backend-development plugin)

File: https://github.com/wshobson/agents/tree/main/plugins/backend-development/skills/api-design-principles

Used by: builder agent (backend)

-->

API Design Principles

When to trigger

  • Designing a new API endpoint
  • Adding routes to existing API
  • Database schema work that affects API contract
  • Keywords: "endpoint", "API", "route", "backend", "server", "REST", "GraphQL"

Core RESTful principles

Resource-oriented URLs

  • Nouns, not verbs: /users/123, not /getUser?id=123
  • Pluralize resources: /orders, not /order
  • Nest only when expressing parent/child: /users/:id/orders
  • Max 2 levels deep — beyond that, use query params

HTTP methods (correct semantics)

| Method | Use for | Idempotent | Safe |

|--------|---------|------------|------|

| GET | Read | Yes | Yes |

| POST | Create | No | No |

| PUT | Replace (full update) | Yes | No |

| PATCH | Partial update | No* | No |

| DELETE | Remove | Yes | No |

\* PATCH can be idempotent depending on semantics.

Status codes (correct use)

  • 200 OK — successful GET/PUT/PATCH with body
  • 201 Created — successful POST creating resource
  • 204 No Content — successful DELETE or action with no body
  • 400 Bad Request — validation failure
  • 401 Unauthorized — missing/invalid auth
  • 403 Forbidden — authenticated but not authorized
  • 404 Not Found — resource doesn't exist
  • 409 Conflict — version mismatch, duplicate resource
  • 422 Unprocessable Entity — semantic validation failure
  • 429 Too Many Requests — rate limited
  • 500 Internal Server Error — unhandled server fault

Response envelope

Consistent shape for all responses:

{
  success: boolean
  data: T | null
  error: string | null
  metadata?: { total, page, limit }
}

Endpoint design patterns

Pagination

  • Cursor-based for large/changing sets: ?cursor=abc&limit=20
  • Offset-based for small stable sets: ?page=1&limit=20
  • Always cap limit server-side (max 100)

Filtering

  • Query params: ?status=active&created_after=2024-01-01
  • Sort: ?sort=-created_at (minus prefix = descending)

Versioning

  • URL path: /v1/users, /v2/users (easiest to deprecate)
  • Never introduce breaking changes to existing version

Security (mandatory)

  • Authentication — every non-public endpoint checks auth first
  • Authorization — row-level checks, not just auth-exists
  • Input validation — Zod schema on every request body + query
  • Rate limiting — public routes + AI/LLM routes especially
  • CORS — whitelist, not *
  • Output filtering — never leak internal IDs or PII in error messages
  • Webhook signatures — verify signature before trusting payload

Error handling

  • Never expose stack traces to the client
  • Log server-side with request ID
  • Return structured error: { code: "INVALID_INPUT", message: "...", field: "email" }
  • HTTP status code must match error type

Output format

## API Design Summary

### Endpoint
`<METHOD> /path/to/resource`

### Purpose
<what it does, who uses it>

### Request
- **Auth:** <required | optional>
- **Body schema:** Zod
- **Query params:** ...

### Response
- **200:** <shape>
- **Error cases:** 400, 401, 403, 404, 422, 429, 500

### Security checks
- [ ] Auth verified
- [ ] Authorization verified (row-level)
- [ ] Input validated (Zod)
- [ ] Rate limit applied
- [ ] PII not leaked in errors

### Dependencies
- Database tables: <list>
- External services: <list>

Rules

  • RESTful first. Only use GraphQL / RPC if there's a concrete reason.
  • No breaking changes to existing API versions. Ever.
  • Every endpoint validates input — no "we'll add validation later".
  • Every endpoint has a test (unit for business logic, integration for HTTP layer).
  • Document before coding. OpenAPI spec or at least a Markdown contract.
  • Rate limit on day 1 — retrofitting is painful.

Other skills for the same job

different authors, same section of the catalogue
Codebase Cleanup Deps Audit
by ComeOnOliver
×2

You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.

10k tokens
Security Best Practices
by openai
vendor ×1

Perform language and framework specific security best-practice reviews and suggest improvements. Trigger only when the user explicitly requests security best practices guidance, a security review/report, or secure-by-default coding help. Trigger only for supported languages (python, javascript/typescript, go). Do not trigger for general code review, debugging, or non-security tasks.

103k tokens
Better Auth
by mrgoonie
×1

Implement authentication and authorization with Better Auth - a framework-agnostic TypeScript authentication framework. Features include email/password authentication with verification, OAuth providers (Google, GitHub, Discord, etc.), two-factor authentication (TOTP, SMS), passkeys/WebAuthn support, session management, role-based access control (RBAC), rate limiting, and database adapters. Use when adding authentication to applications, implementing OAuth flows, setting up 2FA/MFA, managing user sessions, configuring authorization rules, or building secure authentication systems for web applications.

46k tokens scripts
Repomix
by mrgoonie
×1

Package entire code repositories into single AI-friendly files using Repomix. Capabilities include pack codebases with customizable include/exclude patterns, generate multiple output formats (XML, Markdown, plain text), preserve file structure and context, optimize for AI consumption with token counting, filter by file types and directories, add custom headers and summaries. Use when packaging codebases for AI analysis, creating repository snapshots for LLM context, analyzing third-party libraries, preparing for security audits, generating documentation context, or evaluating unfamiliar codebases.

27k tokens scripts
Dependency Management Deps Audit
by lingxling
×1

You are a dependency security expert specializing in vulnerability scanning, license compliance, and supply chain security. Analyze project dependencies for known vulnerabilities, licensing issues, outdated packages, and provide actionable remediation strategies.

7k tokens
Hubspot Integration
by lingxling
×1

Expert patterns for HubSpot CRM integration including OAuth authentication, CRM objects, associations, batch operations, webhooks, and custom objects. Covers Node.js and Python SDKs.

5k tokens
Security Best Practices
by christophacham
×1

Perform language and framework specific security best-practice reviews and suggest improvements. Use when the user explicitly requests security best practices guidance, a security review or report, or secure-by-default coding help. Supports Python, JavaScript/TypeScript, and Go. Do NOT use for general code review, debugging, threat modeling (use security-threat-model), or non-security tasks.

102k tokens
API Gateway Configuration
by ComeOnOliver
×1

Configures API gateways for routing, authentication, rate limiting, and request transformation in microservice architectures. Use when setting up Kong, Nginx, AWS API Gateway, or Traefik for centralized API management.

525 tokens

How to use it

Copy the folder

Take selmakcby/api-design from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.