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 里排第 44,915。

总安装 881周安装 36GitHub Stars 16下载 285核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/krzysztofsurdy/code-virtuoso --skill api-design

这个 Skill 是做什么的

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

api-design 用于辅助 API 设计、接口文档和请求响应结构梳理,适合生成 OpenAPI 草稿和检查字段命名。适用于前后端联调和接口规范制定场景。通过 npx skills add 命令从 GitHub 仓库安装并使用该技能。使用时需确认真实业务语义,避免凭空补字段。

api-design 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

api-design 怎么安装?

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

api-design 支持哪些 AI 工具?

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

api-design 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

api-design 是免费的吗?

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

api-design 用的人多吗?

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

api-design 安全吗?

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

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

值得选的地方

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

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

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

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 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 设计 · 本页

88116操作浏览器未明确通过

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

SKILL.md 原文

API Design

Principles and patterns for designing APIs that are consistent, predictable, and easy to evolve. Applies to any language or framework — the focus is on protocol-level design decisions, not implementation details.

A well-designed API treats its surface as a product: consumers should be able to predict behavior, recover from errors, and integrate without reading source code.

When to Use

  • Designing a new public or internal API from scratch
  • Reviewing an existing API for consistency and usability
  • Choosing between REST and GraphQL for a project
  • Planning API versioning or migration strategy
  • Defining error response contracts across services
  • Establishing API standards for a team or organization

REST vs GraphQL

AspectRESTGraphQL
Best forCRUD-heavy, resource-oriented domainsComplex, interconnected data with varied client needs
Data fetchingFixed response shapes per endpointClient specifies exact fields needed
Over-fetchingCommon — endpoints return full resourcesEliminated — clients request only what they need
Under-fetchingCommon — requires multiple round tripsEliminated — single query can span relations
CachingBuilt-in HTTP caching (ETags, Cache-Control)Requires custom caching (normalized stores, persisted queries)
File uploadsNative multipart supportRequires workarounds (multipart spec or separate endpoint)
Real-timeWebhooks, SSE, or pollingSubscriptions built into the spec
Tooling maturityMature — OpenAPI, Postman, HTTP clientsGrowing — Apollo, Relay, GraphiQL
Learning curveLower — leverages existing HTTP knowledgeHigher — schema language, resolvers, query optimization
Error handlingHTTP status codes + response bodyAlways 200 — errors in response errors array
VersioningURL path, headers, or query paramsSchema evolution via deprecation + additive changes

Choose REST when: your domain maps naturally to resources and CRUD operations, you need HTTP caching, or your clients are simple (mobile apps, third-party integrations).

Choose GraphQL when: clients have highly varied data needs, you are aggregating multiple backend services, or you want a strongly typed contract between frontend and backend.

Both are valid. Many systems use REST for external/public APIs and GraphQL for internal frontend-backend communication.

REST Design Principles

REST APIs model the domain as resources and use HTTP semantics to operate on them.

Core rules:

  • Resources are nouns, not verbs: /orders, not /getOrders
  • HTTP methods are the verbs: GET reads, POST creates, PUT replaces, PATCH updates, DELETE removes
  • URLs identify resources; query parameters filter, sort, or paginate them
  • Use plural nouns for collections: /users, /users/{id}
  • Limit nesting to two levels: /users/{id}/orders is fine; /users/{id}/orders/{id}/items/{id}/variants is not
  • Use HTTP status codes meaningfully — do not return 200 for everything
  • Support content negotiation via Accept and Content-Type headers

HATEOAS (Hypermedia as the Engine of Application State) adds discoverability by including links in responses. Useful for public APIs but often overkill for internal services:

{
  "id": 42,
  "status": "shipped",
  "_links": {
    "self": { "href": "/orders/42" },
    "cancel": { "href": "/orders/42/cancel", "method": "POST" },
    "customer": { "href": "/customers/7" }
  }
}

See REST Patterns Reference for detailed conventions.

GraphQL Design Principles

GraphQL APIs expose a strongly typed schema that clients query declaratively.

Core rules:

  • Design schema-first — define the type system before writing resolvers
  • Types represent domain concepts; fields represent attributes and relations
  • Queries read data, mutations write data, subscriptions stream data
  • Use the type system to enforce constraints (non-null, enums, input types)
  • Avoid deeply nested schemas that create unpredictable query costs
  • Solve N+1 problems with batching (dataloader pattern)
  • Limit query depth and complexity to prevent abuse

Schema-first example:

type User {
  id: ID!
  name: String!
  email: String!
  orders(first: Int, after: String): OrderConnection!
}

type Order {
  id: ID!
  total: Float!
  status: OrderStatus!
  createdAt: DateTime!
}

enum OrderStatus {
  PENDING
  CONFIRMED
  SHIPPED
  DELIVERED
  CANCELLED
}

See GraphQL Patterns Reference for detailed conventions.

Error Handling

A consistent error format is one of the most impactful API design decisions. Consumers should be able to parse errors programmatically without inspecting message strings.

RFC 7807 Problem Details format (recommended for REST):

{
  "type": "https://api.example.com/errors/insufficient-funds",
  "title": "Insufficient Funds",
  "status": 422,
  "detail": "Account balance is $10.00 but the transfer requires $50.00.",
  "instance": "/transfers/abc-123",
  "errors": [
    {
      "field": "amount",
      "code": "insufficient_funds",
      "message": "Transfer amount exceeds available balance"
    }
  ]
}

