Graphql Architect
Use when designing GraphQL schemas, implementing Apollo Federation, or building real-time subscriptions.
Before & after
Same prompt, same agent — the only difference is the skill.
Slow nested GraphQL queries usually point to the N+1 problem. When you query a list of items and each one resolves a nested field, you end up making one database query per item. Some solutions to consider: - Use DataLoader to batch and cache database calls within a request - Implement query depth limiting to prevent deeply nested queries - Add pagination to list fields - Consider query complexity analysis to reject expensive queries - Look into caching at the resolver level DataLoader is probably the most impactful change. It batches individual loads that occur within a single tick of the event loop. Would you like help implementing any of these?
That's N+1. Here's the fix in the order that matters.
THE SHAPE OF THE PROBLEM
query { posts(first: 50) { author { name } } }
→ 1 query for posts, then 50 for authors. 51 round trips for 50 rows.
1 — DATALOADER (does ~90% of the work)
loaders/userLoader.js
new DataLoader(async (ids) => {
const rows = await db.user.findMany({ where: { id: { in: ids } } })
const byId = new Map(rows.map(r => [r.id, r]))
return ids.map(id => byId.get(id) ?? null) // MUST return in input order
})
Two rules people get wrong:
• Construct per request, in context — a module-level loader caches across
users and leaks data between them.
• The batch fn must return results positionally, same length as keys.
Returning the raw DB rows silently mismatches when a row is missing.
51 queries → 2.
2 — DEPTH LIMIT — stop the pathological query, don't just make it fast
depthLimit(7) in validationRules. A client can nest
author→posts→author→posts forever; DataLoader makes that efficient, not
bounded.
3 — COMPLEXITY SCORING
Cost per field, reject over budget. first: 1000 on three nested
connections passes a depth limit and still melts the DB.
4 — CONNECTION PAGINATION on every list field
Unbounded lists are the thing depth limits can't save you from.
IF YOU'RE FEDERATED
Each subgraph needs its own loaders — the gateway batches entity
resolution across subgraphs, but not within one. A @key reference
resolver without a loader is the same N+1, one layer down.
Start with #1 and re-measure before doing the rest.About this skill
name: graphql-architect description: Use when Use when designing GraphQL schemas, implementing Apollo Federation, or building real-time subscriptions.
Graphql Architect
Use when designing GraphQL schemas, implementing Apollo Federation, or building real-time subscriptions. Invoke for schema design, resolvers with DataLoader, query optimization, federation directives.
What you get
- Public GitHub repo
- the skills/graphql-architect folder with SKILL.md and references.
Customize your output
- Fork the repo and extend the skill's reference files for your own stack conventions.
Example output
Activates on a matching request (e.g. building or reviewing Graphql Architect code) and can chain with other skills in the pack.
Best for
Full-stack developers and engineering teams using Claude Code.
SKILL.md preview
---
name: graphql-architect
description: Use when designing GraphQL schemas, implementing Apollo Federation, building resolvers with DataLoader, or optimizing query performance.
version: 1.0.0
category: Development / Backend
author: AgentVolt
license: proprietary
tags:
- development
- backend
---
# Graphql Architect
Designs GraphQL schemas and resolves the hard problems: federation boundaries, N+1 elimination, and real-time subscriptions.
## When to use
… (sign up to view the full skill)More development skills
View all Development skills →Golang Pro
Implements concurrent Go patterns with goroutines and channels, designs microservices over gRPC or REST, profiles performance with pprof.
Laravel Specialist
Build Laravel 12 and 13 apps: Eloquent models and relationships, Sanctum auth, Horizon queues, API resources, and Livewire interfaces.
API Designer
Use when designing REST or GraphQL APIs, creating OpenAPI specifications, or planning API architecture.
Django Expert
Use when building Django web applications or REST APIs with Django REST Framework.