Skip to content
Back to skills

Api Design

ASecurity

REST API design best practices. Use when designing APIs, choosing status codes, or creating endpoints.

  • 69 stars
  • 0 votes
  • 2 copies
  • 24 views
  • Added May 27, 2026
developmentapi

Works with

  • cursor
  • api

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add Tibsfox/gsd-skill-creator --skill api-design --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Api Design?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Api Design
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tibsfox-api-design/badge)](https://www.skillsdirectory.com/skills/tibsfox-api-design)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: api-design
description: REST API design best practices. Use when designing APIs, choosing status codes, or creating endpoints.
version: 1.0.0
format: 2025-10-02
triggers:
  - "designing APIs, choosing status codes, or creating endpoints"
updated: 2026-04-25
status: ACTIVE
---

# REST API Design

## Endpoint Rules

- **Nouns, not verbs:** `/users` not `/getUsers` — HTTP method is the verb
- **Plural nouns:** `/users`, `/orders` — consistent collections
- **Kebab-case:** `/user-profiles` not `/user_profiles`
- **Max 2 levels nesting:** `/users/{id}/orders` — deeper use query params
- **No trailing slashes, no extensions**

## HTTP Methods

| Method | Purpose | Idempotent |
|--------|---------|------------|
| GET | Retrieve | Yes |
| POST | Create | No |
| PUT | Replace entire resource | Yes |
| PATCH | Partial update | No |
| DELETE | Remove | Yes |

## Status Codes

| Code | Use When |
|------|----------|
| 200 | Success with body |
| 201 | Resource created (+ Location header) |
| 204 | Success, no body (DELETE) |
| 400 | Malformed request |
| 401 | Not authenticated |
| 403 | Authenticated but forbidden |
| 404 | Not found |
| 409 | Conflict (duplicate) |
| 422 | Valid syntax, invalid semantics |
| 429 | Rate limited |

## Error Format

```json
{"error": {"code": "VALIDATION_ERROR", "message": "...", "details": [], "request_id": "req_..."}}
```

## Key Rules

- Always paginate lists (cursor-based preferred, max page size enforced)
- Never expose sequential IDs — use UUIDs
- Auth credentials in headers, never URLs
- Return 400 for unknown parameters (catch typos)
- Include request_id in every response

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…