Token导航 LogoToken导航TokenDH.com
前端设计敏感数据github未标认证来源可访问clear审计通过

dev-api-designDEV API 设计

Agent Skill

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

总安装

2,117

周安装

90

GitHub Stars

60

下载量

742
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/vasilyu1983/ai-agents-public --skill dev-api-design

简介

用于辅助 API 设计、接口文档和服务集成说明,适合梳理 endpoint 和生成 OpenAPI 草稿。

  • 可检查字段命名、错误码结构和前后端联调逻辑,提升接口规范性。
  • 使用时需确认真实业务语义、鉴权方式和分页规则;生成文档时应避免凭空补字段。
  • 最好从现有代码、schema 或接口样例中提取事实作为依据。
  • dev-api-design 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

API Development & Design — Quick Reference

Use this skill to design, implement, and document production-grade APIs (REST, GraphQL, gRPC, and tRPC). Apply it for contract design (OpenAPI), versioning/deprecation, authentication/authorization, rate limiting, pagination, error models, and developer documentation.

Modern best practices (Jan 2026): HTTP semantics and cacheability (RFC 9110), Problem Details error model (RFC 9457), OpenAPI 3.1+, contract-first + breaking-change detection, strong AuthN/Z boundaries, explicit versioning/deprecation, and operable-by-default APIs (idempotency, rate limits, observability, trace context).


Default Execution Checklist

  • Choose an API style based on constraints (public vs internal, performance, client query flexibility).
  • Define the contract first (OpenAPI or GraphQL schema; protobuf for gRPC).
  • Define the error model (RFC 9457 + stable error codes + trace IDs).
  • Define AuthN/AuthZ boundaries (scopes/roles/tenancy) and threat model.
  • Define pagination/filter/sort for all list endpoints.
  • Define rate limits/quotas, idempotency strategy (esp. POST), and retries/backoff guidance.
  • Define observability (W3C Trace Context, request IDs, metrics, logs) and SLOs.
  • Add contract tests + breaking-change checks in CI.
  • Publish docs with examples + migration/deprecation policy.

Quick Reference

TaskPattern/ToolKey ElementsWhen to Use
Design REST APIRESTful DesignNouns (not verbs), HTTP methods, proper status codesResource-based APIs, CRUD operations
Version APIURL Versioning/api/v1/resource, /api/v2/resourceBreaking changes, client migration
Paginate resultsCursor-Basedcursor=eyJpZCI6MTIzfQ&limit=20Real-time data, large collections
Handle errorsRFC 9457 Problem Detailstype, title, status, detail, errors[]Consistent error responses
AuthenticateJWT BearerAuthorization: Bearer <token>Stateless auth, microservices
Rate limitToken BucketX-RateLimit-* headers, 429 responsesPrevent abuse, fair usage
Document APIOpenAPI 3.1Swagger UI, Redoc, code samplesInteractive docs, client SDKs
Flexible queriesGraphQLSchema-first, resolvers, DataLoaderClient-driven data fetching
High-performancegRPC + ProtobufBinary protocol, streamingInternal microservices
TypeScript-firsttRPCEnd-to-end type safety, no codegenMonorepos, internal tools
AI agent APIsREST + MCPAgent experience, machine-readableLLM/agent consumption

Decision Tree: Choosing API Style

User needs: [API Type]
    ├─ Public API for third parties?
    │   └─ REST with OpenAPI docs (broad compatibility)
    │
    ├─ Internal microservices?
    │   ├─ High throughput required? → **gRPC** (binary, fast)
    │   └─ Simple CRUD? → **REST** (easy to debug)
    │
    ├─ TypeScript monorepo (frontend + backend)?
    │   └─ **tRPC** (end-to-end type safety, no codegen)
    │
    ├─ Client needs flexible queries?
    │   ├─ Real-time updates? → **GraphQL Subscriptions** or **WebSockets**
    │   └─ Complex data fetching? → **GraphQL** (avoid over-fetching)
    │
    ├─ Mobile/web clients?
    │   ├─ Many entity types? → **GraphQL** (single endpoint)
    │   └─ Simple resources? → **REST** (cacheable)
    │
    ├─ AI agents consuming API?
    │   └─ REST + **MCP** wrapper (agent experience)
    │
    └─ Streaming or bidirectional?
        └─ **gRPC** (HTTP/2 streaming) or **WebSockets**

