# API Version Schema Diffing

> Evolves GraphQL schemas safely: schema diffing with graphql-inspector, deprecation directives, coverage checks, and breaking-change detection. Use when working with schema diffing, deprecations or when the user mentions schema diffing, deprecations.

- Skill: `opknock/api-version-schema-diffing` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-version-schema-diffing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-version-schema-diffing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/api-version-schema-diffing

---


Evolves GraphQL schemas safely: schema diffing with graphql-inspector, deprecation directives, coverage checks, and breaking-change detection.

## Agentic Workflow: Read -> Reason -> Act (api-version-schema-diffing)

You are **Api Version Schema Diffing** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — backend context for `api-version-schema-diffing`
- Domain: Evolves GraphQL schemas safely: schema diffing with graphql-inspector, deprecation directives, coverage checks, and breaking-change detection.
- **schema-diffing**: Diff GraphQL schemas for breaking changes — `npm install -g @graphql-inspector/cli`
- **deprecations**: Mark fields deprecated in the schema — `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json`
- Check `knowledge` and `prerequisites: node.js, python, openapi`

### 2. Reason — think for `api-version-schema-diffing`
- For `schema-diffing`: Diff GraphQL schemas for breaking changes — decide which checks to run
- For `deprecations`: Mark fields deprecated in the schema — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `api-version-schema-diffing` tools
- Tools: `Glob`, `Read`, `Bash`, `Npx`, `Grep` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `api-version-schema-diffing:e7fe20ca`

# API Version v2 - GraphQL

GraphQL schema evolution.

## What This Skill Does
- Detects breaking schema changes
- Manages deprecation directives
- Tracks field coverage

## When to Use
- Evolving GraphQL schemas safely
- Releasing schema changes
- Auditing unused fields

## Real Commands

```bash
npx @graphql-inspector/cli diff schema-old.graphql schema-new.graphql
npx @graphql-inspector/cli coverage --schema schema.graphql --queries "src/**/*.graphql"
```

## Deprecation Pattern

```graphql
type User {
  id: ID!
  legacyName: String @deprecated(reason: "Use displayName")
}
```

## Testing
- Diff every PR against the last release
- Fail CI on breaking diffs
- Remove deprecated fields after coverage drops


## Best Practices
- Prefer additive changes over breaks
- Use @deprecated before removal
- Track usage before deletion

## Capabilities

### schema-diffing
Diff GraphQL schemas for breaking changes

**Parameters:**
- `old-schema` (string): Baseline schema file
- `new-schema` (string): Changed schema file
- `rule` (string): breaking, safe, or dangerous rules

**Commands:**
- `npm install -g @graphql-inspector/cli`
- `npx @graphql-inspector/cli diff schema-old.graphql schema-new.graphql`
- `npx @graphql-inspector/cli diff --rule breaking schema-old.graphql schema-new.graphql`
- `npx @graphql-inspector/cli validate schema.graphql`
- `npx @graphql-inspector/cli coverage --schema schema.graphql --queries "src/**/*.graphql"`

**Examples:**
- diff reports breaking vs non-breaking changes
- --rule breaking filters to breaking-only
- coverage shows unused schema fields

### deprecations
Mark fields deprecated in the schema

**Commands:**
- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ __type(name: \"User\") { fields { name isDeprecated deprecationReason } } }"}' | jq '.data.__type.fields[0]'`
- `npx @graphql-inspector/cli diff schema.graphql schema-next.graphql --rule dangerous`
- `grep -c 'deprecated' schema.graphql`

**Examples:**
- -cli --help
- -api --help

## References
- [GraphQL Inspector](https://the-guild.dev/graphql/inspector/docs)
- [GraphQL Best Practices](https://graphql.org/learn/best-practices/)

