GraphQL client patterns for operations, fragments, the codegen client preset, and Apollo Client 4. Load before any edit to a .graphql or .gql file, however small, or for GraphQL questions.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Graphql Patterns?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ku5ic-graphql-patterns)
---
name: graphql-patterns
description: GraphQL client patterns for operations, fragments, the codegen client preset, and Apollo Client 4. Load before any edit to a .graphql or .gql file, however small, or for GraphQL questions.
---
# GraphQL patterns
Default assumption: a TypeScript client on Apollo Client 4.3, typed by GraphQL Code Generator's `typescript-operations`, per the Apollo Client releases on GitHub.
A row applies when the version of its package (`@apollo/client`, `@graphql-codegen/*`, or `graphql`) in the project's `package.json` and lockfile is at least its version. Rules on operations, variables, and fragments hold for every client: Apollo, urql, graphql-request.
## Reference files
Loading this skill isn't enough. Before your next edit, read the file of every row that matches it. The rules live in those files, and this one only points at them.
| Before | Read |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| Writing Apollo Client or codegen code, or raising their versions | [reference/upgrades.md](reference/upgrades.md) |
| Writing, changing, or reviewing GraphQL client code | [reference/anti-patterns.md](reference/anti-patterns.md) |
| Writing an operation, a fragment, a cache policy, a link, a test mock, or `codegen.ts` | [reference/practices.md](reference/practices.md) |
| Configuring or running graphql-eslint, codegen's validation, or TypeScript on GraphQL code | [reference/tooling.md](reference/tooling.md) |