Token导航 LogoToken导航

Agent Skill · 研究检索

api-designer(API 设计)

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

api-designer 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证为 MIT,第三方扫描有未通过项,按安装量在研究检索类的 73,674 个 Skill 里排第 67,317。

总安装 247周安装 10GitHub Stars 9下载 78核验 2026-05-01

安装说明

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

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/autumnsgrove/claudeskills --skill api-designer

这个 Skill 是做什么的

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

api-designer 提供现代 API 设计指导,覆盖 REST 与 GraphQL 范式,适合构建可扩展、安全的接口架构。适用于梳理 endpoint、生成 OpenAPI 草稿、检查字段命名与错误码规范。支持资源导向 URL 设计、分页策略与开发者友好文档生成。

使用前需明确业务语义与鉴权方式,避免凭空补字段或假设未验证规则。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

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

上手步骤

4 步
  1. 1

    确认自己的宿主工具

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

  2. 2

    拿到安装命令

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

  3. 3

    安装后重启宿主

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

  4. 4

    按最小权限试用

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

常见问题

6 条

api-designer 怎么安装?

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

api-designer 支持哪些 AI 工具?

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

api-designer 需要什么权限?

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

api-designer 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

api-designer 用的人多吗?

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

api-designer 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

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

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 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-designer

API 设计 · 本页

2479接触敏感数据MIT未通过

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

SKILL.md 原文

API Designer

Overview

This skill provides comprehensive guidance for designing, documenting, and implementing modern APIs. It covers both REST and GraphQL paradigms, with emphasis on industry best practices, clear documentation, and maintainable architecture. Use this skill to create production-ready API designs that are scalable, secure, and developer-friendly.

Core Capabilities

REST API Design

  • Resource-oriented endpoint design with proper URL structure
  • HTTP method semantics and status code usage
  • Request/response payload design with consistent naming
  • Pagination, filtering, and sorting strategies
  • Error handling and validation patterns

GraphQL API Design

  • Schema definition with type system and relationships
  • Query and mutation design with proper input types
  • Resolver patterns and performance optimization
  • Fragment usage and directive implementation
  • N+1 problem prevention strategies

API Documentation

  • OpenAPI 3.0 specification generation
  • Interactive documentation with Swagger UI
  • Authentication and authorization documentation
  • Example requests/responses with multiple scenarios
  • Code generation from specifications

Authentication & Authorization

  • OAuth 2.0 flows (authorization code, client credentials, PKCE)
  • JWT token design, validation, and rotation
  • API key management and rotation strategies
  • Role-based access control (RBAC) implementation
  • Rate limiting and throttling patterns

API Versioning

  • URL versioning and header-based versioning strategies
  • Semantic versioning for API releases
  • Deprecation planning and communication
  • Backward compatibility maintenance
  • Migration path design

When to Use This Skill

Use this skill when:

  • Designing a new API from scratch or refactoring existing endpoints
  • Creating OpenAPI/Swagger specifications for documentation
  • Implementing authentication and authorization flows
  • Planning API versioning and deprecation strategies
  • Designing GraphQL schemas and resolvers
  • Establishing API governance and best practices

REST API Design Workflow

Step 1: Identify Resources

Identify core resources (nouns) your API will expose:

Resources: Users, Posts, Comments

Collections:
- GET    /users              (List all users)
- POST   /users              (Create new user)

Individual Resources:
- GET    /users/{id}         (Get specific user)
- PUT    /users/{id}         (Replace user - full update)
- PATCH  /users/{id}         (Update user - partial)
- DELETE /users/{id}         (Delete user)

Nested Resources:
- GET    /users/{id}/posts   (Get user's posts)
- POST   /users/{id}/posts   (Create post for user)

Step 2: Design URL Structure

Follow RESTful naming conventions:

Best Practices:

  • Use plural nouns: /users, /posts (not /user, /post)
  • Use hyphens for multi-word: /blog-posts (not /blogPosts or /blog_posts)
  • Keep URLs lowercase
  • Limit nesting to 2 levels maximum
  • Use query parameters for filtering: /posts?status=published&author=123

Quick Examples:

✅ Good:
GET /users
GET /users/123/posts
GET /posts?published=true&limit=10

❌ Bad:
GET /getUsers
GET /users/123/posts/comments/likes  (too deep nesting)
GET /posts/published  (use query param instead)

Step 3: Choose HTTP Methods

Map operations to standard HTTP methods:

  • GET: Retrieve resource(s) - Safe, idempotent, cacheable
  • POST: Create new resource - Returns 201 Created with Location header
  • PUT: Replace entire resource - Idempotent, full replacement
  • PATCH: Partial update - Update specific fields only
  • DELETE: Remove resource - Idempotent, returns 204 or 200

Step 4: Design Request/Response Payloads

Structure JSON payloads consistently:

Naming Conventions:

  • Use camelCase for JSON field names
  • Use ISO 8601 for timestamps (UTC)
  • Use consistent ID formats with prefixes: usr_, post_
  • Include metadata: createdAt, updatedAt

Example Response:

{
  "id": "usr_1234567890",
  "username": "johndoe",
  "email": "john@example.com",
  "profile": {
    "firstName": "John",
    "lastName": "Doe"
  },
  "createdAt": "2025-10-25T10:30:00Z",
  "updatedAt": "2025-10-25T10:30:00Z"
}

Step 5: Implement Error Handling

Design comprehensive error responses:

Error Response Format:

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request parameters",
    "details": [
      {
        "field": "email",
        "message": "Email format is invalid"
      }
    ],
    "requestId": "req_abc123xyz",
    "timestamp": "2025-10-25T10:30:00Z"
  }
}

