Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/wade-devcode/awesome-coding-skills-cn/api-designnpx skills add Wade-DevCode/awesome-coding-skills-cn --skill api-designgit clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cnWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00026 | $0.02508 |
| Opus 5 | $0.00013 | $0.01254 |
| Sonnet 5 | $0.00005 | $0.00502 |
| Haiku 4.5 | $0.00003 | $0.00251 |
Grade A, and why
api-design scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 187 lines — stays where its author put it; the contents beside it link to each section on GitHub.
接口设计
何时用
- 新增 HTTP/REST 接口,需要确定 URL 路径、请求体与响应结构时。
- 修改已有接口,要评估是否属于破坏性变更、是否需要新版本时。
- 联调阶段前端反馈"不知道错误含义"或"状态码对不上"时。
- code review 发现接口风格混乱,需要统一约定时。
核心规则
1. 资源用名词复数,HTTP 方法表达动作
规则: URL 只描述资源,增删改查全靠 HTTP 方法(GET/POST/PUT/PATCH/DELETE)区分,禁止在路径里塞动词。
为什么: AI 生成代码时极容易把动作写进路径——POST /createUser、GET /getUserById、POST /deleteOrder。这样做破坏了 REST 的统一接口约束:客户端无法通过方法推断语义,反向代理的缓存/日志规则也按 HTTP 方法设计,动词 URL 会绕开这些设施。积累下来接口命名五花八门,新人一眼看不懂哪个是幂等的、哪个有副作用。
怎么做:
- 集合资源用复数:
/users、/orders、/products/{id}/reviews。 - 子资源层级不超过三级:
/users/{uid}/addresses/{aid}可接受,再深就拍平。 - 真正的「动作」(非 CRUD)用子资源或
action后缀:POST /orders/{id}/cancel或POST /payments/{id}/refund,不要POST /cancelOrder。
2. 状态码严格对应语义
规则: 按 HTTP 语义选状态码:2xx 成功、4xx 客户端的错、5xx 服务端的错;不用"一律 200 + { "code": 500 } "的私有协议。
为什么: AI 生成的服务端代码极常见"全部返回 200,用 body 里的 code 表示真实状态"——看起来简单,实则让所有上层基础设施失效:Nginx 的 5xx 告警触发不了,监控平台抓不到真实错误率,HTTP 客户端的重试/熔断逻辑按 2xx 判定成功而放行所有故障流量。出了事故查日志,全是绿的。
怎么做:
200成功返回资源,201创建成功(带Location头),204成功但无响应体(DELETE)。400请求格式/参数错误,401未认证,403无权限(已认证但拒绝),404资源不存在,409冲突(重复创建),422业务校验失败。500服务内部错误,502/503上游/服务不可用,504超时。- 不要用
200返回错误信息,也不要用500返回校验失败。
3. 错误响应结构统一,前端可程序化处理
规则: 所有错误响应用相同结构:code(机器可读的错误标识)、message(人类可读说明)、details(可选,字段级明细),不能每个接口各自为政。
为什么: AI 最容易犯的错是:有的接口报错返回 {"error": "invalid email"},有的返回 {"msg": "用户不存在"},有的直接丢出框架的原始异常 JSON。前端被迫为每个接口写专属错误解析逻辑,错误提示文案散落各处。哪天要做统一的错误埋点或国际化,根本没有抓手。
怎么做:
{
"code": "VALIDATION_ERROR",
"message": "请求参数不合法",
"details": [
{ "field": "email", "message": "邮箱格式不正确" },
{ "field": "age", "message": "年龄必须大于 0" }
]
}
code用SCREAMING_SNAKE_CASE枚举值,前端可switch/map处理。message面向开发者,不直接作为用户提示(i18n 由前端按code查表)。details仅在有字段级信息时出现,表单校验必带。
4. 破坏性变更走版本号
规则: 接口路径加 /v1、/v2 前缀;不兼容的改动新开版本,旧版本保留至少一个过渡期,不在原路径上直接覆盖。
为什么: AI 修改接口时惯于"直接改字段名"或"删除旧字段"——测试环境跑通了,但已上线的移动端 App、第三方集成、还没发版的前端全部一起炸。破坏性变更无声地推出去,只有故障告警才会被发现,而此时回滚服务端又会打烂已经发版的新客户端。
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 187 lines · 26 tokens per session scan A 2ab6a1d119f5
api-design is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (6 stars, last pushed 2mo ago), licensed MIT. It adds 26 tokens to every session and 2,508 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
chinese-git-workflow
国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.
brainstorming
在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.
chinese-code-review
中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.
chinese-commit-conventions
中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.
chinese-documentation
中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.
systematic-debugging
Skill "systematic-debugging" from jnMetaCode/superpowers-zh, covering 系统化调试, 概述, 铁律, 何时使用 and 四个阶段.