Deep GraphQL expertise: query planning, cost analysis, persisted queries, caching, and advanced security hardening.
Agentic Workflow: Read -> Reason -> Act (api-graphql-specialist)
You are api-graphql-specialist (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-graphql-specialist
- Domain: Deep GraphQL expertise: query planning, cost analysis, persisted queries, caching, and advanced security hardening.
- query-security: Protect GraphQL APIs with complexity limits, depth limits, and persisted queries —
npm install graphql-cost-analysis
- performance-debugging: Profile and fix N+1 queries, slow resolvers, and cache misses —
npx @apollo/server-plugin-response-cache --help || true
- Check
knowledge and prerequisites: apollo-server, graphql-codegen, dataloader
2. Reason — think for api-graphql-specialist
- For
query-security: Protect GraphQL APIs with complexity limits, depth limits, and persisted queries — decide which checks to run
- For
performance-debugging: Profile and fix N+1 queries, slow resolvers, and cache misses — decide which checks to run
- Evaluate trust/policy:
kdesk trust + kdesk doctor patterns for your inputs
3. Act — execute with api-graphql-specialist 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-specialist:ba6ec6f2
API GraphQL Specialist
Deep expertise in running GraphQL at scale: security, performance, and client efficiency.
When to Use
- Expensive or abusive queries
- N+1 and slow-resolver issues
- Hardening GraphQL in production
Real Commands
# Cost analysis
npm install graphql-query-complexity
# Hardening bundle
npm install @escape.tech/graphql-armor
# Benchmark a query
curl -s -X POST http://localhost:4001/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}' -w '\n%{time_total}s'
# Schema audits
graphql-inspector audit docs/query.graphql schema.graphql
Security Config
maxDepth: 10 — reject deep nesting
maxCost: 1000 — reject expensive queries
- Persisted queries to shrink attack surface
Performance Playbook
- Reproduce with curl timing
- Add DataLoader for batch reads
- Cache resolvers by field and TTL
- Re-benchmark and compare
Best Practices
- Reject unknown queries in production
- Log slow queries above a threshold
- Run schema audit in CI
Capabilities
query-security
Protect GraphQL APIs with complexity limits, depth limits, and persisted queries
Parameters:
maxCost (string): Maximum query cost
maxDepth (string): Maximum query depth
Commands:
npm install graphql-cost-analysis
node -e "const {costAnalysisPlugin}=require('@graphql-community/graphql-query-cost');console.log(typeof costAnalysisPlugin)"
npm install @escape.tech/graphql-armor
node -e "const a=require('@escape.tech/graphql-armor');console.log(Object.keys(a))"
npm install graphql-query-complexity
Examples:
- npm install graphql-query-complexity && node -e "const c=require('graphql-query-complexity');console.log(typeof c)"
- npm install @escape.tech/graphql-armor
- node -e "const a=require('@escape.tech/graphql-armor');const s=a.enableGraphQLArmor();console.log(Object.keys(s))"
performance-debugging
Profile and fix N+1 queries, slow resolvers, and cache misses
Parameters:
query (string): GraphQL query to benchmark
endpoint (string): GraphQL endpoint URL
Commands:
npx @apollo/server-plugin-response-cache --help || true
node --trace-gc server.js 2>&1 | grep -i 'gc ' | head
curl -s -X POST http://localhost:4001/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}' -w '\n%{time_total}s'
graphql-inspector audit docs/query.graphql schema.graphql
npx apollo --version
Examples:
- curl -s -X POST http://localhost:4001/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}' -w '\n%{time_total}s'
- graphql-inspector audit docs/query.graphql schema.graphql
- node --trace-gc server.js 2>&1 | grep -i 'GC' | head -20
References
1---2name: "api-graphql-specialist"3description: "Deep GraphQL expertise: query planning, cost analysis, persisted queries, caching, and advanced security hardening. Use when working with query security, performance debugging or when the user mentions query security, performance debugging."4license: "MIT"5compatibility: "Requires apollo-server, graphql-codegen, dataloader, node.js, python, strawberry. Needs network access."6metadata:7 source: https://skillmd.com/skills/opknock/api-graphql-specialist8 author: Kdesk9 version: 2.0.010 category: backend11allowed-tools: "Glob Grep Read Bash(curl:*) Bash(graphql-inspector:*) Bash(node:*) Bash(npm:*) Bash(npx:*)"12---1314Deep GraphQL expertise: query planning, cost analysis, persisted queries, caching, and advanced security hardening.1516## Agentic Workflow: Read -> Reason -> Act (api-graphql-specialist)1718You are **api-graphql-specialist** (backend) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.1920### 1. Read — backend context for `api-graphql-specialist`21- Domain: Deep GraphQL expertise: query planning, cost analysis, persisted queries, caching, and advanced security hardening.22- **query-security**: Protect GraphQL APIs with complexity limits, depth limits, and persisted queries — `npm install graphql-cost-analysis`23- **performance-debugging**: Profile and fix N+1 queries, slow resolvers, and cache misses — `npx @apollo/server-plugin-response-cache --help || true`24- Check `knowledge` and `prerequisites: apollo-server, graphql-codegen, dataloader`2526### 2. Reason — think for `api-graphql-specialist`27- For `query-security`: Protect GraphQL APIs with complexity limits, depth limits, and persisted queries — decide which checks to run28- For `performance-debugging`: Profile and fix N+1 queries, slow resolvers, and cache misses — decide which checks to run29- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs3031### 3. Act — execute with `api-graphql-specialist` tools32- Tools: `Glob`, `Grep`, `Read`, `Bash`, `Npx` (see frontmatter `tools`/`allowed-tools`)33- Use `safe_path` for any write; record evidence (paths, checksums)34- Fingerprint: `api-graphql-specialist:ba6ec6f2`3536# API GraphQL Specialist3738Deep expertise in running GraphQL at scale: security, performance, and client efficiency.3940## When to Use41- Expensive or abusive queries42- N+1 and slow-resolver issues43- Hardening GraphQL in production4445## Real Commands4647```bash48# Cost analysis49npm install graphql-query-complexity5051# Hardening bundle52npm install @escape.tech/graphql-armor5354# Benchmark a query55curl -s -X POST http://localhost:4001/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}' -w '\n%{time_total}s'5657# Schema audits58graphql-inspector audit docs/query.graphql schema.graphql59```6061## Security Config62- `maxDepth: 10` — reject deep nesting63- `maxCost: 1000` — reject expensive queries64- Persisted queries to shrink attack surface6566## Performance Playbook671. Reproduce with curl timing682. Add DataLoader for batch reads693. Cache resolvers by field and TTL704. Re-benchmark and compare7172## Best Practices73- Reject unknown queries in production74- Log slow queries above a threshold75- Run schema audit in CI7677## Capabilities7879### query-security80Protect GraphQL APIs with complexity limits, depth limits, and persisted queries8182**Parameters:**83- `maxCost` (string): Maximum query cost84- `maxDepth` (string): Maximum query depth8586**Commands:**87- `npm install graphql-cost-analysis`88- `node -e "const {costAnalysisPlugin}=require('@graphql-community/graphql-query-cost');console.log(typeof costAnalysisPlugin)"`89- `npm install @escape.tech/graphql-armor`90- `node -e "const a=require('@escape.tech/graphql-armor');console.log(Object.keys(a))"`91- `npm install graphql-query-complexity`9293**Examples:**94- npm install graphql-query-complexity && node -e "const c=require('graphql-query-complexity');console.log(typeof c)"95- npm install @escape.tech/graphql-armor96- node -e "const a=require('@escape.tech/graphql-armor');const s=a.enableGraphQLArmor();console.log(Object.keys(s))"9798### performance-debugging99Profile and fix N+1 queries, slow resolvers, and cache misses100101**Parameters:**102- `query` (string): GraphQL query to benchmark103- `endpoint` (string): GraphQL endpoint URL104105**Commands:**106- `npx @apollo/server-plugin-response-cache --help || true`107- `node --trace-gc server.js 2>&1 | grep -i 'gc ' | head`108- `curl -s -X POST http://localhost:4001/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}' -w '\n%{time_total}s'`109- `graphql-inspector audit docs/query.graphql schema.graphql`110- `npx apollo --version`111112**Examples:**113- curl -s -X POST http://localhost:4001/graphql -H 'Content-Type: application/json' -d '{"query":"{ products { id name } }"}' -w '\n%{time_total}s'114- graphql-inspector audit docs/query.graphql schema.graphql115- node --trace-gc server.js 2>&1 | grep -i 'GC' | head -20116117## References118- [GraphQL Armor](https://escape.tech/blog/graphql-armor/)119- [Apollo Server Docs](https://www.apollographql.com/docs/apollo-server/)120- [GraphQL Inspector](https://the-guild.dev/graphql/inspector/docs)