Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

api-design-reviewerAPI 设计 reviewer

Agent Skill

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

总安装

2,471

周安装

104

GitHub Stars

103

下载量

865
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/borghei/claude-skills --skill api-design-reviewer

简介

对 API 设计进行自动化审查,确保符合 REST 规范与行业最佳实践。

  • 支持资源命名、HTTP 方法使用、版本控制与错误码标准化检查。
  • 输出设计评分卡与重构建议,帮助团队维护接口一致性。
  • 需结合具体业务语义验证字段含义,避免仅依赖格式而忽略实际用途。
  • api-design-reviewer 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

API Design Reviewer

Tier: POWERFUL Category: Engineering / Architecture Maintainer: Claude Skills Team

Overview

The API Design Reviewer skill provides comprehensive analysis and review of API designs, focusing on REST conventions, best practices, and industry standards. This skill helps engineering teams build consistent, maintainable, and well-designed APIs through automated linting, breaking change detection, and design scorecards.

Core Capabilities

1. API Linting and Convention Analysis

  • Resource Naming Conventions: Enforces kebab-case for resources, camelCase for fields
  • HTTP Method Usage: Validates proper use of GET, POST, PUT, PATCH, DELETE
  • URL Structure: Analyzes endpoint patterns for consistency and RESTful design
  • Status Code Compliance: Ensures appropriate HTTP status codes are used
  • Error Response Formats: Validates consistent error response structures
  • Documentation Coverage: Checks for missing descriptions and documentation gaps

2. Breaking Change Detection

  • Endpoint Removal: Detects removed or deprecated endpoints
  • Response Shape Changes: Identifies modifications to response structures
  • Field Removal: Tracks removed or renamed fields in API responses
  • Type Changes: Catches field type modifications that could break clients
  • Required Field Additions: Flags new required fields that could break existing integrations
  • Status Code Changes: Detects changes to expected status codes

3. API Design Scoring and Assessment

  • Consistency Analysis (30%): Evaluates naming conventions, response patterns, and structural consistency
  • Documentation Quality (20%): Assesses completeness and clarity of API documentation
  • Security Implementation (20%): Reviews authentication, authorization, and security headers
  • Usability Design (15%): Analyzes ease of use, discoverability, and developer experience
  • Performance Patterns (15%): Evaluates caching, pagination, and efficiency patterns

REST Design Principles

Resource Naming Conventions

✅ Good Examples:
- /api/v1/users
- /api/v1/user-profiles
- /api/v1/orders/123/line-items

❌ Bad Examples:
- /api/v1/getUsers
- /api/v1/user_profiles
- /api/v1/orders/123/lineItems

HTTP Method Usage

  • GET: Retrieve resources (safe, idempotent)
  • POST: Create new resources (not idempotent)
  • PUT: Replace entire resources (idempotent)
  • PATCH: Partial resource updates (not necessarily idempotent)
  • DELETE: Remove resources (idempotent)

URL Structure Best Practices

Collection Resources: /api/v1/users
Individual Resources: /api/v1/users/123
Nested Resources: /api/v1/users/123/orders
Actions: /api/v1/users/123/activate (POST)
Filtering: /api/v1/users?status=active&role=admin

Versioning Strategies

1. URL Versioning (Recommended)

/api/v1/users
/api/v2/users

Pros: Clear, explicit, easy to route Cons: URL proliferation, caching complexity

2. Header Versioning

GET /api/users
Accept: application/vnd.api+json;version=1

Pros: Clean URLs, content negotiation Cons: Less visible, harder to test manually

3. Media Type Versioning

GET /api/users
Accept: application/vnd.myapi.v1+json

Pros: RESTful, supports multiple representations Cons: Complex, harder to implement

4. Query Parameter Versioning

/api/users?version=1

Pros: Simple to implement Cons: Not RESTful, can be ignored

Pagination Patterns

Offset-Based Pagination

{
  "data": [...],
  "pagination": {
    "offset": 20,
    "limit": 10,
    "total": 150,
    "hasMore": true
  }
}

Cursor-Based Pagination

{
  "data": [...],
  "pagination": {
    "nextCursor": "eyJpZCI6MTIzfQ==",
    "hasMore": true
  }
}

Page-Based Pagination

{
  "data": [...],
  "pagination": {
    "page": 3,
    "pageSize": 10,
    "totalPages": 15,
    "totalItems": 150
  }
}

Error Response Formats

Standard Error Structure

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "The request contains invalid parameters",
    "details": [
      {
        "field": "email",
        "code": "INVALID_FORMAT",
        "message": "Email address is not valid"
      }
    ],
    "requestId": "req-123456",
    "timestamp": "2024-02-16T13:00:00Z"
  }
}

