Skills
Skill 12 of 15
Guide for designing and changing GraphQL schemas following industry best practices.
2 minutes · 433 words · 18 sections
Install
npx skills add apollographql/skills --skill graphql-schemanpx skills add apollographql/skills/plugin marketplace add apollographql/skillsThe first command installs just this skill, by the name in its SKILL.md; the second installs the whole repository.
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.
"""
A user in the system.
"""
type User {
id: ID!
email: String!
name: String
posts(first: Int = 10, after: String): PostConnection!
createdAt: DateTime!
}| 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.
# 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 Node {
id: ID!
}
type User implements Node {
id: ID!
email: String!
}
type Post implements Node {
id: ID!
title: String!
}union SearchResult = User | Post | Comment
type Query {
search(query: String!): [SearchResult!]!
}Detailed documentation for specific topics:
mutation(input: InputType!)Node interface for refetchabilityQuery.users or Post.comments: return a connection and give first a default page sizeID type for identifiers, not String or IntGuide 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 verbatim description from this skill’s front matter — the string an agent matches on to decide whether to load it.
Bash(npm:*)Bash(npx:*)ReadWriteEditGlobGrepskills/graphql-schema/SKILL.mdmain, last pushed 6 November 2026.SKILL.md, not by matching a directory convention. One layout observed: skills/*/SKILL.md.h1 and no skipped levels:.claude-plugin/marketplace.json by Apollo GraphQL, declaring 1 plugin. It is read for editorial metadata only — never as the skill index, which is always the repository tree./apollographql/skills.md, and each skill at its own .md URL.5 files · 37 KB
Everything this skill ships beside its prose. All of it is set here, as subchapters of skill 12.
Documentation the agent loads on demand, rather than up front.