discover-api

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

API Skills Discovery

API技能发现

Provides automatic access to comprehensive API design, authentication, and implementation skills.
可自动获取全面的API设计、认证与实现技能。

When This Skill Activates

该技能的激活场景

This skill auto-activates when you're working with:
  • REST API design and implementation
  • GraphQL schema design
  • API authentication (JWT, OAuth 2.0, API keys, sessions)
  • API authorization (RBAC, ABAC, permissions)
  • Rate limiting and throttling
  • API versioning strategies
  • Error handling and validation
  • HTTP methods, status codes, endpoints
当你处理以下内容时,该技能会自动激活:
  • REST API设计与实现
  • GraphQL schema设计
  • API认证(JWT、OAuth 2.0、API密钥、会话)
  • API授权(RBAC、ABAC、权限)
  • 速率限制与流量控制
  • API版本控制策略
  • 错误处理与验证
  • HTTP方法、状态码、端点

Available Skills

可用技能

Quick Reference

快速参考

The API category contains 8 specialized skills:
  1. rest-api-design - RESTful resource modeling, HTTP semantics, URL conventions
  2. graphql-schema-design - GraphQL types, resolvers, N+1 problem prevention
  3. api-authentication - JWT, OAuth 2.0, API keys, session management
  4. api-authorization - RBAC, ABAC, policy engines, permission systems
  5. api-rate-limiting - Token bucket, sliding window, rate limiting algorithms
  6. api-versioning - API versioning, deprecation, backward compatibility
  7. api-error-handling - RFC 7807 errors, validation, standardized responses
  8. api-design-rules - 35 opinionated rules for API design
API分类包含8项专业技能:
  1. rest-api-design - RESTful资源建模、HTTP语义、URL规范
  2. graphql-schema-design - GraphQL类型、解析器、N+1问题预防
  3. api-authentication - JWT、OAuth 2.0、API密钥、会话管理
  4. api-authorization - RBAC、ABAC、策略引擎、权限系统
  5. api-rate-limiting - 令牌桶、滑动窗口、速率限制算法
  6. api-versioning - API版本控制、弃用策略、向后兼容性
  7. api-error-handling - RFC 7807错误规范、验证、标准化响应
  8. api-design-rules - 35条API设计的指导性规则

Load Full Category Details

加载完整分类详情

For complete descriptions and workflows:
Read <cc-polymath-root>/skills/api/INDEX.md
This loads the full API category index with:
  • Detailed skill descriptions
  • Usage triggers for each skill
  • Common workflow combinations
  • Cross-references to related skills
如需查看完整描述与工作流程:
Read <cc-polymath-root>/skills/api/INDEX.md
加载后可查看完整的API分类索引,包含:
  • 详细的技能描述
  • 各项技能的触发场景
  • 常见工作流程组合
  • 相关技能的交叉引用

Load Specific Skills

加载特定技能

Load individual skills as needed:
可根据需要加载单个技能:

Core API design

核心API设计

Read <cc-polymath-root>/skills/api/rest-api-design.md Read <cc-polymath-root>/skills/api/graphql-schema-design.md
Read <cc-polymath-root>/skills/api/rest-api-design.md Read <cc-polymath-root>/skills/api/graphql-schema-design.md

Security and access control

安全与访问控制

Read <cc-polymath-root>/skills/api/api-authentication.md Read <cc-polymath-root>/skills/api/api-authorization.md
Read <cc-polymath-root>/skills/api/api-authentication.md Read <cc-polymath-root>/skills/api/api-authorization.md

Production hardening

生产环境强化

Read <cc-polymath-root>/skills/api/api-rate-limiting.md Read <cc-polymath-root>/skills/api/api-error-handling.md Read <cc-polymath-root>/skills/api/api-versioning.md
Read <cc-polymath-root>/skills/api/api-rate-limiting.md Read <cc-polymath-root>/skills/api/api-error-handling.md Read <cc-polymath-root>/skills/api/api-versioning.md

Rules and best practices

规则与最佳实践

Read <cc-polymath-root>/skills/api/api-design-rules.md
Read <cc-polymath-root>/skills/api/api-design-rules.md

Common Workflows

常见工作流程

New REST API

新建REST API

