# API GRAPHQL REST

> Migrates and troubleshoots GraphQL: REST-to-GraphQL transitions, performance debugging, and breaking-change-safe schema evolution. Use when working with rest to graphql, schema evolution or when the user mentions rest to graphql, schema evolution.

- Skill: `opknock/api-graphql-rest` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/api-graphql-rest`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/api-graphql-rest/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-graphql-rest

---


Migrates and troubleshoots GraphQL: REST-to-GraphQL transitions, performance debugging, and breaking-change-safe schema evolution.

## Agentic Workflow: Read -> Reason -> Act (api-graphql-rest)

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

### 1. Read — backend context for `api-graphql-rest`
- Domain: Migrates and troubleshoots GraphQL: REST-to-GraphQL transitions, performance debugging, and breaking-change-safe schema evolution.
- **rest-to-graphql**: Wrap REST endpoints with GraphQL resolvers during migration — `npm install @graphql-tools/url-loader @graphql-tools/stitch`
- **schema-evolution**: Evolve schemas without breaking existing clients — `npx graphql-inspector diff schema-v1.graphql schema-v2.graphql`
- Check `knowledge` and `prerequisites: apollo-server, graphql-codegen, dataloader`

### 2. Reason — think for `api-graphql-rest`
- For `rest-to-graphql`: Wrap REST endpoints with GraphQL resolvers during migration — decide which checks to run
- For `schema-evolution`: Evolve schemas without breaking existing clients — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

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

# API GraphQL (Migration & Evolution)

Migrates to GraphQL and keeps schemas evolving safely.

## When to Use
- REST-to-GraphQL migrations
- Schema breaking-change reviews
- Client compatibility concerns

## Real Commands

```bash
# Wrap REST during migration
curl -s http://localhost:3000/api/users | python -m json.tool
npm install @graphql-tools/url-loader

# Diff schemas
npx graphql-inspector diff schema-v1.graphql schema-v2.graphql

# Fail on removed fields
graphql-inspector diff schema-v1.graphql schema-v2.graphql --rule 'field.removed:error'

# Coverage of real queries
graphql-inspector coverage schema.graphql queries/**/*.graphql
```

## Evolution Rules
- Deprecate with @deprecated first
- Remove after a notice period
- Run diff checks in CI

## Testing
Run all client queries against the new schema before cutting over.

## Best Practices
- Keep the migration layer thin and temporary
- Track query coverage to avoid dead types

## Capabilities

### rest-to-graphql
Wrap REST endpoints with GraphQL resolvers during migration

**Parameters:**
- `restUrl` (string): REST endpoint to wrap
- `graphqlUrl` (string): GraphQL endpoint

**Commands:**
- `npm install @graphql-tools/url-loader @graphql-tools/stitch`
- `npm install graphql-http`
- `curl -s http://localhost:3000/api/users | python -m json.tool`
- `node -e "const {loadFromUrl}=require('@graphql-tools/url-loader');loadFromUrl('http://localhost:3000/graphql').then(s=>console.log(s?'schema loaded':'no'))"`
- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ users { id } }"}'`

**Examples:**
- curl -s http://localhost:3000/api/users | python -m json.tool
- node -e "const {loadFromUrl}=require('@graphql-tools/url-loader');loadFromUrl('http://localhost:3000/graphql').then(s=>console.log(s?'schema loaded':'no'))"
- curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -d '{"query":"{ users { id } }"}'

### schema-evolution
Evolve schemas without breaking existing clients

**Parameters:**
- `oldSchema` (string): Old schema
- `newSchema` (string): New schema

**Commands:**
- `npx graphql-inspector diff schema-v1.graphql schema-v2.graphql`
- `graphql-inspector diff schema-v1.graphql schema-v2.graphql --rule 'field.removed:error'`
- `rover subgraph check mygraph@prod --name products --schema ./products.graphql`
- `node -e "console.log('deprecate before remove: @deprecated + notice period')"`
- `graphql-inspector coverage schema.graphql queries/**/*.graphql`

**Examples:**
- npx graphql-inspector diff schema-v1.graphql schema-v2.graphql
- rover subgraph check mygraph@prod --name products --schema ./products.graphql
- graphql-inspector coverage schema.graphql queries/**/*.graphql

## References
- [GraphQL Inspector Diff](https://the-guild.dev/graphql/inspector/docs/features/diff)
- [GraphQL Tools URL Loader](https://the-guild.dev/graphql/tools/docs/modules/url-loader)

