Agent Native

graphql-schema

This skill guides agents through designing and modifying GraphQL schemas following industry best practices.

by Apollo GraphQLOfficial publisher

Identity proven by a skills index on apollographql.com

Agents
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
License
MIT (permissive)
Pin
5f02fcfpinned Oct 9, 2026
Context cost
about 1,100 tokenswhen the skill loads
GitHub stars
117on apollographql/skills
Scripts
None found

What it does

“Guide for designing and changing GraphQL schemas following industry best practices. Use this skill whenever you create or edit GraphQL SDL, such as a `schema.graphql` file or `typeDefs`, including when: (1) designing a new GraphQL schema or API, (2) adding or changing types, fields, arguments, mutations, or descriptions in an existing schema, (3) reviewing existing schema for improvements, (4) deciding on type structures or nullability, (5) implementing pagination or error patterns, (6) ensuring security in schema design.”
The author's description, from SKILL.md

Generated summary from the skill's own text

This skill guides agents through designing and modifying GraphQL schemas following industry best practices. It covers type design, field organization, nullability patterns, pagination, error handling, and security considerations for any GraphQL implementation. The skill includes reference documentation on naming conventions, custom scalars, connection patterns, and backwards compatibility strategies.

When to use it

  • Creating a new GraphQL schema or API from scratch
  • Adding or modifying types, fields, mutations, or arguments in existing schemas
  • Reviewing schema design for improvements and best practices
  • Designing pagination, error patterns, or security considerations

When not to

  • Working with non-GraphQL APIs or database schemas
  • Implementing resolver logic or server-side business logic
  • Configuring GraphQL servers or deployment infrastructure

Install

These commands install from the publisher's repository and need no account.

skills CLI

npx skills add apollographql/skills --skill graphql-schema

Installs from the repository's default branch, which may have changed since the commit we checked.

GitHub CLI 2.90 or later

gh skill install apollographql/skills graphql-schema@5f02fcfcebec678e2e55777b639e32346622a963

Installs the commit we checked (5f02fcf).

Copy by hand

Download the folder at 5f02fcf and put it in .claude/skills/graphql-schema for Claude Code and in .agents/skills/graphql-schema for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.

Skill folder on GitHub at 5f02fcf

Claude Code plugin

/plugin install apollo-skills@claude-plugins-official

The publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.

Copy for your agent

A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.

Prompt

Install the agent skill "graphql-schema" by Apollo GraphQL.

Source, pinned to commit 5f02fcfcebec678e2e55777b639e32346622a963:
https://github.com/apollographql/skills/tree/5f02fcfcebec678e2e55777b639e32346622a963/skills/graphql-schema

1. Download that folder at exactly this commit. Do not use the default branch.
2. Copy every file unchanged, keeping the folder structure, into .claude/skills/graphql-schema/ for Claude Code and .agents/skills/graphql-schema/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist.
3. Do not edit the files, and do not run any script in the folder unless I ask you to.
4. When you are done, list the files you copied and where you put them.

Listing and checks: https://www.agentnative.dev/skills/apollo-graphql/graphql-schema

SKILL.md at the pin

---
name: graphql-schema
description: >
  Guide for designing and changing GraphQL schemas following industry best practices. Use this skill
  whenever you create or edit GraphQL SDL, such as a `schema.graphql` file or `typeDefs`, including when:
  (1) designing a new GraphQL schema or API,
  (2) adding or changing types, fields, arguments, mutations, or descriptions in an existing schema,
  (3) reviewing existing schema for improvements,
  (4) deciding on type structures or nullability,
  (5) implementing pagination or error patterns,
  (6) ensuring security in schema design.
license: MIT
compatibility: Any GraphQL implementation (Apollo Server, graphql-js, Yoga, etc.)
metadata:
  author: apollographql
  version: "1.0.2"
allowed-tools: Bash(npm:*) Bash(npx:*) Read Write Edit Glob Grep
---

# GraphQL Schema Design Guide

This guide covers best practices for designing GraphQL schemas that are intuitive, performant, and maintainable. Schema design is primarily a server-side concern that directly impacts API usability.

## Schema Design Principles

### 1. Design for Client Needs

- Think about what queries clients will write
- Organize types around use cases, not database tables
- Expose capabilities, not implementation details

### 2. Be Explicit

- Use clear, descriptive names
- Make nullability intentional
- Document with descriptions

### 3. Design for Evolution

- Plan for backwards compatibility
- Use deprecation before removal
- Avoid breaking changes
- Give every new argument or input field a default value, or make it nullable. Existing clients don't send it, so a required field without a default makes their requests fail validation.

## Quick Reference

### Type Definition Syntax

```graphql
"""
A user in the system.
"""
type User {
  id: ID!
  email: String!
  name: String
  posts(first: Int = 10, after: String): PostConnection!
  createdAt: DateTime!
}
```

### Nullability Rules

| Pattern | Meaning |
|---------|---------|
| String | Nullable - may be null |
| String! | Non-null - always has value |
| [String] | Nullable list, nullable items |
| [String!] | Nullable list, non-null items |
| [String]! | Non-null list, nullable items |
| [String!]! | Non-null list, non-null items |

**Best Practice:** Use **[Type!]!** for lists - empty list over null, no null items.

### Input vs Output Types

```graphql
# Output type - what clients receive
type User {
  id: ID!
  email: String!
  createdAt: DateTime!
}

# Input type - what clients send
input CreateUserInput {
  email: String!
  name: String
}

# Mutation using input type
type Mutation {
  createUser(input: CreateUserInput!): User!
}
```

### Interface Pattern

```graphql
interface Node {
  id: ID!
}

type User implements Node {
  id: ID!
  email: String!
}

type Post implements Node {
  id: ID!
  title: String!
}
```

