Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

api-contract-sync-managerAPI contract sync manager 搜索

Agent Skill

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

总安装

13,043

周安装

586

GitHub Stars

678

下载量

4,365
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/ananddtyagi/cc-marketplace --skill 'API Contract Sync Manager'

简介

维护 OpenAPI/Swagger 或 GraphQL 规范与实现的同步,检测破坏性变更并生成客户端类型。

  • 适用于前后端并行开发场景,确保契约变更及时通知相关方并更新依赖。
  • 使用时需比对 PR 中的 API 修改与规范文件,自动生成迁移指南与测试用例。
  • 安装方式:通过 npx skills add 从指定仓库获取,兼容 Codex、Claude 等宿主环境。
  • 注意:版本策略应明确 breaking change 判定规则,避免误判影响交付节奏。

SKILL.md

API Contract Sync Manager

Maintain synchronization between API specifications and their implementations, detect breaking changes, and generate client code to ensure contracts stay reliable across frontend and backend teams.

When to Use This Skill

Use this skill when:

  • Working with OpenAPI/Swagger specification files (.yaml, .json)
  • Managing GraphQL schemas (.graphql, .gql)
  • Reviewing API changes in pull requests
  • Generating TypeScript types or client code from specs
  • Validating that implementations match documented APIs
  • Detecting breaking vs. non-breaking API changes
  • Creating API versioning strategies
  • Onboarding new developers to an API-driven codebase

Core Capabilities

1. Spec Validation

Validate API specification files for correctness and completeness:

OpenAPI/Swagger Validation:

  • Check schema syntax and structure
  • Validate against OpenAPI 3.0/3.1 standards
  • Ensure all endpoints have proper descriptions
  • Verify request/response schemas are complete
  • Check for required security definitions
  • Validate parameter types and constraints

GraphQL Validation:

  • Parse and validate SDL (Schema Definition Language)
  • Check for schema stitching issues
  • Validate resolver coverage
  • Detect circular dependencies
  • Verify input/output type consistency

Validation Approach:

  1. Read the spec file using the Read tool
  2. Parse the structure (YAML/JSON for OpenAPI, SDL for GraphQL)
  3. Check for common issues:

- Missing required fields - Invalid references ($ref) - Inconsistent naming conventions - Missing examples or descriptions - Security scheme gaps

  1. Report findings with line numbers and suggestions

2. Implementation Matching

Cross-reference API specifications with actual code implementations:

For REST APIs:

  1. Extract all endpoints from OpenAPI spec (paths, methods)
  2. Search codebase for route definitions:

- Express.js: app.get(), router.post(), etc. - FastAPI: @app.get(), @router.post() - Django: path(), urlpatterns - Spring Boot: @GetMapping, @PostMapping

  1. Compare spec endpoints against implemented routes
  2. Flag discrepancies:

- Documented but not implemented - Implemented but not documented - Parameter mismatches - Response type differences

For GraphQL:

  1. Extract types, queries, mutations from schema
  2. Search for resolver implementations
  3. Verify all schema fields have resolvers
  4. Check resolver signatures match schema types

Implementation Matching Steps:

1. Parse spec → extract endpoints/operations
2. Use Grep to find route handlers in codebase
3. Compare and categorize:
   - ✓ Matched: spec and implementation align
   - ⚠ Drift: partial match with differences
   - ✗ Missing: documented but not implemented
   - ⚠ Undocumented: implemented but not in spec
4. Generate coverage report

3. Breaking Change Detection

Compare two versions of an API spec to detect breaking vs. non-breaking changes:

Breaking Changes (require version bump):

  • Removed endpoints or operations
  • Removed required request parameters
  • Changed parameter types (e.g., string → number)
  • Made optional parameters required
  • Removed response properties that clients depend on
  • Changed response status codes
  • Renamed endpoints, parameters, or fields
  • Stricter validation rules (e.g., regex patterns)

Non-Breaking Changes (safe to deploy):

  • Added new endpoints
  • Added optional parameters
  • Made required parameters optional
  • Added new response properties
  • Expanded enum values
  • Improved descriptions/examples
  • Added deprecation warnings

Change Detection Process:

  1. Read both spec versions (old and new)
  2. Compare schemas field by field
  3. Categorize each change as breaking or non-breaking
  4. Generate migration guide with:

- Summary of breaking changes - Impact on existing clients - Required client updates - Recommended versioning strategy

4. Client Code Generation

Generate type-safe client code from API specifications:

TypeScript Interfaces:

// From OpenAPI schema
interface User {
  id: string;
  email: string;
  name?: string;
  createdAt: Date;
}

interface CreateUserRequest {
  email: string;
  name?: string;
}

interface CreateUserResponse {
  user: User;
  token: string;
}

API Client Functions:

// HTTP client with proper typing
async function createUser(
  data: CreateUserRequest
): Promise<CreateUserResponse> {
  const response = await fetch('/api/users', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(data)
  });
  return response.json();
}

React Query Hooks:

// Auto-generated hooks for data fetching
function useUser(userId: string) {
  return useQuery(['user', userId], () =>
    fetch(`/api/users/${userId}`).then(r => r.json())
  );
}

function useCreateUser() {
  return useMutation((data: CreateUserRequest) =>
    fetch('/api/users', {
      method: 'POST',
      body: JSON.stringify(data)
    }).then(r => r.json())
  );
}

Generation Steps:

  1. Parse OpenAPI/GraphQL schema
  2. Extract all data models (schemas, types)
  3. Generate TypeScript interfaces with proper types
  4. Create client functions for each endpoint
  5. Optionally generate hooks for React Query/SWR
  6. Add JSDoc comments from spec descriptions

5. Coverage Analysis

Identify gaps between documentation and implementation:

