Token导航 LogoToken导航

Agent Skill · 研究检索

api-design(API 设计)

用于辅助 API 设计、接口文档、请求响应结构和服务集成说明。它适合让 Agent 梳理 endpoint、生成 OpenAPI 草稿、检查字段命名、整理错误码或辅助前后端联调。使用时需要确认真实业务语义、鉴权方式、分页和错误处理规则;涉及生成接口文档时,应避免凭空补字段,最好从现有代码、schema 或接口样例中提取事实。

api-design 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 66,724。

总安装 259周安装 11GitHub Stars 35下载 91核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:api-design(API 设计)
来源仓库:https://github.com/kazdenc/builder-skills
仓库路径:skills/api-design
安装命令:
npx skills add https://github.com/kazdenc/builder-skills --skill api-design
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/kazdenc/builder-skills --skill api-design

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

api-design 用于辅助 API 设计、接口文档和请求响应结构梳理。适合生成 OpenAPI 草稿、检查字段命名或整理错误码等场景。使用时需确认真实业务语义、鉴权方式和错误处理规则。涉及生成接口文档时应避免凭空补字段,优先从现有代码提取事实。

通过 npx skills add 命令从 GitHub 仓库安装,需结合原始 README 确认具体用法。

来源仓库内路径:skills/api-design

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/kazdenc/builder-skills --skill api-design;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

api-design 怎么安装?

在终端执行 npx skills add https://github.com/kazdenc/builder-skills --skill api-design。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

api-design 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

api-design 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

api-design 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

api-design 用的人多吗?

公开数据是累计安装 259 次,近一周安装 11 次,下载 91 次,GitHub 35 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

api-design 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
api-design

API 设计 · 本页

25935接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

API Design

Apply these conventions when designing, reviewing, or implementing RESTful APIs. Consistency matters more than cleverness — follow the patterns below.

URL Structure

Use nouns for resources, not verbs. Resources are things, not actions.

RuleCorrectIncorrect
Plural nouns/users, /orders/user, /getOrders
Nouns, not verbsPOST /usersPOST /createUser
Kebab-case for multi-word/line-items/lineItems, /line_items
Nest for relationships (max 2 levels)/users/:id/orders/users/:id/orders/:orderId/items/:itemId
Flat when parent is obvious/orders/:orderId/items/users/:userId/orders/:orderId/items

Query Parameters

Use query parameters for filtering, sorting, searching, and pagination. Never encode these in the URL path.

GET /users?status=active&sort=-created_at&limit=20&cursor=abc123
GET /orders?user_id=42&min_total=100&fields=id,status,total
ParameterConventionExample
FilterField name as key?status=active&role=admin
SortField name, prefix - for descending?sort=-created_at,name
Searchq parameter?q=john
Field selectionfields comma-separated?fields=id,name,email
Paginationcursor or offset/limit?cursor=abc&limit=20

HTTP Methods

MethodPurposeIdempotentRequest BodySuccess CodeResponse Body
GETRetrieve resource(s)YesNo200Resource or collection
POSTCreate a new resourceNoYes201Created resource
PUTReplace a resource entirelyYesYes200Updated resource
PATCHPartially update a resourceNo*Yes200Updated resource
DELETERemove a resourceYesNo204No body

*PATCH is not inherently idempotent but can be implemented as such. Treat it as non-idempotent by default.

Key rules:

  • GET must never mutate state. Ever.
  • PUT replaces the entire resource — omitted fields are removed or reset to defaults.
  • PATCH updates only the fields included in the body.
  • POST to a collection creates a new resource. Return the created resource with its id.
  • DELETE should succeed silently if the resource is already gone (idempotent).

Status Codes

Use the most specific appropriate code. Don't return 200 for everything.

2xx — Success

CodeMeaningUse When
200 OKRequest succeededGET, PUT, PATCH success
201 CreatedResource createdPOST success — include Location header
204 No ContentSuccess, no bodyDELETE success, or PUT/PATCH when no body is needed

4xx — Client Error

CodeMeaningUse When
400 Bad RequestMalformed requestInvalid JSON, missing required fields, validation failures
401 UnauthorizedNot authenticatedMissing or invalid authentication token
403 ForbiddenAuthenticated but not allowedUser lacks permission for this action
404 Not FoundResource doesn't existID not found, or route doesn't exist
405 Method Not AllowedWrong HTTP methodPOST to a read-only resource
409 ConflictState conflictDuplicate creation, version mismatch
422 Unprocessable EntitySemantic validation failureValid JSON, but business rules violated
429 Too Many RequestsRate limit exceededInclude Retry-After header

5xx — Server Error

CodeMeaningUse When
500 Internal Server ErrorUnexpected failureUnhandled exception — log it, don't leak details
502 Bad GatewayUpstream failureA dependency returned an invalid response
503 Service UnavailableTemporarily downMaintenance or overload — include Retry-After

Error Format

Return errors in a consistent shape. Every error response uses this structure:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Request body failed validation.",
    "details": [
      { "field": "email", "message": "Must be a valid email address." },
      { "field": "age", "message": "Must be at least 18." }
    ]
  }
}
FieldTypeRequiredDescription
error.codestringYesMachine-readable error code (UPPER_SNAKE_CASE)
error.messagestringYesHuman-readable summary
error.details`array \object`NoField-level errors, additional context

