简介
依据既定编码标准,实施标准化的API设计原则与架构模式。
原始描述
Implements standardized API design principles and architectural patterns according to established coding standards.
通过你的 Agent 添加
安装目录:api-design/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
API Design Review
Reviews API changes for consistency with the Acme API style guide, REST conventions, and backward compatibility.
Steps
-
Identify API surface changes
Find modified handlers, routes, and OpenAPI spec files:
git diff --name-only main...HEAD | grep -E '\.(go|yaml|json)$'
-
Check resource naming
- Plural nouns for collections (
/v1/users, not /v1/user).
- No verbs in paths (
POST /v1/orders, not POST /v1/create-order).
- Lowercase with hyphens for multi-word resources (
/user-profiles, not /userProfiles).
snake_case for query parameters and JSON field names.
- Nested resources go two levels deep max (
/v1/users/{id}/orders, not deeper).
-
Check request and response patterns
POST returns 201 Created with a Location header.
DELETE returns 204 No Content with no body.
- Single resources wrapped in
{ "data": { "id", "type", "attributes" } }.
- Collections include
pagination with has_more and next_cursor. Default limit 25, max 100.
- Error responses use the standard error body:
{ "error": { "code", "message", "details", "request_id" } }.
- All responses include rate limit headers (
X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset).
-
Check backward compatibility
- No required fields added to existing request bodies without a version bump.
- No removed or renamed fields in existing responses.
- Deprecated endpoints must include
Deprecation and Sunset headers.
- If a breaking change is necessary, confirm a new version path exists (
/v2/...).
-
Check OpenAPI spec
- Every new or changed endpoint has a matching spec update.
- Spec validates cleanly:
npx @redocly/cli lint openapi.yaml
- Response schemas include examples.
Output
Identify API surface changes Find modified handlers, routes, and OpenAPI spec files:
git diff --name-only main...HEAD | grep -E '\.(go|yaml|json)$'
Check resource naming
- Plural nouns for collections (
/v1/users, not/v1/user). - No verbs in paths (
POST /v1/orders, notPOST /v1/create-order). - Lowercase with hyphens for multi-word resources (
/user-profiles, not/userProfiles). snake_casefor query parameters and JSON field names.- Nested resources go two levels deep max (
/v1/users/{id}/orders, not deeper).
Check request and response patterns
POSTreturns201 Createdwith aLocationheader.DELETEreturns204 No Contentwith no body.- Single resources wrapped in
{ "data": { "id", "type", "attributes" } }. - Collections include
paginationwithhas_moreandnext_cursor. Default limit 25, max 100. - Error responses use the standard error body:
{ "error": { "code", "message", "details", "request_id" } }. - All responses include rate limit headers (
X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset).
Check backward compatibility
- No required fields added to existing request bodies without a version bump.
- No removed or renamed fields in existing responses.
- Deprecated endpoints must include
DeprecationandSunsetheaders. - If a breaking change is necessary, confirm a new version path exists (
/v2/...).
Check OpenAPI spec
- Every new or changed endpoint has a matching spec update.
- Spec validates cleanly:
npx @redocly/cli lint openapi.yaml - Response schemas include examples.
List each finding with the file, line, what's wrong, and how to fix it. Group by severity:
- Breaking: Changes that will break existing clients.
- Style: Deviations from the API style guide.
- Suggestion: Improvements that aren't required.
原始仓库
作者的项目地址:https://github.com/cosmicstack-labs/mercury-agent-skills