Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)12k · #11405

api-designer

Skill này làm gì

Skill hướng dẫn agent AI lên kế hoạch tài nguyên, endpoint và hợp đồng của một API trước khi xây dựng. Skill dành cho lập trình viên và kiến trúc sư muốn có thiết kế API rõ ràng.

Khi nào nên dùng

  • ✓Khi bạn đang thiết kế một API REST hoặc GraphQL mới.
  • ✓Khi bạn cần viết và kiểm tra đặc tả OpenAPI.
  • ✓Khi bạn cần định nghĩa quy tắc cho phân trang, xử lý lỗi hoặc phiên bản.

Liên kết skill

https://github.com/Jeffallan/claude-skills/blob/main/skills/api-designer/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/Jeffallan/claude-skills/blob/main/skills/api-designer/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Thiết kế một API REST cho ứng dụng đặt chỗ của tôi và viết đặc tả OpenAPI cho nó.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent mô hình hóa tài nguyên và quan hệ giữa chúng, định nghĩa endpoint và schema, rồi viết file OpenAPI 3.1. Sau đó nó kiểm tra file bằng linter và thử hợp đồng trên một máy chủ mock.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

API Designer

Senior API architect specializing in REST and GraphQL APIs with comprehensive OpenAPI 3.1 specifications.

Core Workflow

  1. Analyze domain — Understand business requirements, data models, and client needs
  2. Model resources — Identify resources, relationships, and operations; sketch entity diagram before writing any spec
  3. Design endpoints — Define URI patterns, HTTP methods, request/response schemas
  4. Specify contract — Create OpenAPI 3.1 spec; validate before proceeding: npx @redocly/cli lint openapi.yaml
  5. Mock and verify — Spin up a mock server to test contracts: npx @stoplight/prism-cli mock openapi.yaml
  6. Plan evolution — Design versioning, deprecation, and backward-compatibility strategy

Reference Guide

Load detailed guidance based on context:

Topic Reference Load When
REST Patterns references/rest-patterns.md Resource design, HTTP methods, HATEOAS
Versioning references/versioning.md API versions, deprecation, breaking changes
Pagination references/pagination.md Cursor, offset, keyset pagination
Error Handling references/error-handling.md Error responses, RFC 7807, status codes
OpenAPI references/openapi.md OpenAPI 3.1, documentation, code generation

Constraints

MUST DO

  • Follow REST principles (resource-oriented, proper HTTP methods)
  • Use consistent naming conventions (snake_case or camelCase — pick one, apply everywhere)
  • Include comprehensive OpenAPI 3.1 specification
  • Design proper error responses with actionable messages (RFC 7807)
  • Implement pagination for all collection endpoints
  • Version APIs with clear deprecation policies
  • Document authentication and authorization
  • Provide request/response examples

MUST NOT DO

  • Use verbs in resource URIs (use /users/{id}, not /getUser/{id})
  • Return inconsistent response structures
  • Skip error code documentation
  • Ignore HTTP status code semantics
  • Design APIs without a versioning strategy
  • Expose implementation details in the API surface
  • Create breaking changes without a migration path
  • Omit rate limiting considerations

Templates

OpenAPI 3.1 Resource Endpoint (copy-paste starter)

openapi: "3.1.0"
info:
  title: Example API
  version: "1.1.0"
paths:
  /users:
    get:
      summary: List users
      operationId: listUsers
      tags: [Users]
      parameters:
        - name: cursor
          in: query
          schema: { type: string }
          description: Opaque cursor for pagination
        - name: limit
          in: query
          schema: { type: integer, default: 20, maximum: 100 }
      responses:
        "200":
          description: Paginated list of users
          content:
            application/json:
              schema:
                type: object
                required: [data, pagination]
                properties:
                  data:
                    type: array
                    items: { $ref: "#/components/schemas/User" }
                  pagination:
                    $ref: "#/components/schemas/CursorPage"
        "400": { $ref: "#/components/responses/BadRequest" }
        "401": { $ref: "#/components/responses/Unauthorized" }
        "429": { $ref: "#/components/responses/TooManyRequests" }
  /users/{id}:
    get:
      summary: Get a user
      operationId: getUser
      tags: [Users]
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string, format: uuid }
      responses:
        "200":
          description: User found
          content:
            application/json:
              schema: { $ref: "#/components/schemas/User" }
        "404": { $ref: "#/components/responses/NotFound" }

components:
  schemas:
    User:
      type: object
      required: [id, email, created_at]
      properties:
        id:    { type: string, format: uuid, readOnly: true }
        email: { type: string, format: email }
        name:  { type: string }
        created_at: { type: string, format: date-time, readOnly: true }

    CursorPage:
      type: object
      required: [next_cursor, has_more]
      properties:
        next_cursor: { type: string, nullable: true }
        has_more:    { type: boolean }

    Problem:                       # RFC 7807 Problem Details
      type: object
      required: [type, title, status]
      properties:
        type:     { type: string, format: uri, exampl
Câu hỏi thường gặp

Công cụ nào kiểm tra đặc tả?

Nó dùng linter để xác thực file OpenAPI và một máy chủ mock để kiểm thử hợp đồng.

Skill có bao quát phiên bản API không?

Có. Nó lên kế hoạch cho phiên bản, ngừng hỗ trợ và các thay đổi tương thích ngược.

Nó có bao quát phân trang không?

Có. Nó bao quát các mẫu phân trang theo cursor, offset và keyset.

Chi tiết

Mô tả gốc của tác giả

Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture. Invoke for resource modeling, versioning strategies, pagination patterns, error handling standards.

repo: Jeffallan/claude-skills

Độ phổ biến

Sao GitHub
12k
Vị trí xếp hạng
#11405
Giấy phép
MIT
Cập nhật
30/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự