Best use case
rest-api is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
REST API design with HTTP methods and status codes. Use for web APIs.
Teams using rest-api should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/rest-api/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How rest-api Compares
| Feature / Agent | rest-api | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
REST API design with HTTP methods and status codes. Use for web APIs.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# REST API
Representational State Transfer (REST) is the architectural style for distributed hypermedia systems. It relies on stateless, client-server, cacheable communications protocols (mostly HTTP).
## When to Use
- **Public APIs**: The universal standard; easiest for 3rd parties to consume.
- **Simple Resource Access**: Perfect for CRUD (Create, Read, Update, Delete) operations.
- **Caching**: When you need to leverage HTTP caching (CDNs, Browsers).
## Quick Start
```typescript
// Express.js Example
app.get("/users/:id", async (req, res) => {
const user = await db.find(req.params.id);
if (!user) return res.status(404).json({ error: "Not Found" });
// HATEOAS (Hypermedia As The Engine Of Application State) - optional but "True REST"
res.json({
...user,
links: {
self: `/users/${user.id}`,
orders: `/users/${user.id}/orders`,
},
});
});
```
## Core Concepts
### Resources
Everything is a resource identified by a URI (`/users/123`).
### HTTP Verbs
Use verbs to define actions, not URIs.
- `GET /orders` (List)
- `POST /orders` (Create)
- `PATCH /orders/1` (Update partial)
- `DELETE /orders/1` (Remove)
### Statelessness
Each request must contain all information necessary to understand the request. The server accepts no session state.
## Common Patterns
### Filtering, Sorting, Pagination
Standard query params: `?sort=-created_at&limit=10&page=2&status=active`.
### Versioning
- URI Versioning: `/v1/users` (Most common).
- Header Versioning: `Accept: application/vnd.myapi.v1+json`.
## Best Practices
**Do**:
- Use proper **HTTP Status Codes** (200 OK, 201 Created, 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 500 Server Error).
- Use **Snake Case** (`user_id`) in JSON responses (standard convention) or camelCase if consistent with JS ecosystem.
- Implement **Rate Limiting** to protect resources.
**Don't**:
- Don't use GET for state-changing operations.
- Don't return 200 OK for errors (e.g., `{ "error": "failed" }` with status 200).
- Don't expose database IDs if possible (use UUIDs).
## Troubleshooting
| Error | Cause | Solution |
| :--------------------------- | :------------------------------------- | :--------------------------------------------------- |
| `405 Method Not Allowed` | Sending POST to a GET-only endpoint. | Check HTTP verb. |
| `415 Unsupported Media Type` | Sending XML when JSON expected. | Set `Content-Type: application/json`. |
| `CORS Error` | Browser blocking cross-origin request. | Set `Access-Control-Allow-Origin` headers on server. |
## References
- [Restful API Design (Microsoft)](https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design)
- [Richardson Maturity Model](https://martinfowler.com/articles/richardsonMaturityModel.html)Related Skills
template
Expert [skill-name] assistance covering [feature 1], [feature 2], and [feature 3]. Use when [working with X], [debugging Y], or [implementing Z].
zsh
Zsh shell with oh-my-zsh. Use for terminal shell.
zed
Zed high-performance collaborative editor. Use for fast editing.
xcode
Xcode Apple development IDE with simulators. Use for iOS/macOS development.
webstorm
WebStorm JavaScript IDE with debugging. Use for web development.
webpack
Webpack module bundler with loaders and plugins. Use for bundling.
warp
Warp modern terminal with AI. Use for terminal work.
vscode
Visual Studio Code editor with extensions and debugging. Use for code editing.
vite
Vite fast build tool with HMR. Use for modern frontend builds.
visual-studio
Visual Studio IDE for Windows with debugging and profiling. Use for .NET development.
vim
Vim text editor with motions, macros, and plugins. Use for terminal editing.
turbopack
Turbopack Rust-powered bundler. Use for fast builds.