Standards for designing and implementing GraphQL APIs.
1. Schema Design
Business Logic Isolation: Do not write business logic inside resolvers. Resolvers should only extract arguments and pass them to dedicated service/domain layer functions.
Nullability: Be mindful of non-null (!) fields. Only mark fields as non-null if you are absolutely certain they will never be missing, as a single null in a non-null field will bubble up and destroy the entire parent object.
Custom Scalars: Use custom scalars (e.g., DateTime, Email) to enforce type constraints at the schema level instead of raw String.
2. Mutations
Input Types: Use a single, required input object argument for mutations instead of passing many individual arguments.
Payload Types: Return a specific payload type (e.g., UpdateUserPayload) that includes the mutated object and any potential operation-specific errors, rather than just returning the object.
3. Performance (N+1 Problem)
DataLoader: ALWAYS use Facebook's dataloader pattern (or equivalent) to batch and cache database requests for nested relationships. Never loop and await queries inside child resolvers.
Query Complexity: Implement query complexity limits or depth limits on your GraphQL server to prevent malicious or accidental resource exhaustion.
4. Error Handling
Use the standard errors array for unexpected exceptions.
For business logic errors (e.g., "Email already taken"), model them as Union types in your schema (e.g., union CreateUserResult = User | EmailAlreadyTakenError) so clients can handle them gracefully.
1---2name: neverinfamous-memory-journal-mcp-graphql3description: GraphQL Best Practices4---56# GraphQL Best Practices78Standards for designing and implementing GraphQL APIs.910## 1. Schema Design1112- **Business Logic Isolation**: Do not write business logic inside resolvers. Resolvers should only extract arguments and pass them to dedicated service/domain layer functions.13- **Nullability**: Be mindful of non-null (`!`) fields. Only mark fields as non-null if you are absolutely certain they will never be missing, as a single null in a non-null field will bubble up and destroy the entire parent object.14- **Custom Scalars**: Use custom scalars (e.g., `DateTime`, `Email`) to enforce type constraints at the schema level instead of raw `String`.1516## 2. Mutations1718- **Input Types**: Use a single, required `input` object argument for mutations instead of passing many individual arguments.19- **Payload Types**: Return a specific payload type (e.g., `UpdateUserPayload`) that includes the mutated object and any potential operation-specific errors, rather than just returning the object.2021## 3. Performance (N+1 Problem)2223- **DataLoader**: ALWAYS use Facebook's `dataloader` pattern (or equivalent) to batch and cache database requests for nested relationships. Never loop and await queries inside child resolvers.24- **Query Complexity**: Implement query complexity limits or depth limits on your GraphQL server to prevent malicious or accidental resource exhaustion.2526## 4. Error Handling2728- Use the standard `errors` array for unexpected exceptions.29- For business logic errors (e.g., "Email already taken"), model them as Union types in your schema (e.g., `union CreateUserResult = User | EmailAlreadyTakenError`) so clients can handle them gracefully.3031---32> Source: [neverinfamous/memory-journal-mcp](https://github.com/neverinfamous/memory-journal-mcp) — distributed by [TomeVault](https://tomevault.io).33<!-- tomevault:4.0:skill_md:2026-06-15 -->
Run npx skillmds@latest add tomevault-io/neverinfamous-memory-journal-mcp-graphql in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
GraphQL Best Practices It is listed under AI & ML on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Independent scanners report: SkillSpector: PASS, Skill Scanner: PASS. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
tomevault-io (@tomevault-io) published this skill. Their other Agent Skills are listed on their SkillMD profile.