Key Status Codes:

  • 200 OK: Successful GET, PUT, PATCH
  • 201 Created: Successful POST
  • 204 No Content: Successful DELETE
  • 400 Bad Request: Invalid request data
  • 401 Unauthorized: Missing/invalid authentication
  • 403 Forbidden: Authenticated but not authorized
  • 404 Not Found: Resource doesn't exist
  • 422 Unprocessable Entity: Validation errors
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server error

Step 6: Add Pagination and Filtering

Cursor-Based Pagination (recommended for large datasets):

GET /posts?limit=20&cursor=eyJpZCI6MTIzfQ

Response:
{
  "data": [...],
  "pagination": {
    "nextCursor": "eyJpZCI6MTQzfQ",
    "hasMore": true
  }
}

Offset-Based Pagination (simpler for small datasets):

GET /posts?limit=20&offset=40&sort=-createdAt

Response:
{
  "data": [...],
  "pagination": {
    "total": 500,
    "limit": 20,
    "offset": 40
  }
}

For detailed pagination strategies and filtering patterns, see references/rest_best_practices.md.

GraphQL API Design Workflow

Step 1: Define Schema Types

Create type definitions for your domain:

type User {
  id: ID!
  username: String!
  email: String!
  profile: Profile
  posts(limit: Int = 10): [Post!]!
  createdAt: DateTime!
}

type Post {
  id: ID!
  title: String!
  content: String!
  published: Boolean!
  author: User!
  tags: [String!]!
  createdAt: DateTime!
}

Step 2: Design Queries

Define read operations with filtering:

type Query {
  user(id: ID!): User
  post(id: ID!): Post

  users(
    limit: Int = 10
    offset: Int = 0
    search: String
  ): UserConnection!

  posts(
    limit: Int = 10
    published: Boolean
    authorId: ID
    tags: [String!]
  ): PostConnection!
}

Step 3: Design Mutations

Define write operations with input types and error handling:

type Mutation {
  createUser(input: CreateUserInput!): CreateUserPayload!
  updateUser(id: ID!, input: UpdateUserInput!): UpdateUserPayload!
  createPost(input: CreatePostInput!): CreatePostPayload!
}

input CreateUserInput {
  username: String!
  email: String!
  password: String!
}

type CreateUserPayload {
  user: User
  errors: [Error!]
}

For complete GraphQL schema examples, see examples/graphql_schema.graphql.

Authentication Patterns

OAuth 2.0 Quick Reference

Authorization Code Flow (web apps with backend):

1. Redirect to /oauth/authorize with client_id, redirect_uri, scope
2. User authenticates and grants permission
3. Receive authorization code via redirect
4. Exchange code for access token at /oauth/token
5. Use access token in Authorization header

Client Credentials Flow (service-to-service):

POST /oauth/token
{
  "grant_type": "client_credentials",
  "client_id": "CLIENT_ID",
  "client_secret": "SECRET"
}

PKCE Flow (mobile/SPA - most secure for public clients):

1. Generate code_verifier and code_challenge
2. Request authorization with code_challenge
3. Exchange code for token with code_verifier (no client_secret needed)

JWT Token Design

Token Structure:

{
  "header": { "alg": "RS256", "typ": "JWT" },
  "payload": {
    "sub": "usr_1234567890",
    "iat": 1698336000,
    "exp": 1698339600,
    "scope": ["read:posts", "write:posts"],
    "roles": ["user", "editor"]
  }
}

Usage:

Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...

API Key Authentication

X-API-Key: sk_live_abcdef1234567890

Best Practices:

  • Different keys for different environments (dev, staging, prod)
  • Support multiple keys per account for rotation
  • Implement key expiration and usage logging
  • Never expose keys in client-side code

For comprehensive authentication patterns including refresh tokens, MFA, and security best practices, see references/authentication.md.

API Versioning Strategies

URL Versioning (Recommended)

/v1/users
/v2/users

Pros: Clear, explicit, easy to cache and route Cons: URL proliferation, multiple codebases

Header Versioning