HTTP Status Code Usage

  • 400 Bad Request: Invalid request syntax or parameters
  • 401 Unauthorized: Authentication required
  • 403 Forbidden: Access denied (authenticated but not authorized)
  • 404 Not Found: Resource not found
  • 409 Conflict: Resource conflict (duplicate, version mismatch)
  • 422 Unprocessable Entity: Valid syntax but semantic errors
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Unexpected server error

Authentication and Authorization Patterns

Bearer Token Authentication

Authorization: Bearer <token>

API Key Authentication

X-API-Key: <api-key>
Authorization: Api-Key <api-key>

OAuth 2.0 Flow

Authorization: Bearer <oauth-access-token>

Role-Based Access Control (RBAC)

{
  "user": {
    "id": "123",
    "roles": ["admin", "editor"],
    "permissions": ["read:users", "write:orders"]
  }
}

Rate Limiting Implementation

Headers

X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1640995200

Response on Limit Exceeded

{
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Too many requests",
    "retryAfter": 3600
  }
}

HATEOAS (Hypermedia as the Engine of Application State)

Example Implementation

{
  "id": "123",
  "name": "John Doe",
  "email": "john@example.com",
  "_links": {
    "self": { "href": "/api/v1/users/123" },
    "orders": { "href": "/api/v1/users/123/orders" },
    "profile": { "href": "/api/v1/users/123/profile" },
    "deactivate": {
      "href": "/api/v1/users/123/deactivate",
      "method": "POST"
    }
  }
}

Idempotency

Idempotent Methods

  • GET: Always safe and idempotent
  • PUT: Should be idempotent (replace entire resource)
  • DELETE: Should be idempotent (same result)
  • PATCH: May or may not be idempotent

Idempotency Keys

POST /api/v1/payments
Idempotency-Key: 123e4567-e89b-12d3-a456-426614174000

Backward Compatibility Guidelines

Safe Changes (Non-Breaking)

  • Adding optional fields to requests
  • Adding fields to responses
  • Adding new endpoints
  • Making required fields optional
  • Adding new enum values (with graceful handling)

Breaking Changes (Require Version Bump)

  • Removing fields from responses
  • Making optional fields required
  • Changing field types
  • Removing endpoints
  • Changing URL structures
  • Modifying error response formats

OpenAPI/Swagger Validation

Required Components

  • API Information: Title, description, version
  • Server Information: Base URLs and descriptions
  • Path Definitions: All endpoints with methods
  • Parameter Definitions: Query, path, header parameters
  • Request/Response Schemas: Complete data models
  • Security Definitions: Authentication schemes
  • Error Responses: Standard error formats

Best Practices

  • Use consistent naming conventions
  • Provide detailed descriptions for all components
  • Include examples for complex objects
  • Define reusable components and schemas
  • Validate against OpenAPI specification

Performance Considerations

Caching Strategies

Cache-Control: public, max-age=3600
ETag: "123456789"
Last-Modified: Wed, 21 Oct 2015 07:28:00 GMT

Efficient Data Transfer

  • Use appropriate HTTP methods
  • Implement field selection (?fields=id,name,email)
  • Support compression (gzip)
  • Implement efficient pagination
  • Use ETags for conditional requests

Resource Optimization

  • Avoid N+1 queries
  • Implement batch operations
  • Use async processing for heavy operations
  • Support partial updates (PATCH)

Security Best Practices

Input Validation

  • Validate all input parameters
  • Sanitize user data
  • Use parameterized queries
  • Implement request size limits

Authentication Security

  • Use HTTPS everywhere
  • Implement secure token storage
  • Support token expiration and refresh
  • Use strong authentication mechanisms

Authorization Controls

  • Implement principle of least privilege
  • Use resource-based permissions
  • Support fine-grained access control
  • Audit access patterns

Tools and Scripts

api_linter.py

Analyzes API specifications for compliance with REST conventions and best practices.

Features:

  • OpenAPI/Swagger spec validation
  • Naming convention checks
  • HTTP method usage validation
  • Error format consistency
  • Documentation completeness analysis

breaking_change_detector.py

Compares API specification versions to identify breaking changes.

Features:

  • Endpoint comparison
  • Schema change detection
  • Field removal/modification tracking
  • Migration guide generation
  • Impact severity assessment

api_scorecard.py

Provides comprehensive scoring of API design quality.

Features:

  • Multi-dimensional scoring
  • Detailed improvement recommendations
  • Letter grade assessment (A-F)
  • Benchmark comparisons
  • Progress tracking

Integration Examples

CI/CD Integration

- name: API Linting
  run: python scripts/api_linter.py openapi.json

- name: Breaking Change Detection
  run: python scripts/breaking_change_detector.py openapi-v1.json openapi-v2.json

- name: API Scorecard
  run: python scripts/api_scorecard.py openapi.json

Pre-commit Hooks