Key principles:

  • Use a machine-readable type or code — clients should branch on codes, not messages
  • Include a human-readable detail for debugging
  • Return field-level errors for validation failures so clients can highlight specific inputs
  • Use appropriate HTTP status codes (REST) or structured error types (GraphQL)
  • Never expose stack traces, internal paths, or SQL queries in production
  • Include a correlation/request ID for tracing errors across services

GraphQL error conventions:

{
  "data": { "createOrder": null },
  "errors": [
    {
      "message": "Insufficient funds",
      "extensions": {
        "code": "INSUFFICIENT_FUNDS",
        "field": "amount"
      }
    }
  ]
}

Versioning

APIs evolve. Versioning strategies determine how you ship changes without breaking existing consumers.

StrategyMechanismProsCons
URL path/v1/usersExplicit, easy to routeURL pollution, hard to deprecate
Accept headerAccept: application/vnd.api+json;version=2Clean URLs, HTTP-correctLess visible, harder to test casually
Query param/users?version=2Simple to implementEasy to forget, caching complications

Practical guidance:

  • URL path versioning is the most common and easiest for consumers to understand
  • Only bump the major version for breaking changes
  • Prefer evolving the API additively (new fields, new endpoints) over creating new versions
  • When a version is deprecated, communicate a sunset date and provide migration guides

See API Evolution Reference for detailed strategies.

Pagination

Every list endpoint needs pagination. The choice between cursor and offset affects performance, consistency, and client complexity.

ApproachHow it worksProsCons
Offset?offset=20&limit=10Simple, supports "jump to page N"Inconsistent with real-time inserts/deletes, slow on large tables
Cursor?after=abc123&limit=10Stable with real-time data, performant at scaleCannot jump to arbitrary pages

Best practices:

  • Set a maximum page size (e.g., 100) and a sensible default (e.g., 20)
  • Return pagination metadata: hasNextPage, hasPreviousPage, totalCount (if cheap to compute)
  • If totalCount is expensive, make it optional or return an estimate
  • Use cursors for feeds, activity streams, and any data that changes frequently
  • Use offset for admin dashboards, reports, and datasets that rarely change during browsing

Cursor pagination response example:

{
  "data": [ ... ],
  "pagination": {
    "hasNextPage": true,
    "hasPreviousPage": false,
    "startCursor": "eyJpZCI6MX0=",
    "endCursor": "eyJpZCI6MTB9"
  }
}

Authentication & Authorization

Authentication verifies identity (who are you?). Authorization verifies permissions (what can you do?).

MechanismUse caseNotes
API keysServer-to-server, simple integrationsEasy to implement; rotate regularly; never expose in client code
OAuth 2.0Third-party access, delegated permissionsIndustry standard; use Authorization Code + PKCE for SPAs/mobile
JWT (Bearer tokens)Stateless auth for microservicesInclude only essential claims; set short expiry; validate signature and claims
Session cookiesBrowser-based web appsPair with CSRF protection; use Secure, HttpOnly, SameSite flags

Best practices:

  • Always use HTTPS — no exceptions
  • Transmit tokens in Authorization: Bearer <token> header, not in query strings
  • Implement scopes/permissions for fine-grained access control
  • Return 401 Unauthorized for missing/invalid credentials, 403 Forbidden for insufficient permissions
  • Rate-limit authentication endpoints aggressively to prevent brute-force attacks
  • Support token refresh flows to avoid forcing re-authentication

Common Antipatterns

AntipatternProblemFix
Chatty APIClients need 10+ requests to render a pageAggregate related data; consider GraphQL or composite endpoints
God endpointSingle endpoint accepts wildly different payloads via flagsSplit into focused endpoints with clear semantics
Inconsistent namingMix of snake_case, camelCase, plural/singularPick one convention and enforce it project-wide
Missing paginationList endpoints return unbounded resultsAlways paginate collections; set max page size
Breaking changes without versioningRenaming or removing fields breaks clients silentlyUse versioning or additive-only evolution
Leaking internalsDatabase column names, auto-increment IDs in URLsMap to stable external identifiers (UUIDs, slugs)
Ignoring idempotencyRetrying a POST creates duplicate resourcesSupport idempotency keys for non-idempotent operations
200 for everythingErrors return HTTP 200 with an error bodyUse appropriate HTTP status codes
Timestamps without timezone2024-01-15 14:30:00 is ambiguousAlways use ISO 8601 with timezone: 2024-01-15T14:30:00Z

Quality Checklist

Before shipping or reviewing an API, verify:

  • Resource naming is consistent (plural nouns, no verbs in URLs)
  • HTTP methods match semantics (GET is safe, PUT/DELETE are idempotent)
  • Every list endpoint is paginated with a max page size
  • Error responses use a consistent format with machine-readable codes
  • Authentication is required and uses HTTPS
  • Rate limiting is in place with appropriate headers
  • Breaking changes are versioned or avoided via additive evolution
  • Request/response examples exist for every endpoint
  • Timestamps use ISO 8601 with timezone
  • IDs are stable external identifiers, not internal auto-increments
  • CORS is configured for browser clients (if applicable)
  • Compression (gzip/brotli) is enabled for responses
  • API documentation is generated from the source of truth (OpenAPI schema, GraphQL introspection)

平台分布

Codex

36.06%
按下载量换算103

Claude

31.06%
按下载量换算89

Cursor

20.44%
按下载量换算58

Gemini CLI

9.41%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

继续浏览同类 Skills