GraphQL Schema
Designs well-structured GraphQL schemas using SDL (Schema Definition Language) with proper type definitions, query and mutation operations, input types with validation, connection-based pagination, union and interface types for polymorphism, custom scalars, error handling patterns, and subscription definitions for real-time updates.
Usage
Describe your data model and the operations clients need to perform. Specify relationships between entities, pagination requirements, and any real-time data needs. The skill generates a complete GraphQL schema with type definitions, resolvers structure guidance, and query examples for common operations.
Examples
- "Design a GraphQL schema for a social media app with users, posts, comments, likes, and follow relationships"
- "Create a schema for a dashboard API with connection-based pagination and complex filtering on all list queries"
- "Build a schema with union types for a notification system that has different notification types"
- "Design a subscription schema for a real-time chat application with typing indicators and message delivery status"
Guidelines
- Use the Relay connection specification (edges, nodes, pageInfo) for all paginated lists
- Define separate Input types for create and update mutations to handle required vs optional fields
- Use custom scalar types (DateTime, URL, Email) for domain-specific validation at the schema level
- Implement a consistent error handling pattern: union types (Result | Error) or an errors field in responses
- Use interfaces for shared fields across types (Node interface with id) and unions for polymorphic returns
- Design mutations to return the modified object plus any related objects that might have changed
- Add field-level descriptions to every type and field for self-documenting, introspectable APIs
- Use DataLoader pattern in resolvers to batch and cache database queries and prevent N+1 query problems