Purpose
Design clean, evolvable, and performant GraphQL schemas following best practices for naming, mutations, connection pagination, error modeling, and batch resolution (DataLoader).
When to Use
- Designing new GraphQL types, queries, and mutations.
- Refactoring sprawling, unprincipled GraphQL schemas.
- Preventing N+1 database queries and performance bottlenecks in nested resolvers.
What to Analyze
- Schema Design & Naming: Verb-noun conventions for mutations, scalar types, and deprecation strategies.
- Pagination Pattern: Relay Cursor Connections (
first,after,edges,node,pageInfo). - Mutation Design: Single input object argument (
input: DoSomethingInput!), and return payload witherrorsunion. - N+1 Resolver Prevention: DataLoader batching strategies for related entity fields.
- Security & Complexity: Query depth limits and field complexity calculations.
Output Format
- Schema Definition Language (SDL): Complete
.graphqltypes, inputs, and payloads. - DataLoader Specification: Batching pattern needed for nested resolvers.
- Usage Example: Sample query/mutation with expected JSON response.
- Evolution Guide: How to safely deprecate and extend fields without breaking existing mobile/web clients.
Avoid
- Mirroring database tables 1:1 into GraphQL types without domain abstraction.
- Using offset-based pagination in public or high-throughput GraphQL APIs.