Rules:

  • Always return the same top-level {error: {...}} shape for all error responses.
  • Use code for programmatic handling (clients switch on it), message for display.
  • Never expose stack traces, internal paths, or database errors in production.
  • Include a request_id in error responses (or top-level meta) for debugging.

Pagination

Cursor-Based (Preferred)

Use cursor-based pagination by default. It handles inserts/deletes gracefully and scales to large datasets.

Request:

GET /users?limit=20&cursor=eyJpZCI6MTAwfQ

Response:

{
  "data": [ { "id": 101, "name": "Ada" }, { "id": 102, "name": "Bob" } ],
  "pagination": {
    "next_cursor": "eyJpZCI6MTAyfQ",
    "has_more": true
  }
}
FieldDescription
next_cursorOpaque string — encode whatever your DB needs (usually last ID)
has_moreBoolean — tells client whether to fetch again

Offset-Based (When Needed)

Use offset pagination only when users need to jump to arbitrary pages (admin tables, search results).

Request:

GET /users?offset=40&limit=20

Response:

{
  "data": [ { "id": 41, "name": "Ada" } ],
  "pagination": {
    "offset": 40,
    "limit": 20,
    "total": 523
  }
}

Warning: Offset pagination degrades on large datasets (DB must skip offset rows). Never use for infinite scroll.

Authentication

Bearer Tokens (Preferred for User Auth)

Pass tokens in the Authorization header:

Authorization: Bearer eyJhbGciOiJSUzI1NiIs...
  • Use short-lived access tokens (15 min–1 hr) with refresh tokens.
  • Validate tokens on every request. Don't cache validation results.
  • Return 401 for missing/expired tokens, 403 for insufficient permissions.

API Keys (For Server-to-Server)

Pass API keys in a custom header or as a query parameter (header preferred):

X-API-Key: sk_live_abc123def456
AspectRecommendation
Where to sendX-API-Key header (preferred) or Authorization: ApiKey <key>
Key formatPrefix with environment: sk_live_, sk_test_
StorageHash keys server-side, never store plaintext
RotationSupport multiple active keys for zero-downtime rotation

When to Use Each

ScenarioAuth Method
Browser/mobile app user sessionsBearer token (OAuth 2.0 / JWT)
Server-to-server integrationAPI key
Third-party developer accessOAuth 2.0 with scopes
Internal microservicesmTLS or signed JWTs

Versioning

URL Versioning (Preferred)

Prefix major versions in the URL path:

GET /v1/users
GET /v2/users
  • Version only when you introduce breaking changes.
  • Run old versions in parallel during migration. Set a sunset date and communicate it.
  • Non-breaking additions (new optional fields, new endpoints) do not require a version bump.

Header Versioning (Alternative)

Accept: application/vnd.myapi.v2+json

Use header versioning when URL versioning creates routing complexity or you need fine-grained version control. URL versioning is simpler for most cases.

What Counts as a Breaking Change

BreakingNot Breaking
Removing a field from a responseAdding a new optional field to a response
Renaming a fieldAdding a new endpoint
Changing a field's typeAdding a new optional query parameter
Removing an endpointAdding a new enum value (if clients handle unknown)
Making an optional field requiredImproving error messages

Rate Limiting

Include rate-limit headers in every response so clients can self-regulate:

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 742
X-RateLimit-Reset: 1702483200
HeaderDescription
X-RateLimit-LimitMax requests allowed in the window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetUnix timestamp when the window resets

When the limit is exceeded, return:

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests. Retry after 30 seconds.",
    "details": {
      "retry_after": 30
    }
  }
}

Return 429 Too Many Requests with a Retry-After header (in seconds).

Anti-Patterns

Avoid these. When you see them in a codebase, flag or refactor.

Anti-PatternProblemDo Instead
Verbs in URLs/getUsers, /deleteOrderUse HTTP methods: GET /users, DELETE /orders/:id
Deep nesting (3+ levels)/users/:id/orders/:oid/items/:iid/reviewsFlatten: /order-items/:iid/reviews
200 for errorsClient can't distinguish success from failure by statusUse appropriate 4xx/5xx codes
GET for mutationsBreaks caching, prefetching, crawlersUse POST, PUT, PATCH, DELETE
Plural/singular inconsistency/user/1 but /ordersAlways use plural: /users/1, /orders
Returning arrays at rootVulnerable to JSON hijacking, can't add metadataWrap in {"data": [...]}
Leaking internal errorsStack traces, SQL errors in responsesReturn generic message, log details server-side
Ignoring Accept headersClient can't negotiate content typeRespect Accept or return 406
Custom status codesClients won't understand themStick to standard HTTP status codes
Inconsistent error shapesSome errors return {message}, others {error}Use one error shape everywhere

平台分布

Codex

35.29%
按下载量换算32

Claude

30.16%
按下载量换算27

Cursor

19.21%
按下载量换算17

Gemini CLI

9.17%
按下载量换算8

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills