Implements GraphQL APIs in production: Apollo Server, resolvers with DataLoader, subscriptions, and auth integration. Use when building GraphQL servers with Apollo Server. Don't use for schema design or governance (see api-graphql-specialist) or REST-to-GraphQL migration (see api-graphql-rest).
Agentic Workflow: Read -> Reason -> Act (api-graphql-engineer)
You are api-graphql-engineer (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-graphql-engineer
- Domain: Implements GraphQL APIs in production: Apollo Server, resolvers with DataLoader, subscriptions, and auth integration. Use when building GraphQL servers with Apollo Server. Don't use for schema design
- resolver-implementation: Implement field resolvers with batching and error handling —
npm install dataloader
- auth-integration: Protect GraphQL fields with JWT validation and directives —
npm install express-jwt
- Check
knowledge and prerequisites: apollo-server, graphql-codegen, node.js, python
2. Reason — think for api-graphql-engineer
- For
resolver-implementation: Implement field resolvers with batching and error handling — decide which checks to run
- For
auth-integration: Protect GraphQL fields with JWT validation and directives — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-graphql-engineer tools
- Tools:
Glob, Grep, Read, Bash (see frontmatter tools/allowed-tools)
- Use
safe_path for any write; record evidence (paths, checksums)
- Fingerprint:
api-graphql-engineer:796cc66e
API GraphQL Engineer
Builds production GraphQL APIs: resolvers, batching, subscriptions, and auth.
When to Use
- Shipping a real GraphQL service
- Fixing N+1 in existing resolvers
- Adding real-time subscriptions
Real Commands
# DataLoader batching
npm install dataloader
node -e "const D=require('dataloader');const l=new D(ids=>Promise.all(ids.map(id=>id*2)));Promise.all([l.load(1),l.load(2)]).then(console.log)"
# Subscriptions
npm install graphql-subscriptions
node -e "const {PubSub}=require('graphql-subscriptions');const p=new PubSub();console.log(typeof p.publish)"
# JWT on the HTTP layer
npm install express-jwt
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -H 'Authorization: Bearer bad' -d '{"query":"{ me { id } }"}'
Resolver Pattern
- Parent arguments for field resolution
- DataLoader per request context
- Errors with GraphQLError codes
Testing
Benchmark a nested query before and after DataLoader to prove N+1 is gone.
Best Practices
- One DataLoader instance per request
- Validate subscription topics server-side
Capabilities
resolver-implementation
Implement field resolvers with batching and error handling
Parameters:
batchFn (string): Batch loading function
field (string): Resolver field name
Commands:
npm install dataloader
node -e "const D=require('dataloader');const l=new D(ids=>Promise.all(ids.map(id=>id*2)));l.load(3).then(console.log)"
npm install graphql-subscriptions
node -e "const g=require('graphql-subscriptions');const {PubSub}=g;const p=new PubSub();console.log(typeof p.publish)"
npm install bcrypt
Examples:
- node -e "const D=require('dataloader');const l=new D(ids=>Promise.all(ids.map(id=>id*2)));Promise.all([l.load(1),l.load(2)]).then(console.log)"
- node -e "const g=require('graphql-subscriptions');const {PubSub}=g;const p=new PubSub();p.publish('EVENT',{id:1});console.log('published')"
- npm install dataloader graphql-subscriptions
auth-integration
Protect GraphQL fields with JWT validation and directives
Parameters:
secret (string): JWT secret
algorithm (string): Signing algorithm
Commands:
npm install express-jwt
node -e "const {expressjwt}=require('express-jwt');const m=expressjwt({secret:'s',algorithms:['HS256']});console.log(typeof m)"
npm install graphql-directive-auth
curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -H 'Authorization: Bearer bad' -d '{"query":"{ me { id } }"}'
node -e "const j=require('jsonwebtoken');console.log(j.sign({sub:'u1'},'s',{expiresIn:'1h'}))"
Examples:
- node -e "const {expressjwt}=require('express-jwt');const m=expressjwt({secret:'s',algorithms:['HS256']});console.log(typeof m)"
- curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -H 'Authorization: Bearer bad' -d '{"query":"{ me { id } }"}'
- npm install graphql-directive-auth && npm install express-jwt
References
1---2name: "api-graphql-engineer"3description: "Implements GraphQL APIs in production: Apollo Server, resolvers with DataLoader, subscriptions, and auth integration. Use when building GraphQL servers with Apollo Server. Don't use for schema design or governance (see api-graphql-specialist) or REST-to-GraphQL migration (see api-graphql-rest)."4license: "MIT"5compatibility: "Requires apollo-server, graphql-codegen, node.js, python, strawberry, ariadne. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-graphql-engineer8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(node:*) Bash(npm:*)"12---1314Implements GraphQL APIs in production: Apollo Server, resolvers with DataLoader, subscriptions, and auth integration. Use when building GraphQL servers with Apollo Server. Don't use for schema design or governance (see api-graphql-specialist) or REST-to-GraphQL migration (see api-graphql-rest).1516## Agentic Workflow: Read -> Reason -> Act (api-graphql-engineer)1718You are **api-graphql-engineer** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `api-graphql-engineer`21- Domain: Implements GraphQL APIs in production: Apollo Server, resolvers with DataLoader, subscriptions, and auth integration. Use when building GraphQL servers with Apollo Server. Don't use for schema design 22- **resolver-implementation**: Implement field resolvers with batching and error handling — `npm install dataloader`23- **auth-integration**: Protect GraphQL fields with JWT validation and directives — `npm install express-jwt`24- Check `knowledge` and `prerequisites: apollo-server, graphql-codegen, node.js, python`2526### 2. Reason — think for `api-graphql-engineer`27- For `resolver-implementation`: Implement field resolvers with batching and error handling — decide which checks to run28- For `auth-integration`: Protect GraphQL fields with JWT validation and directives — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-graphql-engineer` tools32- Tools: `Glob`, `Grep`, `Read`, `Bash` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-graphql-engineer:796cc66e`3536# API GraphQL Engineer3738Builds production GraphQL APIs: resolvers, batching, subscriptions, and auth.3940## When to Use41- Shipping a real GraphQL service42- Fixing N+1 in existing resolvers43- Adding real-time subscriptions4445## Real Commands4647```bash48# DataLoader batching49npm install dataloader50node -e "const D=require('dataloader');const l=new D(ids=>Promise.all(ids.map(id=>id*2)));Promise.all([l.load(1),l.load(2)]).then(console.log)"5152# Subscriptions53npm install graphql-subscriptions54node -e "const {PubSub}=require('graphql-subscriptions');const p=new PubSub();console.log(typeof p.publish)"5556# JWT on the HTTP layer57npm install express-jwt58curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -H 'Authorization: Bearer bad' -d '{"query":"{ me { id } }"}'59```6061## Resolver Pattern62- Parent arguments for field resolution63- DataLoader per request context64- Errors with GraphQLError codes6566## Testing67Benchmark a nested query before and after DataLoader to prove N+1 is gone.6869## Best Practices70- One DataLoader instance per request71- Validate subscription topics server-side7273## Capabilities7475### resolver-implementation76Implement field resolvers with batching and error handling7778**Parameters:**79- `batchFn` (string): Batch loading function80- `field` (string): Resolver field name8182**Commands:**83- `npm install dataloader`84- `node -e "const D=require('dataloader');const l=new D(ids=>Promise.all(ids.map(id=>id*2)));l.load(3).then(console.log)"`85- `npm install graphql-subscriptions`86- `node -e "const g=require('graphql-subscriptions');const {PubSub}=g;const p=new PubSub();console.log(typeof p.publish)"`87- `npm install bcrypt`8889**Examples:**90- node -e "const D=require('dataloader');const l=new D(ids=>Promise.all(ids.map(id=>id*2)));Promise.all([l.load(1),l.load(2)]).then(console.log)"91- node -e "const g=require('graphql-subscriptions');const {PubSub}=g;const p=new PubSub();p.publish('EVENT',{id:1});console.log('published')"92- npm install dataloader graphql-subscriptions9394### auth-integration95Protect GraphQL fields with JWT validation and directives9697**Parameters:**98- `secret` (string): JWT secret99- `algorithm` (string): Signing algorithm100101**Commands:**102- `npm install express-jwt`103- `node -e "const {expressjwt}=require('express-jwt');const m=expressjwt({secret:'s',algorithms:['HS256']});console.log(typeof m)"`104- `npm install graphql-directive-auth`105- `curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -H 'Authorization: Bearer bad' -d '{"query":"{ me { id } }"}'`106- `node -e "const j=require('jsonwebtoken');console.log(j.sign({sub:'u1'},'s',{expiresIn:'1h'}))"`107108**Examples:**109- node -e "const {expressjwt}=require('express-jwt');const m=expressjwt({secret:'s',algorithms:['HS256']});console.log(typeof m)"110- curl -s -X POST http://localhost:4000/graphql -H 'Content-Type: application/json' -H 'Authorization: Bearer bad' -d '{"query":"{ me { id } }"}'111- npm install graphql-directive-auth && npm install express-jwt112113## References114- [DataLoader](https://github.com/graphql/dataloader)115- [GraphQL Subscriptions](https://the-guild.dev/graphql/subscriptions)116- [Apollo Server Auth](https://www.apollographql.com/docs/apollo-server/security/authentication/)