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.
npx skills add secondsky/claude-skills --skill rest-api-design -a claude-codeWhat 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-code2Manually: put the files in place
~/.claude/skills/rest-api-design/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/rest-api-design/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill rest-api-design -a codex2Manually: put the files in place
.agents/skills/rest-api-design/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill rest-api-design -a cursor2Manually: put the files in place
.cursor/skills/rest-api-design/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install secondsky/claude-skills rest-api-design2Manually: put the files in place
.github/skills/rest-api-design/SKILL.md1Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill rest-api-design -a gemini-cli2Platform CLI
gemini skills install https://github.com/secondsky/claude-skills --path plugins/rest-api-design/skills/rest-api-designManually: put the files in place
.devin/skills/rest-api-design/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add secondsky/claude-skills --skill rest-api-design -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.