# API Contract Diff

> Description

- Skill: `xspoonai/api-contract-diff` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add xspoonai/api-contract-diff`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xspoonai/api-contract-diff/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: XSpoonAi (https://skillmd.com/u/xspoonai)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/xspoonai/api-contract-diff

---


## Description

Compare OpenAPI and GraphQL schemas to identify breaking changes and incompatibilities. Provides detailed diff output for schema migrations.

## Inputs

```json
{
  "schema_type": "openapi|graphql",
  "schema1": "First schema object",
  "schema2": "Second schema object"
}
```

## Outputs

```json
{
  "ok": true,
  "data": {
    "changes": [],
    "breaking_changes": []
  }
}
```

## Usage

### Demo Mode
```bash
python scripts/main.py --demo
```

### Compare Schemas
```bash
echo '{"schema_type": "openapi", "schema1": {}, "schema2": {}}' | python3 scripts/main.py
```

## Examples

### Example 1: Compare OpenAPI Schemas
```bash
$ echo '{"schema_type": "openapi", "schema1": {}, "schema2": {}}' | python3 scripts/main.py
{
  "ok": true,
  "data": {
    "changes": ["Removed endpoint /v1/users"],
    "breaking_changes": ["Parameter type changed from string to integer"]
  }
}
```

## Error Handling

When an error occurs, the skill returns:

```json
{
  "ok": false,
  "error": "Error description",
  "details": {
    "schema_type": "Invalid schema type"
  }
}
```

