kid-sid/claude-spellbook/graphql
Claude Code and agent skill by kid-sid/claude-spellbook
- community
Checking that the SKILL.md file is still in the repository.
Use when designing a GraphQL schema, implementing resolvers or mutations, solving the N+1 query problem with DataLoader, setting up subscriptions, paginating with Cursor Connections, securing a GraphQL API, or choosing between GraphQL and REST.
Install
npx vskill@latest install kid-sid/claude-spellbook/graphqlSKILL.md
GraphQL
Schema design, resolver patterns, performance, and security for production GraphQL APIs.
When to Activate
- Designing types, queries, mutations, or subscriptions in a GraphQL schema
- Implementing resolvers in Python (Strawberry/Ariadne), TypeScript (Apollo/Pothos), or Go (gqlgen)
- Solving N+1 query problems with DataLoader
- Paginating results with Cursor Connections
- Securing a GraphQL endpoint against introspection, depth attacks, or query abuse
- Choosing between GraphQL and REST for a new API
- Setting up real-time updates with subscriptions
GraphQL vs. REST
| Concern | GraphQL | REST | |
|---|---|---|---|
| Data fetching | Client specifies exact fields | Server defines response shape | |
| Multiple resources | Single request | One request per resource | |
| Versioning | Schema evolves via deprecation | URL or header versioning | |
| Caching | Complex (query-level) | Simple (HTTP cache headers) | |
| File uploads | Non-standard | Native multipart | |
| Best for | Flexible client needs, multiple consumers | Simple CRUD, public APIs, CDN caching |
Use GraphQL when you have multiple clients (web, mobile, third-party) with different data needs. Prefer REST for simple CRUD with aggressive HTTP caching.
Schema Design
Type Conventions
Nullable vs. Non-Null
| Pattern | Schema | When to use | |
|---|---|---|---|
| Always present | field: String! | Required data — fetch fails if missing | |
| Optional | field: String | May legitimately be absent | |
| List always present | items: [Item!]! | List itself and items always exist | |
| List may be absent | items: [Item!] | Null means "not loaded", [] means "empty" |
Prefer non-null (`!`) for fields that are always present. Nullable fields force every client to null-check; use them only when absence is meaningful.
Mutations
Mutation payload types give clients a typed error path without relying on the errors top-level array.
Cursor Connections (Pagination)
Use the Relay Cursor Connection spec for all list fields — it handles forward, backward, and arbitrary pagination consistently.
Resolvers and the N+1 Problem
The Problem
DataLoader (Batch + Cache)
Subscriptions
Security
Query Complexity and Depth Limits
Without limits, a single query can exhaust server resources:
Disable Introspection in Production
Field-Level Authorization
Schema Evolution
| Change | Safe? | Notes | |
|---|---|---|---|
| Add a field | Yes | Existing clients ignore unknown fields | |
| Add a type | Yes | Not exposed until a query uses it | |
| Add a non-null argument | No | Breaks clients not passing the argument | |
| Add an optional argument | Yes | Default value required | |
| Remove or rename a field | No | Deprecate first, remove after migration | |
| Change field type | No | Always breaking |
Red Flags
- Returning raw errors in the `errors` array for business failures — use mutation payload types with a typed
errorsfield; the top-levelerrorsarray is for server errors only. - No DataLoader for nested list resolvers — every list field that loads related data without batching causes N+1 queries; instrument with query logging to catch them.
- Introspection enabled in production — exposes your full schema to attackers; disable it or restrict to authenticated users.
- No depth or complexity limits — a deeply nested query can exhaust CPU and memory; always set limits in validation rules.
- Nullable everything — excessive nullability forces clients to null-check every field; use
!for fields that are always present. - Business logic in resolvers — resolvers become untestable and duplicated; keep resolvers thin and delegate to a service layer.
- Sharing DataLoader instances across requests — DataLoaders cache per-request; a shared loader leaks data between users.
- One mutation per field —
updateUserName,updateUserEmailas separate mutations is a smell; useupdateUser(input: UpdateUserInput!)with partial input.
Checklist
- [ ] All list fields use Cursor Connection pagination — no offset-based
skip/limit - [ ] Mutations return dedicated payload types with a typed
errorsfield - [ ] DataLoader used for every resolver that loads related entities — no N+1 queries
- [ ] Query depth limit set (max 5–7 levels)
- [ ] Query complexity limit set and tuned to realistic usage
- [ ] Introspection disabled in production
- [ ] Field-level authorization applied — not just route-level auth middleware
- [ ] Non-null (
!) used for fields that are always present — nullable only where absence is meaningful - [ ] Deprecated fields annotated with
@deprecated(reason: "...")before removal - [ ] DataLoader instances created per-request — never shared across requests
- [ ] Subscriptions use a pub/sub backend (Redis) — not in-memory for multi-instance deployments
- [ ] Schema linted with
graphql-inspectoror equivalent in CI
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/graphql/skill.md
Popularity
- Repository stars
- 186
- Repository forks
- 15
- 7-day trend score
- 26
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kid-sid/claude-spellbook/graphql)