#!/bin/bash
python engineering/api-design-reviewer/scripts/api_linter.py api/openapi.json
if [ $? -ne 0 ]; then
  echo "API linting failed. Please fix the issues before committing."
  exit 1
fi

Best Practices Summary

  1. Consistency First: Maintain consistent naming, response formats, and patterns
  2. Documentation: Provide comprehensive, up-to-date API documentation
  3. Versioning: Plan for evolution with clear versioning strategies
  4. Error Handling: Implement consistent, informative error responses
  5. Security: Build security into every layer of the API
  6. Performance: Design for scale and efficiency from the start
  7. Backward Compatibility: Minimize breaking changes and provide migration paths
  8. Testing: Implement comprehensive testing including contract testing
  9. Monitoring: Add observability for API usage and performance
  10. Developer Experience: Prioritize ease of use and clear documentation

Common Anti-Patterns to Avoid

  1. Verb-based URLs: Use nouns for resources, not actions
  2. Inconsistent Response Formats: Maintain standard response structures
  3. Over-nesting: Avoid deeply nested resource hierarchies
  4. Ignoring HTTP Status Codes: Use appropriate status codes for different scenarios
  5. Poor Error Messages: Provide actionable, specific error information
  6. Missing Pagination: Always paginate list endpoints
  7. No Versioning Strategy: Plan for API evolution from day one
  8. Exposing Internal Structure: Design APIs for external consumption, not internal convenience
  9. Missing Rate Limiting: Protect your API from abuse and overload
  10. Inadequate Testing: Test all aspects including error cases and edge conditions

Conclusion

The API Design Reviewer skill provides a comprehensive framework for building, reviewing, and maintaining high-quality REST APIs. By following these guidelines and using the provided tools, development teams can create APIs that are consistent, well-documented, secure, and maintainable.

Regular use of the linting, breaking change detection, and scoring tools ensures continuous improvement and helps maintain API quality throughout the development lifecycle.

Troubleshooting

ProblemCauseSolution
Linter reports false positives on action endpoints (e.g., /activate)Verb detection flags action segments as REST anti-patternsAction endpoints are acceptable for non-CRUD operations; suppress with caution or restructure as POST /resource/{id}/activations
Breaking change detector misses schema-level changesInput specs lack components/schemas definitions or use inline schemasEnsure both old and new specs define reusable schemas under components/schemas for accurate comparison
Scorecard gives low security score despite auth being implementedSecurity schemes are defined but not applied globally or per-operationAdd a top-level security array in the OpenAPI spec and reference securitySchemes under components
Linter exits with code 1 on specs with no endpointsZero endpoints with any structural error triggers a non-zero exitVerify the spec contains at least one path under paths; the linter requires endpoints to produce a meaningful score
JSON parse error on valid YAML OpenAPI specsAll three tools accept JSON input onlyConvert YAML specs to JSON before running tools: python -c "import yaml,json,sys; json.dump(yaml.safe_load(open(sys.argv[1])),open(sys.argv[2],'w'),indent=2)" spec.yaml spec.json
Naming convention warnings on legacy APIs with snake_case fieldsLinter enforces camelCase for properties and kebab-case for URL segmentsFor brownfield APIs, address naming in new endpoints first and plan a migration for existing fields across a major version bump
Scorecard reports 0% for performance categorySpec contains no caching headers, pagination, or compression referencesAdd Cache-Control response headers, define pagination query parameters (limit, offset or cursor), and document compression support

Success Criteria

  • Zero breaking changes detected between consecutive minor or patch releases (semver compliance)
  • API consistency score (from api_scorecard.py) above 90 across all reviewed specifications
  • Overall scorecard grade of B or higher (80+) before any API ships to production
  • 100% of endpoints include at least one success response and one error response definition
  • All path segments follow kebab-case naming and all schema properties follow camelCase naming with zero linter errors
  • Breaking change reports generated and reviewed for every PR that modifies an OpenAPI spec
  • Documentation coverage score above 85%, meaning every operation has a summary and every schema has a description

Scope & Limitations

This skill covers:

  • Linting OpenAPI 3.x and Swagger 2.0 JSON specifications against REST conventions
  • Detecting breaking, potentially-breaking, and non-breaking changes between two spec versions
  • Scoring API design quality across consistency, documentation, security, usability, and performance
  • Generating actionable migration guides when breaking changes are found

This skill does NOT cover:

  • Runtime API testing, load testing, or contract testing (see api-test-suite-builder)
  • GraphQL, gRPC, or WebSocket API design review
  • Auto-generation of OpenAPI specs from code or server stubs
  • Authentication flow implementation or OAuth server configuration (see senior-security in engineering/)

Integration Points

