用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/G1Joshi/Agent-Skills --skill rest-api命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | rest-api |
| description | REST API design with HTTP methods and status codes. Use for web APIs. |
Representational State Transfer (REST) is the architectural style for distributed hypermedia systems. It relies on stateless, client-server, cacheable communications protocols (mostly HTTP).
// 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`,
},
});
});
Everything is a resource identified by a URI (/users/123).
Use verbs to define actions, not URIs.
GET /orders (List)POST /orders (Create)PATCH /orders/1 (Update partial)DELETE /orders/1 (Remove)Each request must contain all information necessary to understand the request. The server accepts no session state.
Standard query params: ?sort=-created_at&limit=10&page=2&status=active.
/v1/users (Most common).Accept: application/vnd.myapi.v1+json.Do:
user_id) in JSON responses (standard convention) or camelCase if consistent with JS ecosystem.Don't:
{ "error": "failed" } with status 200).| 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. |