Accept: application/vnd.myapi.v2+json
API-Version: 2

Pros: Clean URLs, same endpoint Cons: Less visible, harder to test in browser

When to Version

Create new version for:

  • Removing endpoints or fields
  • Changing field types or names
  • Modifying authentication methods
  • Breaking existing client contracts

Don't version for:

  • Adding new optional fields
  • Adding new endpoints
  • Bug fixes or performance improvements

For detailed versioning strategies, deprecation processes, and migration patterns, see references/versioning-strategies.md.

OpenAPI Specification

Basic Structure

openapi: 3.0.0
info:
  title: My API
  version: 1.0.0
  description: API description

servers:
  - url: https://api.example.com/v1

paths:
  /users:
    get:
      summary: List users
      parameters:
        - name: limit
          in: query
          schema:
            type: integer
            default: 10
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserList'

components:
  schemas:
    User:
      type: object
      required:
        - username
        - email
      properties:
        id:
          type: string
        username:
          type: string
        email:
          type: string
          format: email

For complete OpenAPI specification examples, see examples/openapi_spec.yaml.

Generating Documentation

Use the helper script to generate and validate specs:

# Generate OpenAPI spec from code
python scripts/api_helper.py generate --input api.py --output openapi.yaml

# Validate existing spec
python scripts/api_helper.py validate --spec openapi.yaml

# Generate documentation site
python scripts/api_helper.py docs --spec openapi.yaml --output docs/

Best Practices Summary

Consistency

  • Use consistent naming conventions across all endpoints
  • Standardize error response format
  • Apply same authentication pattern everywhere
  • Use uniform timestamp format (ISO 8601 with UTC)

Security

  • Always use HTTPS in production
  • Validate all input data thoroughly
  • Implement rate limiting per user/key/IP
  • Use proper authentication for all endpoints
  • Never expose sensitive data in URLs or logs
  • Implement proper CORS configuration

Performance

  • Use pagination for large datasets
  • Implement caching headers (ETag, Cache-Control)
  • Support compression (gzip)
  • Use cursor-based pagination for real-time data
  • Implement field selection for sparse fieldsets

Documentation

  • Document all endpoints with OpenAPI
  • Provide example requests and responses
  • Document error codes and meanings
  • Include authentication instructions
  • Keep documentation in sync with code

Maintainability

  • Version APIs appropriately with clear deprecation timelines
  • Provide deprecation warnings before removing features
  • Write integration tests for all endpoints
  • Monitor API usage, errors, and performance
  • Maintain backward compatibility when possible

Common Patterns

Health Check

GET /health
Response: { "status": "ok", "timestamp": "2025-10-25T10:30:00Z" }

Batch Operations

POST /users/batch
{
  "operations": [
    { "method": "POST", "path": "/users", "body": {...} },
    { "method": "PATCH", "path": "/users/123", "body": {...} }
  ]
}

Webhooks

POST /webhooks/configure
{
  "url": "https://your-app.com/webhook",
  "events": ["user.created", "post.published"],
  "secret": "webhook_secret_key"
}

For additional patterns including idempotency, long-running operations, file uploads, and soft deletes, see references/common-patterns.md.

Quick Reference Checklists

REST Endpoint Design

  • Use plural nouns for collections
  • Limit URL nesting to 2 levels
  • Use appropriate HTTP methods
  • Return correct status codes
  • Implement consistent error format
  • Add pagination for collections
  • Include filtering and sorting
  • Document with OpenAPI
  • Implement authentication
  • Add rate limiting

GraphQL Schema Design

  • Define clear type hierarchy
  • Use nullable types appropriately
  • Implement pagination (connections)
  • Design mutations with input types
  • Return errors in payload
  • Document schema with descriptions
  • Implement authentication/authorization
  • Optimize for N+1 queries (DataLoader)

Additional Resources

Comprehensive References

  • references/rest_best_practices.md - Complete REST API patterns, status codes, and implementation details
  • references/authentication.md - OAuth 2.0, JWT, API keys, MFA, and security best practices
  • references/versioning-strategies.md - Versioning approaches, deprecation, and migration strategies
  • references/common-patterns.md - Health checks, webhooks, batch operations, and more

Examples

  • examples/openapi_spec.yaml - Complete OpenAPI 3.0 specification for a blog API
  • examples/graphql_schema.graphql - Full GraphQL schema with queries, mutations, and subscriptions

Tools

  • scripts/api_helper.py - API specification generation, validation, and documentation utilities

平台分布

windsurf

29.37%
按下载量换算23

OpenCode

22.79%
按下载量换算18

Codex

18.78%
按下载量换算15

Claude Code

14.71%
按下载量换算11

Antigravity

9%
按下载量换算7

Gemini CLI

3.94%
按下载量换算3

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

未通过

权限和风险

接触敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。

继续浏览同类 Skills