Skip to main content
subagent

graphql-performance-optimizer — Claude Code subagent for GraphQL speed

A subagent that digs into slow GraphQL queries: finds N+1 patterns, wires up DataLoader, sets caching. Useful when a user list page drags for seconds.

Install into Claude Code · claude-code-templates All methods and platforms ↓
npx claude-code-templates@latest --agent api-graphql/graphql-performance-optimizer
Open on GitHub

What graphql-performance-optimizer does

The subagent works on existing code. It reads resolver files, spots per-record database calls and rewrites them to batched loading with DataLoader. The schema stays untouched. It can also turn on Automatic Persisted Queries in Apollo Server, point APQ at a Redis store and add field-level cache-control so a CDN serves the short GET responses.

Federated graphs get a different set of moves: query plan caching at the router, DataLoader instances scoped to each request context, and batch loading through __resolveReference for entities. That collapses the cross-subgraph fetches behind high p95 latency.

Its tools are Read, Grep, Glob, Edit, Write, Bash, the model is sonnet, and the permission mode is acceptEdits. It edits files on its own, so keep the project under git before you run it. One caveat: security work — query allowlisting, authorization caching, introspection control — is out of scope, that belongs to graphql-security-specialist.

What it helps with

  • find an N+1 in a resolver and rewrite it with DataLoader
  • cut origin hits on a public API
  • cache the query plan in a federated graph
  • drop the extra SELECT COUNT(*) behind connection fields
  • compare query counts before and after a fix

Example prompts for the agent

  • Find the N+1 in our user list resolvers and rewrite them with DataLoader
  • Set up APQ and CDN caching for our Apollo Server
  • Add router query plan caching and batch entity loading

How to install graphql-performance-optimizer

1claude-code-templates

npx claude-code-templates@latest --agent api-graphql/graphql-performance-optimizer

2Manually: put the files in place

.claude/agents/graphql-performance-optimizer.md

For all projects use ~/.claude/agents/. Claude delegates by the description field or an @-mention

Step by step, with commands for each platform: Claude Code subagents: how to create one, call it and keep context clean

Questions about graphql-performance-optimizer

How do I install graphql-performance-optimizer in Claude?

Through the templates CLI: npx claude-code-templates@latest --agent api-graphql/graphql-performance-optimizer. The agent file lands at .claude/agents/graphql-performance-optimizer.md.

What does graphql-performance-optimizer do?

It analyzes GraphQL API performance and edits the code: N+1 in resolvers, caching strategies, batched entity loading. It leaves the schema alone.

Does it handle security topics?

No. Query allowlisting, authorization caching and introspection control are left to the graphql-security-specialist agent.

Similar subagents

All subagents for Backend and APIs →

From the same set205

The whole set →

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor