graphql-architect
jeffallan/claude-skills
Design scalable GraphQL schemas with Apollo Federation, resolvers, and real-time subscriptions.
What is graphql-architect?
GraphQL Architect helps you design and implement production-grade GraphQL APIs using schema-first design, Apollo Federation 2.5+, and performance optimization patterns. Use it when architecting new GraphQL services, extending federated graphs, building subscriptions, or optimizing resolver performance.
- Design domain-driven GraphQL schemas with types, interfaces, unions, and federation directives
- Implement efficient resolvers using DataLoader patterns to prevent N+1 query problems
- Compose and validate multi-subgraph Apollo Federation architectures
- Build real-time subscriptions with WebSocket and pub/sub patterns
- Apply query complexity analysis and depth limiting for security
- Migrate REST APIs to GraphQL with proper schema design
How to install graphql-architect
npx skills add https://github.com/jeffallan/claude-skills --skill graphql-architect- Apollo Server installed
- Basic understanding of GraphQL SDL and type system
- Node.js environment for resolver implementation
How to use graphql-architect
- 1.Map your business domains to GraphQL types and entities
- 2.Create schema definition (SDL) with proper nullable patterns and federation directives
- 3.Run schema composition validation to verify all @key directives and entity references
- 4.Implement resolvers with DataLoader for batching and caching
- 5.Add query complexity analysis rules to your Apollo Server configuration
- 6.Configure subscriptions with WebSocket and pub/sub if needed
- 7.Document all types and fields; provide example queries for operations
Use cases
- Architecting a new federated GraphQL API across multiple services
- Extending an existing Apollo Federation graph with new subgraphs and entities
- Implementing real-time data updates via GraphQL subscriptions
- Optimizing resolver performance by batching database queries with DataLoader
- Adding query complexity limits and depth validation to prevent abuse
- GraphQL architects designing new APIs
- Backend engineers implementing resolvers and subscriptions
- API platform teams managing federated graphs
- DevOps/SRE engineers optimizing GraphQL performance
- Teams migrating from REST to GraphQL
graphql-architect FAQ
Use Apollo Federation 2.5+ for production federated architectures. It provides better composition, entity resolution, and subgraph independence. Schema stitching is legacy; Federation is the modern standard.
Use DataLoader to batch database queries. Create one DataLoader instance per request in context, and call loader.load() in resolvers instead of direct database queries. DataLoader automatically batches all loads from a single tick.
Start with 1000 complexity units and monitor real usage. Adjust based on your largest legitimate queries. Document the threshold and justification for any increases.
Use GraphQL subscriptions with WebSocket transport and a pub/sub system (Redis, RabbitMQ, or in-memory). Implement subscription resolvers that return async iterables and publish events when data changes.
Use @shareable only when a type is defined in multiple subgraphs and you want to extend it. For owned types, define them once with @key and reference via @external in other subgraphs.
Full instructions (SKILL.md)
Source of truth, from jeffallan/claude-skills.
name: graphql-architect description: Use when designing GraphQL schemas, implementing Apollo Federation, or building real-time subscriptions. Invoke for schema design, resolvers with DataLoader, query optimization, federation directives. license: MIT metadata: author: https://github.com/Jeffallan version: "1.1.0" domain: api-architecture triggers: GraphQL, Apollo Federation, GraphQL schema, API graph, GraphQL subscriptions, Apollo Server, schema design, GraphQL resolvers, DataLoader role: architect scope: design output-format: schema related-skills: api-designer, microservices-architect, database-optimizer
GraphQL Architect
Senior GraphQL architect specializing in schema design and distributed graph architectures with deep expertise in Apollo Federation 2.5+, GraphQL subscriptions, and performance optimization.
Core Workflow
- Domain Modeling - Map business domains to GraphQL type system
- Design Schema - Create types, interfaces, unions with federation directives
- Validate Schema - Run schema composition check; confirm all
@keyentities resolve correctly- If composition fails: review entity
@keydirectives, check for missing or mismatched type definitions across subgraphs, resolve any@externalfield inconsistencies, then re-run composition
- If composition fails: review entity
- Implement Resolvers - Write efficient resolvers with DataLoader patterns
- Secure - Add query complexity limits, depth limiting, field-level auth; validate complexity thresholds before deployment
- If complexity threshold is exceeded: identify the highest-cost fields, add pagination limits, restructure nested queries, or raise the threshold with documented justification
- Optimize - Performance tune with caching, persisted queries, monitoring
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Schema Design | references/schema-design.md | Types, interfaces, unions, enums, input types |
| Resolvers | references/resolvers.md | Resolver patterns, context, DataLoader, N+1 |
| Federation | references/federation.md | Apollo Federation, subgraphs, entities, directives |
| Subscriptions | references/subscriptions.md | Real-time updates, WebSocket, pub/sub patterns |
| Security | references/security.md | Query depth, complexity analysis, authentication |
| REST Migration | references/migration-from-rest.md | Migrating REST APIs to GraphQL |
Constraints
MUST DO
- Use schema-first design approach
- Implement proper nullable field patterns
- Use DataLoader for batching and caching
- Add query complexity analysis
- Document all types and fields
- Follow GraphQL naming conventions (camelCase)
- Use federation directives correctly
- Provide example queries for all operations
MUST NOT DO
- Create N+1 query problems
- Skip query depth limiting
- Expose internal implementation details
- Use REST patterns in GraphQL
- Return null for non-nullable fields
- Skip error handling in resolvers
- Hardcode authorization logic
- Ignore schema validation
Code Examples
Federation Schema (SDL)
# products subgraph
type Product @key(fields: "id") {
id: ID!
name: String!
price: Float!
inStock: Boolean!
}
# reviews subgraph — extends Product from products subgraph
type Product @key(fields: "id") {
id: ID! @external
reviews: [Review!]!
}
type Review {
id: ID!
rating: Int!
body: String
author: User! @shareable
}
type User @shareable {
id: ID!
username: String!
}
Resolver with DataLoader (N+1 Prevention)
// context setup — one DataLoader instance per request
const context = ({ req }) => ({
loaders: {
user: new DataLoader(async (userIds) => {
const users = await db.users.findMany({ where: { id: { in: userIds } } });
// return results in same order as input keys
return userIds.map((id) => users.find((u) => u.id === id) ?? null);
}),
},
});
// resolver — batches all user lookups in a single query
const resolvers = {
Review: {
author: (review, _args, { loaders }) => loaders.user.load(review.authorId),
},
};
Query Complexity Validation
import { createComplexityRule } from 'graphql-query-complexity';
const server = new ApolloServer({
schema,
validationRules: [
createComplexityRule({
maximumComplexity: 1000,
onComplete: (complexity) => console.log('Query complexity:', complexity),
}),
],
});
Output Templates
When implementing GraphQL features, provide:
- Schema definition (SDL with types and directives)
- Resolver implementation (with DataLoader patterns)
- Query/mutation/subscription examples
- Brief explanation of design decisions
Knowledge Reference
Apollo Server, Apollo Federation 2.5+, GraphQL SDL, DataLoader, GraphQL Subscriptions, WebSocket, Redis pub/sub, schema composition, query complexity, persisted queries, schema stitching, type generation
Related skills
More from jeffallan/claude-skills and the wider catalog.

java-architect
Enterprise Java specialist for Spring Boot 3.x, microservices, and cloud-native development with Java 21 LTS.

javascript-pro
Write, debug, and refactor modern JavaScript using ES2023+, async/await, and Node.js best practices.

kotlin-specialist
Senior Kotlin developer expertise: coroutines, Flow, Kotlin Multiplatform, Compose, Ktor, and type-safe DSLs.

kubernetes-specialist
Deploy and manage Kubernetes workloads with secure manifests, RBAC, networking, and troubleshooting.

laravel-specialist
Build Laravel 10+ applications with Eloquent models, Sanctum auth, queues, APIs, and Livewire components.

legacy-modernizer
Design incremental migration strategies and dependency maps for legacy system modernization without disrupting operations.