### Union Pattern

```graphql
union SearchResult = User | Post | Comment

type Query {
  search(query: String!): [SearchResult!]!
}
```

## Reference Files

Detailed documentation for specific topics:

- [Types](references/types.md) - Type design patterns, interfaces, unions, and custom scalars
- [Naming](references/naming.md) - Naming conventions for types, fields, and arguments
- [Pagination](references/pagination.md) - Connection pattern and cursor-based pagination
- [Errors](references/errors.md) - Error modeling and result types
- [Security](references/security.md) - Security best practices for schema design

## Key Rules

### Type Design

- Define types based on domain concepts, not data storage
- Use interfaces for shared fields across types
- Use unions for mutually exclusive types
- Keep types focused (single responsibility)
- Avoid deep nesting - flatten when possible

### Field Design

- Fields should be named from client's perspective
- Return the most specific type possible
- Make expensive fields explicit (consider arguments)
- Use arguments for filtering, sorting, pagination

### Mutation Design

- Use single input argument pattern: `mutation(input: InputType!)`
- Return affected objects in mutation responses
- Model mutations around business operations, not CRUD
- Consider returning a union of success/error types

### ID Strategy

- Use globally unique IDs when possible
- Implement `Node` interface for refetchability
- Base64-encode compound IDs if needed

## Ground Rules

- ALWAYS add descriptions to types and fields
- ALWAYS use non-null (**!**) for fields that cannot be null
- ALWAYS use **[Type!]!** pattern for lists
- ALWAYS paginate lists that can grow without limit, such as `Query.users` or `Post.comments`: return a connection and give `first` a default page size
- NEVER expose database internals in schema
- NEVER break backwards compatibility without deprecation
- NEVER add a required argument or input field without a default value
- PREFER dedicated input types over many arguments
- PREFER enums over arbitrary strings for fixed values
- USE `ID` type for identifiers, not `String` or `Int`
- USE custom scalars for domain-specific values (DateTime, Email, URL)

From apollographql/skills at 5f02fcf, shown as plain text under its license: MIT (permissive). The license text is in skills/graphql-schema/SKILL.md.

View SKILL.md on GitHub at 5f02fcf

Files

6 files, 43 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.

Skill folder on GitHub at 5f02fcf

More from Apollo GraphQL

  • apollo-client

    This skill guides building React applications with Apollo Client 4.x for managing GraphQL queries, mutations, and state.

    Claude Code, Codex, Cursor +4 · about 1.7K tokens · pinned 7 days ago

  • apollo-connectors

    This skill helps integrate REST APIs into GraphQL supergraphs using Apollo Connectors with @source and @connect directives.

    Claude Code, Codex, Cursor +4 · about 1.6K tokens · pinned 7 days ago

  • apollo-federation

    This skill guides agents in authoring Apollo Federation subgraph schemas using Federation 2.x directives like @key, @shareable, @external, and @requires.

    Claude Code, Codex, Cursor +4 · about 830 tokens · pinned 7 days ago

  • apollo-ios

    This skill guides building GraphQL-powered Apple apps with Apollo iOS, a strongly-typed Swift client.

    Contains scripts

    Claude Code · about 1.8K tokens · pinned 7 days ago

  • apollo-kotlin

    This skill guides building GraphQL applications with Apollo Kotlin, a strongly typed client library for Android, JVM, and Kotlin Multiplatform projects.

    Contains scripts

    Claude Code, Codex, Cursor +3 · about 370 tokens · pinned 7 days ago

  • apollo-router

    Generates version-correct Apollo Router configuration (v1.x or v2.x) for federated GraphQL supergraphs.

    Claude Code, Codex, Cursor +4 · about 5.1K tokens · pinned 7 days ago

All Backend and APIs skills
  • shopify-admin

    This skill is deprecated and has been replaced by the shopify skill.

    by ShopifyOfficial publisher

    Claude Code, Codex, Cursor +4 · about 66 tokens · pinned 7 days ago

  • shopify-customer

    This skill is deprecated and no longer maintained.

    by ShopifyOfficial publisher

    Claude Code, Codex, Cursor +4 · about 69 tokens · pinned 7 days ago

  • commerce-app-api-mesh

    This skill scaffolds or updates an Adobe API Mesh configuration to extend a Commerce GraphQL schema with new fields resolved by runtime actions or external…

    by Adobe, Inc.Official publisher

    Claude Code, Codex, Cursor +4 · about 2.1K tokens · pinned 7 days ago

  • apollo-server

    Guides building GraphQL servers using Apollo Server 5.x with resolvers, schemas, and integrations into Express, Fastify, or standalone deployments.

    by Apollo GraphQLOfficial publisher

    Claude Code, Codex, Cursor +4 · about 1.6K tokens · pinned 7 days ago

  • build-zoom-rest-api-app

    This skill provides comprehensive reference documentation and examples for building server-side integrations with the Zoom REST API, covering 600+ endpoints…

    by ZoomOfficial publisher

    Claude Code, Codex, Cursor +3 · about 6.7K tokens · pinned 7 days ago

  • api-and-interface-design

    This skill guides design of stable, well-documented APIs and interfaces for REST endpoints, GraphQL schemas, module boundaries, and component contracts.

    by addyosmaniCommunity

    Claude Code, Codex, Cursor +4 · about 3.6K tokens · pinned 7 days ago

The skills listed here are third-party software, collected from public GitHub repositories as a catalog of recent skills and provided as is. Agent Native does not write or control them and is not responsible for any harm, loss or damage caused by installing or using them. Labels and checks describe what we saw at one commit and are not a guarantee. Read a skill's files before you run it. Terms of use