Install any skill in seconds. Free to start, no credit card required.
Get Started Free →doccker/cc-api-design-safety
当设计或修改 REST API 响应结构、处理 API 返回值,或生成 Excel/CSV/PDF/对账文件等下游产物时触发。防止 API 设计缺陷导致的字段错位、类型歧义,以及生成产物时关键字段缺失但静默成功的问题。
Passed 22 of 22 test cases with the skill, and 15 of 22 without it.
and 6 more in the full report
7 fixed15 passed either way0 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 7 test cases the skill fixed. Same model, same prompt, with and without the skill.
Which backend programming languages and web frameworks are explicitly listed as falling under the scope of these API design safety guidelines?
| Checked | Without skill | With skill |
|---|---|---|
| The response lists Java (Spring Boot), Go (Gin/Echo), Node.js (Express/Koa), and Python (FastAPI/Flask). | Missed | Passed |
The instructions your model reads when the skill loads.
当设计或修改 REST API 响应结构时,防止常见的设计缺陷。
场景: 返回类型为 String 时,Java 重载解析可能匹配错误的方法
Java 方法重载解析时,String 类型参数会优先匹配 success(String message) 而非 success(T data),导致数据进入错误的字段。
// ApiResponse 有两个重载:
public static <T> ApiResponse<T> success(T data)
public static <T> ApiResponse<T> success(String message, T data)
// ❌ 错误: String 类型匹配到 success(String message)
String avatarUrl = "http://example.com/avatar.jpg";
return ApiResponse.success(avatarUrl);
// 结果: {"code":200, "message":"http://...", "data":null}
// 前端 data.data 拿到 null,导致功能异常
// ✅ 方案1: 明确指定 message 参数(推荐)
return ApiResponse.success("上传成功", avatarUrl);
// 结果: {"code":200, "message":"上传成功", "data":"http://..."}
// ✅ 方案2: 使用泛型明确类型
return ApiResponse.<String>success(avatarUrl);
// ✅ 方案3: 包装为 DTO(复杂场景推荐)
return ApiResponse.success(new UploadResult(avatarUrl));
test cases passed, vs 15 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.