🧩

API设计

API Design · v
API Development 作者 cotw-fabier 公开目录收录

简介

依据既定编码标准,实施标准化的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、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。

或者手动安装

Claude Code~/.claude/skills/api-design/
Codex CLI~/.codex/skills/api-design/
DeepSeek Harness~/.agents/skills/api-design/

包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可; 目录名不用换,也不要把包直接解压到 skills 根目录。 技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。

技能正文

API Design Review

Reviews API changes for consistency with the Acme API style guide, REST conventions, and backward compatibility.

Steps

  1. Identify API surface changes Find modified handlers, routes, and OpenAPI spec files:

    git diff --name-only main...HEAD | grep -E '\.(go|yaml|json)$'
    
  2. 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).
  3. 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).
  4. 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/...).
  5. 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

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.

正文来自原始仓库, 版权归作者所有,许可:MIT。 权利人认为有不妥,可申请下架。

原始仓库

作者的项目地址:https://github.com/cosmicstack-labs/mercury-agent-skills

标签

没有标签

同类 Skill