Skip to main content
skill CX Codex

rest-api-design · secondsky — Claude Code skill: REST API conventions

This skill hands your agent a set of REST conventions: resource names, HTTP methods, status codes and JSON response shape. Useful when you start a new API or want existing endpoints to match.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add secondsky/claude-skills --skill rest-api-design -a claude-code
Open on GitHub

What rest-api-design does

The skill covers endpoint naming and method mapping. Resources are plural nouns with a slash hierarchy, so GET /api/users/123/orders is fine while /api/getUsers or /api/createUser is not.

Tables inside spell out methods and status codes. GET and PUT are idempotent, POST is not; a successful create returns 201, a delete returns 204, validation failures return 400, and rate limiting returns 429. Responses use an envelope with data, meta and requestId; collections add a pagination block with page, limit, total, totalPages plus self and next links.

A separate section handles query parameters: filtering, sorting with a leading minus, paging and field selection. The skill advises versioning through the path (/api/v1/) and documenting with OpenAPI/Swagger. There is no spec generator here — it is a convention set your agent follows while writing and reviewing endpoints.

What it helps with

  • name endpoints with nouns instead of verbs
  • pick the right status code for create and delete
  • add pagination and links to a collection response
  • settle on one JSON envelope across all endpoints
  • define filtering, sorting and field selection in query params

Example prompts for the agent

  • design a REST API for orders: resources, methods, status codes
  • check my endpoints against REST conventions
  • add pagination and links to the users list response

How to install rest-api-design

1Skills CLI (Vercel)

npx skills add secondsky/claude-skills --skill rest-api-design -a claude-code

2Manually: put the files in place

~/.claude/skills/rest-api-design/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/rest-api-design/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about rest-api-design

How do I install rest-api-design in Claude?

Run npx skills add secondsky/claude-skills --skill rest-api-design -a claude-code. The skill lands in ~/.claude/skills/rest-api-design/SKILL.md.

What does rest-api-design do?

It gives your agent rules for REST API design: resource naming, HTTP methods, status codes, response format and query parameters.

Does the skill work outside Claude?

Yes. It also installs into Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode — only the -a flag changes.

Source text

SKILL.md · MIT
---
name: rest-api-design
description: Designs RESTful APIs with proper resource naming, HTTP methods, status codes, and response formats. Use when building new APIs, establishing API conventions, or designing developer-friendly interfaces.
license: MIT
---

# REST API Design

Design RESTful APIs with proper conventions and developer experience.

## Resource Naming

```
# Good - nouns, plural, hierarchical
GET    /api/users
GET    /api/users/123
GET    /api/users/123/orders
POST   /api/users
PATCH  /api/users/123
DELETE /api/users/123

# Bad - verbs, actions in URL
GET    /api/getUsers
POST   /api/createUser
POST   /api/users/123/delete
```

## HTTP Methods

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

## Status Codes

| Code | Meaning | Use For |
|------|---------|---------|
| 200 | OK | Successful GET, PATCH |
| 201 | Created | Successful POST |
| 204 | No Content | Successful DELETE |
| 400 | Bad Request | Validation errors |
| 401 | Unauthorized | Missing auth |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource doesn't exist |
| 429 | Too Many Requests | Rate limited |

## Response Format

```json
{
  "data": {
    "id": "123",
    "type": "user",
    "attributes": {
      "name": "John",
      "email": "[email protected]"
    }
  },
  "meta": {
    "requestId": "req_abc123"
  }
}
```

## Collection Response

```json
{
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 150,
    "totalPages": 8
  },
  "links": {
    "self": "/api/users?page=1",
    "next": "/api/users?page=2"
  }
}
```

## Query Parameters

```
GET /api/products?category=electronics    # Filtering
GET /api/products?sort=-price,name        # Sorting
GET /api/products?page=2&limit=20         # Pagination
GET /api/products?fields=id,name,price    # Field selection
```

## Best Practices

- Use nouns for resources, not verbs
- Version API via URL path (`/api/v1/`)
- Return appropriate status codes
- Include pagination for collections
- Document with OpenAPI/Swagger

© secondsky · MIT · secondsky/claude-skills

Similar skills

Everything for Backend and APIs →

rest-api-design by other authors comes first.

From the same set89

vitest-testing A skill that teaches your agent to write unit and integration tests with Vitest in TypeScript and JavaScript projects. Handy when you need config, mocks and coverage set up fast. CX Codex +1 1,200installs motion A skill that feeds your agent the Motion (Framer Motion) docs for React: drag-and-drop, scroll effects, layout transitions. Useful when the agent guesses at props. CX Codex +1 1,100installs playwright A Playwright skill for browser automation and end-to-end testing. It finds your running dev server and writes the test script for the task. CX Codex +1 1,000installs api-testing A skill that gets your agent writing HTTP API tests: Supertest for TypeScript, httpx and pytest for Python. Covers REST, GraphQL and error handling. CX Codex +1 890installs web-performance-optimization A skill that walks your agent through code splitting, lazy loading, caching and Core Web Vitals monitoring for web apps. CX Codex +1 557installs api-authentication A skill that helps your coding agent write API authentication: JWT, OAuth 2.0, API keys, sessions and security headers. CX Codex +1 533installs web-performance-audit A skill that audits page speed: pulls Core Web Vitals, finds bottlenecks and points at what to fix. Useful when LCP or CLS drifts out of range. CX Codex +1 526installs kpi-dashboard-design A skill that guides the agent through KPI dashboard design: metric choice, layout, chart types and status colors. Useful when you build analytics views for leadership. CX Codex +1 507installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor