在 Manus 中运行任何 Skill
一键导入
一键导入
一键在 Manus 中运行任何 Skill
开始使用api-design
星标3
分支0
更新时间2026年6月7日 02:51
API 设计全栈技能,合并了认证授权模式。覆盖 REST 设计、认证、授权、分页、版本控制
安装
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
SKILL.md
readonly菜单
API 设计全栈技能,合并了认证授权模式。覆盖 REST 设计、认证、授权、分页、版本控制
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
单文件代码审查,6个维度逐项检查。覆盖正确性、安全性、性能、可维护性、测试、无障碍
CI/CD 流水线和容器化部署,覆盖 GitHub Actions、GitLab CI、Docker、测试策略和部署自动化
查询优化、索引策略和数据库性能调优,覆盖 PostgreSQL 和 MySQL
微服务设计模式,涵盖服务网格、事件驱动架构、Saga 模式和 API 网关
Web 性能优化,涵盖包分析、懒加载、缓存策略和 Core Web Vitals
TypeScript 进阶模式,涵盖泛型、条件类型、映射类型、模板字面量和类型守卫
| name | api-design |
| description | API 设计全栈技能,合并了认证授权模式。覆盖 REST 设计、认证、授权、分页、版本控制 |
/users、/orders/users/{id}/orders,最多 2 层/user-profilesPOST /users/{id}/activation(非 /activate)| 方法 | 用途 | 幂等 | 成功码 |
|---|---|---|---|
| GET | 读取 | 是 | 200 |
| POST | 创建 | 否 | 201 |
| PUT | 全量替换 | 是 | 200 |
| PATCH | 部分更新 | 否 | 200 |
| DELETE | 删除 | 是 | 204 |
200/201/204 — 成功
400 — 验证错误(含字段级错误)
401 — 未认证
403 — 已认证无权限
404 — 资源不存在
409 — 状态冲突
422 — 语义无效
429 — 限流(含 Retry-After)
500 — 服务器错误(不暴露堆栈)
{ "error": { "code": "VALIDATION_ERROR", "message": "...", "details": [{ "field": "email", "message": "..." }] } }
GET /users?limit=20&cursor=eyJpZCI6MTAwfQ
→ { "data": [...], "pagination": { "next_cursor": "...", "has_more": true } }
大数据集用 cursor,编码为不透明 base64。
GET /users?page=3&per_page=20
→ { "data": [...], "pagination": { "page": 3, "total": 245 } }
GET /orders?status=pending&sort=-created_at,+total
GET /users?search=john&fields=id,name,email
/api/v1/usersSunset header + 6 个月通知废弃// 生成:短 access token (15m) + 长 refresh token (7d)
const accessToken = jwt.sign({ sub: user.id, roles: user.roles }, secret, { expiresIn: "15m" });
const refreshToken = jwt.sign({ sub: user.id, tokenVersion: user.tokenVersion }, refreshSecret, { expiresIn: "7d" });
// 验证:检查 iss、aud、exp
const payload = jwt.verify(token, publicKey, { algorithms: ["RS256"], issuer: "auth.example.com" });
const verifier = crypto.randomBytes(32).toString("base64url");
const challenge = crypto.createHash("sha256").update(verifier).digest("base64url");
// redirect → callback → exchange code + verifier → session
const ROLE_PERMISSIONS = {
viewer: [{ resource: "posts", action: "read" }],
editor: [{ resource: "posts", action: "create" }, { resource: "posts", action: "read" }, ...],
admin: [{ resource: "*", action: "*" }],
};
function hasPermission(roles, resource, action) {
return roles.some(r => ROLE_PERMISSIONS[r]?.some(p =>
(p.resource === resource || p.resource === "*") && (p.action === action || p.action === "*")
));
}
app.get("/admin/users", authenticate, authorize("admin"), listUsers);
const schema = z.object({ email: z.string().email().max(255), age: z.number().int().min(13) });
const result = schema.safeParse(req.body);
if (!result.success) return res.status(400).json({ error: { details: result.error.flatten() } });
$ref 复用 schemaAuthorization: Bearer <token>
X-Request-Id: <uuid>
X-RateLimit-Limit/Remaining/Reset
Content-Type: application/json