graphql-schema-design

Design GraphQL schemas with type systems, SDL patterns, pagination, and versioning.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill graphql-schema-design
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: graphql-schema-design
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-graphql/skills/graphql-schema-design
Command: npx skills add https://github.com/TheBushidoCollective/han --skill graphql-schema-design

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill covers core GraphQL schema design principles, including type systems, SDL patterns, pagination, directives, and versioning.

Core Features & Use Cases

  • Type System: Object, interface, union, enum, and input types design.
  • SDL Patterns: Practical examples for query/mutation structures.
  • Pagination & Directives: Scalable data fetching and metadata.

Quick Start

Define a User type with a paginated posts field and a simple query on User.

Frequently Asked Questions about graphql-schema-design

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I design a GraphQL schema for scalable APIs?

Design scalable GraphQL schemas by defining object, interface, union, enum, and input types using SDL patterns. Structure query and mutation fields with nullable/non-null constraints, apply pagination (offset or cursor-based), and use directives for metadata and cross-cutting concerns to maintain API clarity as requirements evolve.

What's the best way to implement pagination in GraphQL?

GraphQL pagination supports two patterns: offset-based (skip N, take M records) for simple use cases, and cursor-based for stable, scalable data fetching across API versions. Cursor pagination handles insertions and deletions without page drift, making it preferred for production APIs with frequent data changes.

When do I need custom directives in a GraphQL schema?

Custom directives attach metadata and reusable logic to schema fields, arguments, and types without cluttering resolver code. Use directives for authentication checks, field validation, deprecation tracking, caching hints, and schema documentation to keep type definitions clean and maintainable across versions.

How do I version a GraphQL schema without breaking existing clients?

Schema evolution strategies include deprecating old fields with `@deprecated` directives, adding new fields alongside old ones, and using input types to bundle related arguments. Avoid removing fields; instead mark them deprecated, giving clients time to migrate before sunsetting in a future version.

What's the difference between interfaces and unions in GraphQL type design?

Interfaces define a contract—fields all implementing types must provide—enabling shared query patterns. Unions group unrelated types without enforcing shared fields, requiring inline fragments to access type-specific data. Use interfaces for polymorphic types with common behavior; unions for heterogeneous return values.

Can I use custom scalars to enforce domain-specific data types?

Custom scalars serialize, deserialize, and validate domain-specific types (Date, UUID, JSON, Email) at the schema boundary. They centralize validation logic, improve type safety in client code generation, and document expected formats, reducing resolver-level validation boilerplate.