SkillIntegrationData Flow
engineering/api-test-suite-builderGenerate test cases from linter findingsLinter issues feed into test plan priorities for endpoint validation
engineering/changelog-generatorDocument breaking changes in release notesBreaking change detector output provides structured change data for changelogs
engineering/ci-cd-pipeline-builderGate deployments on API qualityScorecard grade and linter exit codes integrate as pipeline quality gates
engineering/senior-backendReview API implementation against designScorecard recommendations guide backend refactoring decisions
engineering/code-reviewerEnrich PR reviews with API analysisLinter and breaking change reports attach to PR review comments
engineering/release-managerValidate version bumps match change severityBreaking change detector severity levels inform semver version decisions

Tool Reference

api_linter.py

Purpose: Analyzes OpenAPI/Swagger JSON specifications for compliance with REST conventions and best practices. Checks naming conventions, HTTP method usage, URL structure, status codes, error formats, documentation completeness, and security configuration.

Usage:

python api_linter.py [OPTIONS] INPUT_FILE

Parameters:

ParameterTypeRequiredDefaultDescription
input_filepositionalYes--Path to OpenAPI/Swagger JSON file or raw endpoints JSON
--formatoptionNotextOutput format: text or json
--raw-endpointsflagNooffTreat input as raw endpoint definitions instead of an OpenAPI spec
--outputoptionNostdoutWrite report to the specified file path

Example:

python api_linter.py openapi.json
python api_linter.py --format json openapi.json > report.json
python api_linter.py --raw-endpoints endpoints.json
python api_linter.py --output lint-report.txt openapi.json

Output Formats:

  • text -- Human-readable report with issue breakdown by category, severity icons, suggestions, and a scoring summary. Exits with code 1 if any errors are found, 0 otherwise.
  • json -- Machine-readable JSON object with summary (total_endpoints, endpoints_with_issues, total_issues, errors, warnings, info, score) and issues array (severity, category, message, path, suggestion).

breaking_change_detector.py

Purpose: Compares two versions of an OpenAPI JSON specification and detects breaking changes including removed endpoints, modified response structures, removed fields, type changes, new required fields, parameter changes, and status code changes. Generates migration guides for each breaking change.

Usage:

python breaking_change_detector.py [OPTIONS] OLD_SPEC NEW_SPEC

Parameters:

ParameterTypeRequiredDefaultDescription
old_specpositionalYes--Path to the old (baseline) API specification JSON file
new_specpositionalYes--Path to the new API specification JSON file
--formatoptionNotextOutput format: text or json
--outputoptionNostdoutWrite report to the specified file path
--exit-on-breakingflagNooffExit with code 1 if any breaking changes are detected

Example:

python breaking_change_detector.py v1.json v2.json
python breaking_change_detector.py --format json v1.json v2.json > changes.json
python breaking_change_detector.py --exit-on-breaking --output report.txt v1.json v2.json

Output Formats:

  • text -- Human-readable report listing each change with its type (breaking, potentially_breaking, non_breaking, enhancement), severity (critical, high, medium, low, info), category, path, message, impact description, and migration guide.
  • json -- Machine-readable JSON object with summary (total_changes, breaking_changes, potentially_breaking_changes, non_breaking_changes, enhancements, and per-severity counts) and changes array (changeType, severity, category, path, message, oldValue, newValue, migrationGuide, impactDescription).

api_scorecard.py

Purpose: Generates a comprehensive API design quality scorecard by evaluating an OpenAPI JSON specification across five weighted dimensions: Consistency (30%), Documentation (20%), Security (20%), Usability (15%), and Performance (15%). Produces letter grades (A-F) per category and overall, with actionable improvement recommendations.

Usage:

python api_scorecard.py [OPTIONS] SPEC_FILE

Parameters:

ParameterTypeRequiredDefaultDescription
spec_filepositionalYes--Path to the OpenAPI/Swagger specification JSON file
--formatoptionNotextOutput format: text or json
--outputoptionNostdoutWrite scorecard to the specified file path
--min-gradeoptionNononeMinimum acceptable grade (A, B, C, D, F); exits with code 1 if the overall grade falls below this threshold

Example:

python api_scorecard.py openapi.json
python api_scorecard.py --format json openapi.json > scorecard.json
python api_scorecard.py --min-grade B --output scorecard.txt openapi.json

Output Formats:

  • text -- Human-readable scorecard showing API info, per-category scores with letter grades, issue counts, recommendations, and an overall weighted score with grade.
  • json -- Machine-readable JSON object with apiInfo, categoryScores (per category: score, maxScore, weight, letterGrade, weightedScore, issues, recommendations), overallScore, overallGrade, totalEndpoints, and topRecommendations.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

35.4%
按下载量换算306

Claude

29.15%
按下载量换算252

Cursor

17.1%
按下载量换算148

Gemini CLI

8.96%
按下载量换算78

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

通过

权限和风险

敏感数据

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

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills