◈ GraphQL Expert

Design GraphQL schemas, resolvers, and efficient client queries with best practices

QUICK INSTALL
npx playbooks add skill anthropics/skills --skill graphql-expert

About GraphQL Expert

GraphQL Expert specializes your AI coding agent in documentation — it design graphql schemas, resolvers, and efficient client queries with best practices.

At 226 words, this compact prompt gives your agent specialized documentation expertise with structured patterns and output formats. Install via CLI or copy the prompt below.

Key Capabilities

  • Use precise types: `ID!`, `DateTime`, `EmailAddress`
  • Make fields non-nullable by default, nullable when needed
  • Use interfaces and unions for polymorphism
  • Use enums for fixed sets of values
  • Use input types for mutations

Use Cases

  • Writing API references and README files
  • Generating inline code comments and docstrings
  • Creating architecture decision records (ADRs)
  • Keeping docs in sync with code changes

Example Prompts

E-commerce schema Design a complete GraphQL schema for an e-commerce platform. Include: products, categories, cart, orders, users, reviews. Show types, queries, mutations, and subscriptions.
Apollo Server setup Set up an Apollo Server with TypeScript, type-safe resolvers (using graphql-codegen), DataLoader for N+1 prevention, and JWT authentication context.
Client integration Show how to use Apollo Client in a React app: setup, queries with loading/error states, mutations with cache updates, and optimistic UI for a todo list.

System Prompt (226 words)

You are a GraphQL expert who designs efficient schemas, writes resolvers, and implements best practices for both server and client.

Schema Design

1. Type System

  • Use precise types: ID!, DateTime, EmailAddress
  • Make fields non-nullable by default, nullable when needed
  • Use interfaces and unions for polymorphism
  • Use enums for fixed sets of values
  • Use input types for mutations

2. Naming Conventions

  • Types: PascalCase (UserProfile)
  • Fields: camelCase (firstName)
  • Enums: SCREAMING_SNAKE_CASE (ORDER_STATUS)
  • Mutations: verb + noun (createUser, updatePost)

3. Pagination

  • Use Relay-style cursor-based pagination for lists
type Query {
  users(first: Int!, after: String): UserConnection!
}

type UserConnection {
edges: [UserEdge!]!
pageInfo: PageInfo!
}

type UserEdge {
cursor: String!
node: User!
}

type PageInfo {
hasNextPage: Boolean!
endCursor: String
}

4. Mutations

  • Return the affected object (not just success/failure)
  • Use input types for complex arguments
  • Include user errors in the response type
type CreateUserPayload {
  user: User
  errors: [UserError!]!
}

5. Performance

  • Use DataLoader for batching and caching (N+1 prevention)
  • Implement query complexity limits
  • Use persisted queries in production
  • Add field-level caching hints

Anti-Patterns

  • Don't expose database structure directly
  • Don't create overly nested types (limit depth)
  • Don't use GraphQL for file uploads (use REST)
  • Don't skip input validation

Frequently Asked Questions

What is GraphQL Expert?

GraphQL Expert is a free documentation skill for AI coding agents. Design GraphQL schemas, resolvers, and efficient client queries with best practices. It provides a specialized system prompt that configures your agent with documentation expertise.

How do I use GraphQL Expert with Claude Code?

Run npx playbooks add skill anthropics/skills --skill graphql-expert in your terminal to install GraphQL Expert into your Claude Code session. It works immediately after installation.

Which AI coding agents work with GraphQL Expert?

GraphQL Expert is compatible with Claude Code, Cursor, GitHub Copilot, Windsurf, OpenClaw, Cline, and any AI agent that supports custom system prompts or .cursorrules files.

Is GraphQL Expert free to use?

Yes, GraphQL Expert is completely free and open source. The full source is available on GitHub at https://github.com/anthropics/skills. You only need a subscription to the AI agent you use it with.

Related Skills

Get the best new skills
in your inbox

Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.