New to Claude Skills? Learn how to install them →

jeffallan on GitHub

GraphQL Architect

Free

Design and optimize your GraphQL schemas effectively.

Get this skill

Free · Opens the source repo

What GraphQL Architect does

GraphQL Architect is a specialized skill designed for developers and architects focused on creating robust GraphQL schemas and implementing distributed architectures using Apollo Federation. This skill guides users through the entire process of domain modeling, schema design, validation, resolver implementation, security measures, and performance optimization. With a structured approach, it ensures that best practices are followed throughout the development lifecycle.

The core workflow begins with domain modeling, where business domains are mapped to the GraphQL type system. Users are then guided in designing schemas that incorporate types, interfaces, unions, and federation directives. Schema validation is crucial, and the skill provides checks to ensure that all @key entities are correctly resolved. If issues arise, it offers troubleshooting steps to identify and rectify problems with entity directives or type definitions.

Resolvers are implemented using DataLoader patterns to prevent N+1 query issues, ensuring efficient data fetching. Security is also a key focus, with recommendations for setting query complexity limits and implementing field-level authorization. Users can validate complexity thresholds before deployment to avoid performance bottlenecks. Finally, the skill emphasizes optimization techniques such as caching and monitoring to enhance the overall performance of the GraphQL service.

This skill is ideal for developers and architects who are looking to build scalable and efficient GraphQL APIs, especially in environments where Apollo Federation is utilized. It provides a comprehensive reference guide that covers various aspects of GraphQL development, making it a valuable resource for both new and experienced users.

When to use it

Use this skill when developing GraphQL APIs, particularly when implementing Apollo Federation or real-time subscriptions.

When not to use it

This skill may not be suitable for projects that do not utilize GraphQL or require a simpler API structure without federation.

What you can build with it

Building a Federated GraphQL API

Utilize GraphQL Architect to design a federated schema that integrates multiple subgraphs seamlessly.

Implementing Real-Time Subscriptions

Use the skill to set up GraphQL subscriptions for real-time updates in your application.

Optimizing Query Performance

Apply the performance optimization techniques provided by the skill to enhance the efficiency of your GraphQL queries.

How to install GraphQL Architect

View source

1. Install with the skills CLI

npx skills add jeffallan/claude-skills/graphql-architect --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by jeffallan

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

  1. Domain Modeling - Map business domains to GraphQL type system
  2. Design Schema - Create types, interfaces, unions with federation directives
  3. Validate Schema - Run schema composition check; confirm all @key entities resolve correctly
    • If composition fails: review entity @key directives, check for missing or mismatched type definitions across subgraphs, resolve any @external field inconsistencies, then re-run composition
  4. Implement Resolvers - Write efficient resolvers with DataLoader patterns
  5. 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
  6. Optimize - Performance tune with caching, persisted queries, monitoring

Reference Guide

Load detailed guidance based on context:

TopicReferenceLoad When
Schema Designreferences/schema-design.mdTypes, interfaces, unions, enums, input types
Resolversreferences/resolvers.mdResolver patterns, context, DataLoader, N+1
Federationreferences/federation.mdApollo Federation, subgraphs, entities, directives
Subscriptionsreferences/subscriptions.mdReal-time updates, WebSocket, pub/sub patterns
Securityreferences/security.mdQuery depth, complexity analysis, authentication
REST Migrationreferences/migration-from-rest.mdMigrating 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:

  1. Schema definition (SDL with types and directives)
  2. Resolver implementation (with DataLoader patterns)
  3. Query/mutation/subscription examples
  4. 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

Documentation

Frequently asked questions about GraphQL Architect

Similar skills