Sequence: REST design → Authentication → Authorization
Read <cc-polymath-root>/skills/api/rest-api-design.md # Resource modeling, HTTP methods Read <cc-polymath-root>/skills/api/api-authentication.md # User authentication Read <cc-polymath-root>/skills/api/api-authorization.md # Access control
流程顺序:REST设计 → 认证 → 授权
Read <cc-polymath-root>/skills/api/rest-api-design.md # 资源建模、HTTP方法 Read <cc-polymath-root>/skills/api/api-authentication.md # 用户认证 Read <cc-polymath-root>/skills/api/api-authorization.md # 访问控制

New GraphQL API

新建GraphQL API

Sequence: GraphQL schema → Authentication → Authorization
Read <cc-polymath-root>/skills/api/graphql-schema-design.md # Schema design, resolvers Read <cc-polymath-root>/skills/api/api-authentication.md # User authentication Read <cc-polymath-root>/skills/api/api-authorization.md # Field-level permissions
流程顺序:GraphQL schema设计 → 认证 → 授权
Read <cc-polymath-root>/skills/api/graphql-schema-design.md # Schema设计、解析器 Read <cc-polymath-root>/skills/api/api-authentication.md # 用户认证 Read <cc-polymath-root>/skills/api/api-authorization.md # 字段级权限

API Hardening

API生产环境强化

Sequence: Rate limiting → Error handling → Versioning
Read <cc-polymath-root>/skills/api/api-rate-limiting.md # Prevent abuse Read <cc-polymath-root>/skills/api/api-error-handling.md # Standardized errors Read <cc-polymath-root>/skills/api/api-versioning.md # Manage evolution
流程顺序:速率限制 → 错误处理 → 版本控制
Read <cc-polymath-root>/skills/api/api-rate-limiting.md # 防止滥用 Read <cc-polymath-root>/skills/api/api-error-handling.md # 标准化错误 Read <cc-polymath-root>/skills/api/api-versioning.md # 管理API演进

Complete API Stack

完整API栈实现

Full implementation from scratch:
从零开始的完整实现

1. Design phase

1. 设计阶段

Read <cc-polymath-root>/skills/api/rest-api-design.md
Read <cc-polymath-root>/skills/api/rest-api-design.md

2. Security phase

2. 安全阶段

Read <cc-polymath-root>/skills/api/api-authentication.md Read <cc-polymath-root>/skills/api/api-authorization.md Read <cc-polymath-root>/skills/api/api-rate-limiting.md
Read <cc-polymath-root>/skills/api/api-authentication.md Read <cc-polymath-root>/skills/api/api-authorization.md Read <cc-polymath-root>/skills/api/api-rate-limiting.md

3. Production readiness

3. 生产就绪阶段

Read <cc-polymath-root>/skills/api/api-error-handling.md Read <cc-polymath-root>/skills/api/api-versioning.md
Read <cc-polymath-root>/skills/api/api-error-handling.md Read <cc-polymath-root>/skills/api/api-versioning.md

Skill Selection Guide

技能选择指南

Choose REST API skills when:
  • Building traditional web services
  • Need simple CRUD operations
  • Working with mobile apps or SPAs
  • Require caching and HTTP semantics
Choose GraphQL skills when:
  • Clients need flexible data fetching
  • Reducing over-fetching or under-fetching
  • Building aggregation layers
  • Need strong typing for APIs
Authentication vs Authorization:
  • Authentication (api-authentication.md): Who are you? (Login, JWT, OAuth)
  • Authorization (api-authorization.md): What can you do? (Permissions, RBAC)
Production considerations:
  • Always implement rate limiting for public APIs
  • Use versioning from day one
  • Standardize error responses early
以下场景选择REST API技能:
  • 构建传统Web服务
  • 需要简单的CRUD操作
  • 与移动应用或SPA配合工作
  • 需要缓存与HTTP语义支持
以下场景选择GraphQL技能:
  • 客户端需要灵活的数据获取方式
  • 减少数据过度获取或获取不足的问题
  • 构建聚合层
  • API需要强类型支持
认证与授权的区别:
  • 认证(api-authentication.md):你是谁?(登录、JWT、OAuth)
  • 授权(api-authorization.md):你能做什么?(权限、RBAC)
