CursorGraphQLAPI Design

GraphQL Cursor Rules

Cursor rules for GraphQL: schema design, resolver patterns, DataLoader, and security best practices.

.cursorrules
- Use DataLoader for all N+1-prone resolver fields; never query inside resolvers in loops
- Design mutations to return the mutated resource; avoid void mutations
- Use input types for all mutation arguments; never use raw scalars for complex mutations
- Implement cursor-based pagination (Relay spec) over offset pagination
- Depth-limit and complexity-limit all public schemas; add query cost analysis
- Use @deprecated directive before removing fields; document reason and replacement
- Never expose internal errors to clients; use generic messages in production
- Use code-first schema generation to keep types and resolvers in sync

How to use with Cursor

Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.

#graphql#api#dataloader#cursor#coding-rules

Related Rules