AINow
📢 赞助位招租 · 月访问 XXXX · 联系 weixin_xxx
了解详情
返回 Skill 列表
编程开发进阶

API 设计 Skill

设计 RESTful API:路由规划、请求/响应格式、错误处理、文档自动生成。

📋 SKILL.md 完整代码

---
name: api-design-skill
description: >-
  设计 RESTful API:路由规划、请求/响应格式、错误处理、文档自动生成。
  Use when working on api design skill tasks.
allowed-tools: Read,Write,Bash
---

# API 设计 Skill

## Quick Start
1. Save as `~/.claude/skills/api-design-skill/SKILL.md`
2. Restart Claude Code
3. Type `/api-design-skill` or describe your task naturally
4. Claude auto-triggers when your task matches the description

## Instructions
- Understand the user's specific context and needs
- Apply domain best practices consistently
- Provide actionable, specific guidance with examples
- Verify all outputs before presenting to user

## Gotchas
- Test with a fresh Claude instance after changes
- Keep SKILL.md under 500 lines; use references/ for details
- Description is the trigger key — make it specific and keyword-rich

🚀 怎么用

1. 复制上面的 SKILL.md 代码
2. 保存为 ~/.claude/skills/api-design-skill/SKILL.md
3. 重启 Claude Code
4. 输入 /api-design-skill 或直接描述任务触发
5. AI 自动按 Skill 流程执行

设计原则

资源用名词复数(/users 不是 /getUsers)→HTTP 方法语义化(GET查/POST增/PUT改/DELETE删)→版本控制(/v1/users)→分页+过滤+排序内置→统一错误格式→自动生成 OpenAPI 文档。