生产环境注意事项:
  • 公开API务必实现速率限制
  • 从项目初期就使用版本控制
  • 尽早标准化错误响应

Integration with Other Skills

与其他技能的集成

API skills commonly combine with:
Database skills (
discover-database
):
  • API endpoints → Database queries
  • Connection pooling for API servers
  • Query optimization for API performance
Testing skills (
discover-testing
):
  • Integration tests for API endpoints
  • Contract testing for API consumers
  • Load testing for API performance
Frontend skills (
discover-frontend
):
  • API client libraries
  • Data fetching patterns
  • Error handling in UI
Infrastructure skills (
discover-infra
,
discover-cloud
):
  • API deployment strategies
  • Load balancing and scaling
  • API gateways and proxies
API技能通常与以下技能结合使用:
数据库技能 (
discover-database
):
  • API端点 → 数据库查询
  • API服务器的连接池
  • 针对API性能的查询优化
测试技能 (
discover-testing
):
  • API端点的集成测试
  • API消费者的契约测试
  • API性能的负载测试
前端技能 (
discover-frontend
):
  • API客户端库
  • 数据获取模式
  • UI中的错误处理
基础设施技能 (
discover-infra
,
discover-cloud
):
  • API部署策略
  • 负载均衡与扩容
  • API网关与代理

Usage Instructions

使用说明

  1. Auto-activation: This skill loads automatically when Claude Code detects API-related work
  2. Browse skills: Run
    Read <cc-polymath-root>/skills/api/INDEX.md
    for full category overview
  3. Load specific skills: Use bash commands above to load individual skills
  4. Follow workflows: Use recommended sequences for common API patterns
  5. Combine skills: Load multiple skills for comprehensive coverage
  1. 自动激活:当Claude Code检测到API相关工作时,该技能会自动加载
  2. 浏览技能:运行
    Read <cc-polymath-root>/skills/api/INDEX.md
    查看完整分类概览
  3. 加载特定技能:使用上述bash命令加载单个技能
  4. 遵循工作流程:针对常见API模式使用推荐的流程顺序
  5. 组合技能:加载多个技能以实现全面覆盖

Progressive Loading

渐进式加载

This gateway skill (~200 lines, ~2K tokens) enables progressive loading:
  • Level 1: Gateway loads automatically (you're here now)
  • Level 2: Load category INDEX.md (~3K tokens) for full overview
  • Level 3: Load specific skills (~2-3K tokens each) as needed
Total context: 2K + 3K + skill(s) = 5-10K tokens vs 25K+ for entire index.
这个网关技能(约200行,约2K tokens)支持渐进式加载:
  • Level 1:网关自动加载(当前所处阶段)
  • Level 2:加载分类INDEX.md(约3K tokens)以查看完整概览
  • Level 3:根据需要加载特定技能(每个约2-3K tokens)
总上下文:2K + 3K + 技能内容 = 5-10K tokens,相比完整索引的25K+ tokens更轻量化。

Quick Start Examples

快速入门示例

"Design a REST API for a blog": Read <cc-polymath-root>/skills/api/rest-api-design.md
"Add OAuth authentication to my API": Read <cc-polymath-root>/skills/api/api-authentication.md
"Implement role-based access control": Read <cc-polymath-root>/skills/api/api-authorization.md
"Prevent API abuse": Read <cc-polymath-root>/skills/api/api-rate-limiting.md
"Design an API versioning strategy": Read <cc-polymath-root>/skills/api/api-versioning.md
Next Steps: Run
Read <cc-polymath-root>/skills/api/INDEX.md
to see full category details, or load specific skills using the bash commands above.
"为博客设计REST API": Read <cc-polymath-root>/skills/api/rest-api-design.md
"为我的API添加OAuth认证": Read <cc-polymath-root>/skills/api/api-authentication.md
"实现基于角色的访问控制": Read <cc-polymath-root>/skills/api/api-authorization.md
"防止API滥用": Read <cc-polymath-root>/skills/api/api-rate-limiting.md
"设计API版本控制策略": Read <cc-polymath-root>/skills/api/api-versioning.md
下一步:运行
Read <cc-polymath-root>/skills/api/INDEX.md
查看完整的分类详情,或使用上述bash命令加载特定技能。