Navigation: Core API Patterns

RESTful API Design

Resource: references/restful-design-patterns.md

  • Resource-based URLs with proper HTTP methods (GET, POST, PUT, PATCH, DELETE)
  • HTTP status code semantics (200, 201, 404, 422, 500)
  • Idempotency guarantees (GET, PUT, DELETE)
  • Stateless design principles
  • URL structure best practices (collection vs resource endpoints)
  • Nested resources and action endpoints

Pagination, Filtering & Sorting

Resource: references/pagination-filtering.md

  • Offset-based pagination (simple, static datasets)
  • Cursor-based pagination (real-time feeds, recommended)
  • Page-based pagination (UI with page numbers)
  • Query parameter filtering with operators (_gt, _contains, _in)
  • Multi-field sorting with direction (-created_at)
  • Performance optimization with indexes

Error Handling

Resource: references/error-handling-patterns.md

  • RFC 9457 Problem Details standard
  • HTTP status code reference (4xx client errors, 5xx server errors)
  • Field-level validation errors
  • Trace IDs for debugging
  • Consistent error format across endpoints
  • Security-safe error messages (no stack traces in production)

Authentication & Authorization

Resource: references/authentication-patterns.md

  • JWT (JSON Web Tokens) with refresh token rotation
  • OAuth2 Authorization Code Flow for third-party auth
  • API Key authentication for server-to-server
  • RBAC (Role-Based Access Control)
  • ABAC (Attribute-Based Access Control)
  • Resource-based authorization (user-owned resources)

Rate Limiting & Throttling

Resource: references/rate-limiting-patterns.md

  • Token Bucket algorithm (recommended, allows bursts)
  • Fixed Window vs Sliding Window
  • Rate limit headers (X-RateLimit-*)
  • Tiered rate limits (free, paid, enterprise)
  • Redis-based distributed rate limiting
  • Per-user, per-endpoint, and per-API-key strategies

Navigation: Extended Resources

API Design & Best Practices

GraphQL & gRPC

tRPC (TypeScript-First)

- When to use tRPC vs GraphQL vs REST - Auth middleware patterns - Server-side rendering with Next.js

OpenAPI & Documentation

Webhooks & Event-Driven APIs

  • webhook-patterns.md - Webhook design, delivery guarantees, signature verification, retry policies, DLQs

Real-Time APIs

API Testing

Optional: AI/Automation (LLM/Agent APIs)


Navigation: Templates

Production-ready, copy-paste API implementations with authentication, database, validation, and docs.

Framework-Specific Templates

- Async/await, Pydantic v2, JWT auth, SQLAlchemy 2.0, pagination, OpenAPI docs

- TypeScript, Zod validation, Prisma ORM, JWT refresh tokens, rate limiting

- ViewSets, serializers, Simple JWT, permissions, DRF filtering/pagination

- Spring Security JWT, Spring Data JPA, Bean Validation, Springdoc OpenAPI

Cross-Platform Patterns

- Authentication strategies, pagination, caching, versioning, validation

- Deprecation policy (90-day timeline), backward compatibility rules, error model templates


Do / Avoid

GOOD: Do

  • Version APIs from day one
  • Document deprecation policy before first deprecation
  • Treat breaking changes as a major version (and keep minor changes backward compatible)
  • Include trace IDs in all error responses
  • Return appropriate HTTP status codes
  • Implement rate limiting with clear headers
  • Use RFC 9457 Problem Details for errors

BAD: Avoid

  • Removing fields without deprecation period
  • Changing field types in existing versions
  • Using verbs in resource names (nouns only)
  • Returning 500 for client errors
  • Breaking changes without major version bump
  • Mixing tenant data without explicit isolation
  • Action endpoints everywhere (/doSomething)

Anti-Patterns

Anti-PatternProblemFix
Instant deprecationBreaks clients90-day minimum sunset period
Action endpointsInconsistent APIUse resources + HTTP verbs
Version in bodyHard to route, debugVersion in URL or header
Generic errorsPoor DXSpecific error codes + messages
No rate limit headersClients can't back offInclude X-RateLimit-*
Tenant ID in URL onlyForgery riskValidate against auth token
Leaky abstractionsTight couplingDesign stable contracts

Optional: AI/Automation

Note: AI tools assist but contracts need human review.
  • OpenAPI linting — Spectral, Redocly in CI/CD
  • Breaking change detection — oasdiff automated checks
  • SDK generation — From OpenAPI spec on changes
  • Contract testing — Pact, Dredd automation

Bounded Claims

  • AI-generated OpenAPI specs require human review
  • Automated deprecation detection needs manual confirmation
  • SDK generation requires type verification

External Resources

See data/sources.json for:

  • Official REST, GraphQL, gRPC documentation
  • OpenAPI/Swagger tools and validators
  • API design style guides (Google, Microsoft, Stripe)
  • Security standards (OWASP API Security Top 10)
  • Testing tools (Postman, Insomnia, Paw)

Related Skills

This skill works best when combined with other specialized skills:

Backend Development

  • software-backend - Production backend patterns (Node.js, Python, Java frameworks)

- Use when implementing API server infrastructure - Covers database integration, middleware, error handling

Security & Authentication

- Critical for securing API endpoints - Covers OWASP vulnerabilities, authentication flows, input validation

Database & Data Layer

- Essential for API performance (query optimization, indexing) - Use when APIs interact with relational databases

Testing & Quality

- Contract testing for API specifications - Integration testing for API endpoints

DevOps & Deployment

- API gateway configuration - CI/CD pipelines for API deployments

Documentation

- API reference documentation structure - Complements OpenAPI auto-generated docs

Architecture

- Microservices architecture with APIs - API gateway patterns, service mesh integration

Performance & Observability

- API latency monitoring, distributed tracing - Performance budgets for API endpoints


Usage Notes

For the agent:

  • Apply RESTful principles by default unless user requests GraphQL/gRPC
  • Always include pagination for list endpoints
  • Use RFC 9457 format for error responses
  • Include authentication in all templates (JWT or API keys)
  • Reference framework-specific templates for complete implementations
  • Link to relevant resources for deep-dive guidance

Success Criteria: APIs are discoverable, consistent, well-documented, secure, and follow HTTP/GraphQL semantics correctly.


Time-Sensitive Recommendations

If a user asks for "best" tools/frameworks, "latest" standards, or whether something is still relevant in 2026, do a quick web search using whatever browsing/search tool is available in the current environment. If web access is unavailable, answer from stable principles, state assumptions (traffic, latency, team skills, ecosystem), and avoid overstating currency.

Fact-Checking

  • Use web search/web fetch to verify current external facts, versions, pricing, deadlines, regulations, or platform behavior before final answers.
  • Prefer primary sources; report source links and dates for volatile information.
  • If web access is unavailable, state the limitation and mark guidance as unverified.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

补充不同宿主或平台的使用分布数据

能力 5

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

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

平台分布

Claude Code

30.36%
按下载量换算225

Cursor

25.09%
按下载量换算186

Gemini CLI

18.69%
按下载量换算139

Antigravity

11.95%
按下载量换算89

Codex

7.23%
按下载量换算54

trae

3.85%
按下载量换算29

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills