Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问许可证需确认审计通过

api-designAPI 设计

Agent Skill

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

总安装

713

周安装

30

GitHub Stars

1

下载量

250
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/pixel-process-ug/superkit-agents --skill api-design

简介

api-design 用于辅助 API 设计、接口文档和错误码整理,适合前后端联调支持。

  • 适用于梳理 endpoint、生成 OpenAPI 草稿或检查字段命名的场景。
  • 使用时需确认业务语义、鉴权方式和分页规则,避免凭空补字段。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用该技能。
  • api-design 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

API Design

Overview

Structured API endpoint design through guided discovery. Produces consistent, well-documented API designs with OpenAPI/Swagger specifications. Covers resource modeling, authentication, pagination, error handling, and versioning — ensuring consumer-centric design before any implementation begins.

Announce at start: "I'm using the api-design skill to design the API."

Phase 1: Discovery

Ask these questions ONE AT A TIME:

Resource Questions

#QuestionWhat It Determines
1What entities/resources does this API manage?Resource naming
2What are the relationships between them?Nested routes, includes
3What operations are needed for each? (CRUD, search, batch)HTTP methods, endpoints

Consumer Questions

#QuestionWhat It Determines
4Who will consume this API? (frontend, mobile, third-party, internal)Response shape, auth model
5What authentication/authorization is needed?Security scheme
6What rate limits or quotas apply?Rate limiting headers

Constraint Questions

#QuestionWhat It Determines
7REST, GraphQL, or tRPC?API paradigm
8Versioning strategy? (URL path, header, query param)URL structure
9Pagination approach? (cursor, offset, keyset)List response shape
10Existing API conventions in the codebase?Consistency constraints

API Paradigm Decision Table

FactorChoose RESTChoose GraphQLChoose tRPC
ConsumersMultiple, diverseFrontend-heavy, flexible queriesTypeScript monorepo
Caching needsStrong (HTTP caching)Moderate (client-side)Low (internal only)
Data shapePredictable, resource-orientedNested, variable-shapeType-safe RPC
Team familiarityUniversalRequires schema knowledgeRequires TypeScript
Real-time needsWebSocket addonSubscriptions built-inSubscription support

STOP after discovery — present a summary of resources, operations, and constraints. Get confirmation before designing endpoints.

Phase 2: Design Endpoints

For each endpoint, define:

### [METHOD] /api/v1/[resource]

**Purpose:** [what this endpoint does]

**Request:**
- Headers: `Authorization: Bearer <token>`
- Query params: `?page=1&limit=20&sort=created_at:desc`
- Body:

{ "field": "type — description" }


**Response (200):**

{ "data": [...], "meta": { "total": 100, "page": 1, "limit": 20 } }


**Error Responses:**

| Status | Code | Description |
| --- | --- | --- |
| 400 | VALIDATION_ERROR | Invalid request body |
| 401 | UNAUTHORIZED | Missing or invalid token |
| 404 | NOT_FOUND | Resource doesn't exist |
| 409 | CONFLICT | Resource already exists |

**Authorization:** [who can access this]

HTTP Method Decision Table

OperationMethodStatus (success)Idempotent
List resourcesGET200Yes
Get single resourceGET200Yes
Create resourcePOST201No
Full replacePUT200Yes
Partial updatePATCH200No
Delete resourceDELETE204Yes
Bulk createPOST201No
Search (complex)POST200Yes (safe)

Pagination Decision Table

ApproachWhen to UseProsCons
CursorReal-time feeds, large datasetsConsistent, no skippingCannot jump to page N
OffsetSmall datasets, admin panelsSimple, jumpableSkips/duplicates on insert
KeysetTime-series, logsEfficient on large tablesRequires sortable key

Error Response Format

All endpoints must use a consistent error shape:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Human-readable description",
    "details": [
      { "field": "email", "message": "Invalid email format" }
    ]
  }
}

Status Code Reference

CodeMeaningWhen to Use
200OKSuccessful GET, PUT, PATCH
201CreatedSuccessful POST that creates
204No ContentSuccessful DELETE
400Bad RequestValidation failure
401UnauthorizedMissing or invalid credentials
403ForbiddenValid credentials, insufficient permissions
404Not FoundResource does not exist
409ConflictDuplicate or state conflict
422Unprocessable EntityValid JSON but semantic error
429Too Many RequestsRate limit exceeded
500Internal Server ErrorUnexpected server failure