Analysis Report Structure:

API Coverage Report
==================

Documented Endpoints: 45
Implemented Endpoints: 42
Coverage: 93%

Missing Implementations:
- DELETE /api/users/{id} (documented but not found)
- POST /api/users/{id}/suspend (documented but not found)

Undocumented Endpoints:
- GET /api/internal/health (found in code, not in spec)
- POST /api/debug/reset (found in code, not in spec)

Mismatched Signatures:
- POST /api/users
  Spec expects: { email, name, role }
  Code accepts: { email, name } (missing 'role')

Coverage Analysis Process:

  1. Run implementation matching (see section 2)
  2. Calculate coverage percentage
  3. List all discrepancies with file locations
  4. Prioritize issues by severity
  5. Suggest next steps to achieve 100% coverage

6. Migration Guides

Create upgrade guides when API versions change:

Migration Guide Template:

# API v2.0 Migration Guide

## Breaking Changes

### 1. User Creation Endpoint
**Change**: Required `role` field added to POST /api/users
**Impact**: All user creation calls will fail without this field
**Action Required**:
- Update all POST /api/users calls to include `role`
- Default to 'member' if no specific role needed

Before:

{ "email": "user@example.com", "name": "John" }


After:

{ "email": "user@example.com", "name": "John", "role": "member" }


### 2. Authentication Token Format

**Change**: JWT tokens now use RS256 instead of HS256 **Impact**: Token validation must be updated **Action Required**:

- Update JWT verification libraries
- Fetch new public key from /.well-known/jwks.json

Guide Generation Steps:

  1. Detect all breaking changes (see section 3)
  2. Group changes by endpoint or feature
  3. For each change, document:

- What changed and why - Impact on existing clients - Required code updates with before/after examples - Timeline for deprecation

  1. Add general upgrade instructions

Best Practices

For OpenAPI Specs

  1. Use $ref liberally: Define schemas once, reference everywhere
  2. Version your APIs: Use /v1/, /v2/ prefixes or version headers
  3. Add examples: Include request/response examples in spec
  4. Document errors: Define all possible error responses
  5. Security first: Always specify security requirements

For GraphQL Schemas

  1. Use descriptions: Document all types, fields, and arguments
  2. Deprecate, don't remove: Use @deprecated directive
  3. Input validation: Use custom scalars for validated types
  4. Pagination patterns: Use connection/edge patterns consistently
  5. Error handling: Define custom error types

For Breaking Changes

  1. Version bump: Major version for breaking changes
  2. Deprecation period: Maintain old version for transition
  3. Clear communication: Document changes prominently
  4. Backward compatibility: Provide adapters when possible
  5. Client coordination: Ensure clients can update before removal

Common Workflows

Workflow 1: Validate Existing Spec


1. User: "Validate the OpenAPI spec"
2. Read the spec file (usually openapi.yaml or swagger.json)
3. Parse and validate structure
4. Report any issues with suggestions

Workflow 2: Check Implementation Match


1. User: "Does our API implementation match the spec?"
2. Read spec file
3. Extract all endpoints
4. Search codebase for route handlers
5. Compare and generate coverage report

Workflow 3: Detect Breaking Changes


1. User: "Compare API v1 and v2 specs"
2. Read both spec files
3. Diff schemas systematically
4. Categorize changes as breaking/non-breaking
5. Generate migration guide

Workflow 4: Generate TypeScript Types


1. User: "Generate TypeScript types from the API spec"
2. Read OpenAPI/GraphQL schema
3. Extract all data models
4. Generate TypeScript interfaces
5. Create client functions or hooks if requested

Workflow 5: Find Coverage Gaps


1. User: "What endpoints are missing in our spec?"
2. Run implementation matching
3. Identify undocumented endpoints
4. Suggest adding them to spec with proper schemas

Tools and Commands

Validation Tools

When validation tools are available, use them:

  • OpenAPI: npx @stoplight/spectral-cli lint openapi.yaml
  • GraphQL: npx graphql-inspector validate schema.graphql

Comparison Tools

For advanced diff analysis:

  • OpenAPI: npx openapi-diff old.yaml new.yaml
  • GraphQL: npx graphql-inspector diff old.graphql new.graphql

Code Generation

Recommend these tools for automated generation:

  • openapi-typescript: Generate TypeScript from OpenAPI
  • graphql-code-generator: Generate TypeScript from GraphQL
  • orval: Generate React Query hooks from OpenAPI

Error Handling

When encountering issues:

Invalid Spec File:

  • Report specific syntax errors with line numbers
  • Suggest corrections based on spec version
  • Provide valid example structure

Missing Implementation:

  • List file locations where handlers should exist
  • Suggest framework-specific code to implement
  • Estimate implementation effort

Type Mismatches:

  • Show expected vs. actual types clearly
  • Explain impact of the mismatch
  • Suggest type coercion or spec updates

Additional Resources

For more detailed information on specific topics, see:

  • REFERENCE.md - Technical details on OpenAPI and GraphQL structures
  • EXAMPLES.md - Real-world usage scenarios and code samples

Requirements

This skill works best with:

  • API spec files in the codebase
  • Structured routing in backend code
  • TypeScript for type generation (optional but recommended)

No additional packages are required for basic validation and comparison. Advanced features may suggest installing validation tools via npm.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

Claude Code

27.73%
按下载量换算1,210

windsurf

22.44%
按下载量换算980

OpenCode

16.92%
按下载量换算739

Codex

10.95%
按下载量换算478

Antigravity

7.5%
按下载量换算327

Gemini CLI

3.57%
按下载量换算156

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源字段存在多来源差异,先按来源优先级自动处理,无法消解时进入异常复核队列。

来源信息

继续浏览同类 Skills