- Home
- Skills
- Apollographql
- Skills
- Graphql Schema
graphql-schema_skill
- Shell
22
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill apollographql/skills --skill graphql-schema- SKILL.md4.3 KB
Overview
This skill guides designers and teams through practical, industry-proven GraphQL schema patterns to build intuitive, secure, and evolvable APIs. It focuses on client-driven design, clear naming and nullability, sensible type modeling, and evolution strategies like deprecation. Use it to make schemas predictable, maintainable, and easier to consume.
How this skill works
The skill inspects schema design decisions and recommends concrete patterns: domain-focused types, interface and union usage, input vs output separation, nullability rules, pagination, and error modeling. It highlights security and ID strategies, enforces list and non-null conventions, and suggests mutation and field patterns to avoid common anti-patterns. The guidance is practical and aimed at preventing breaking changes while improving client ergonomics.
When to use it
- Designing a new GraphQL API or schema from scratch
- Reviewing or refactoring an existing schema for usability or performance
- Deciding on type shapes, nullability, or when to use interfaces vs unions
- Implementing cursor-based pagination, error/result types, or mutation patterns
- Auditing schema surface for security leaks or exposure of implementation details
Best practices
- Design types around client use cases and domain concepts, not database tables
- Be explicit: name clearly, document descriptions, and make nullability intentional
- Use [Type!]! for lists to prefer empty lists over null and avoid null items
- Model mutations as business operations with a single input object and meaningful return payloads
- Prefer enums for fixed value sets, custom scalars for domain types, and Node/ID patterns for refetchability
- Plan for evolution: deprecate before removal and avoid breaking changes
Example use cases
- Creating a new user and associated resources with a single input mutation that returns success/error types
- Converting deeply nested fields into flatter types and explicit connections to improve client performance
- Adding cursor-based pagination to list fields using Connection and Edge patterns
- Replacing ad-hoc string status fields with enums and custom scalars for validation
- Auditing a schema to remove database internals and enforce non-null contracts where appropriate
FAQ
No. Make non-null intentional for fields that truly always have values. Overusing non-null can create breaking changes; prefer explicit nullability where absence is meaningful.
When should I use an interface vs a union?
Use interfaces when types share fields and can be treated polymorphically. Use unions when types are mutually exclusive and do not share a common field set.