STOP after endpoint design — present each endpoint for review and approval.

Phase 3: Generate OpenAPI Spec

openapi: 3.1.0
info:
  title: [API Name]
  version: 1.0.0
  description: [API description]

servers:
  - url: http://localhost:3000/api/v1
    description: Development
  - url: https://api.example.com/v1
    description: Production

paths:
  /resource:
    get:
      summary: List resources
      parameters: [...]
      responses: [...]
    post:
      summary: Create resource
      requestBody: [...]
      responses: [...]

components:
  schemas: [...]
  securitySchemes: [...]

STOP after spec generation — validate the YAML and present for final approval.

Phase 4: Save and Transition

After explicit approval:

  1. Save OpenAPI spec to docs/api/YYYY-MM-DD-<api-name>.yaml
  2. Commit with message: docs(api): add OpenAPI spec for <api-name>
  3. Determine next step based on user intent

Transition Decision Table

User IntentNext SkillRationale
"Let's implement this"planningCreate implementation plan from API spec
"Write specs for this"spec-writingBehavioral specs for each endpoint
"Generate client SDK"ManualUse OpenAPI codegen tools
"Just save the design"NoneAPI design is the deliverable
"Add tests"testing-strategyDefine API test approach

Design Principles

PrincipleRule
Consistent namingPlural nouns for collections (/users, not /user)
Proper HTTP methodsGET reads, POST creates, PUT replaces, PATCH updates, DELETE removes
Proper status codesUse the right code for the right situation (see table above)
Consistent error formatSame error shape across all endpoints
Pagination by defaultAll list endpoints paginated
Filtering and sortingQuery params for list endpoints
IdempotencyPUT and DELETE are always idempotent
HATEOASInclude links for discoverability (when appropriate)

Anti-Patterns / Common Mistakes

MistakeWhy It Is WrongWhat To Do Instead
Verb-based URLs (/getUsers)Not RESTful, breaks conventionsUse nouns: GET /users
Inconsistent plural/singularConfuses consumersAlways plural for collections
Returning 200 for errorsHides failures from clientsUse proper status codes
No pagination on list endpointsPerformance bomb on large datasetsAlways paginate
Different error formats per endpointClients can't build generic error handlingOne error shape for all
Exposing internal IDs in URLsSecurity and coupling riskUse UUIDs or slugs
No versioning strategyBreaking changes break clientsVersion from day one
Designing without knowing consumersAPI serves no one wellDiscovery phase first

Anti-Rationalization Guards

  • Do NOT skip the discovery phase — understand consumers and constraints first
  • Do NOT design endpoints without defining error responses
  • Do NOT skip pagination for any list endpoint
  • Do NOT use inconsistent naming across endpoints
  • Do NOT generate the OpenAPI spec without user approval of endpoint designs
  • Do NOT mix API paradigms (REST + GraphQL) without explicit justification

Integration Points

SkillRelationship
spec-writingDownstream: API design informs behavioral specifications
planningDownstream: API endpoints become implementation tasks
tech-docs-generatorDownstream: OpenAPI spec feeds API reference docs
testing-strategyDownstream: API design informs integration test strategy
security-reviewDownstream: auth/authz model reviewed for vulnerabilities
database-schema-designUpstream: data model informs resource design
prd-generationUpstream: PRD requirements drive API resource identification

Verification Gate

Before claiming the API design is complete:

  1. VERIFY all endpoints have request/response schemas
  2. VERIFY all error responses are documented with consistent format
  3. VERIFY authentication is specified for each endpoint
  4. VERIFY pagination is defined for all list endpoints
  5. VERIFY the OpenAPI spec is valid YAML
  6. VERIFY user has approved each endpoint individually

Skill Type

Flexible — Adapt API paradigm, pagination style, and auth model to project needs while preserving the discovery-first approach, consistent error handling, and consumer-centric design principles.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.7%
按下载量换算92

Claude

30%
按下载量换算75

Cursor

18.56%
按下载量换算46

Gemini CLI

10.95%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

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

来源信息

继续浏览同类 Skills