name: design-a-graphql-schema
description: Designs a GraphQL type system with queries, mutations, connections, and safe errors. Use when the user needs a GraphQL schema that exposes a coherent domain model.
domain: api-design
tags: [graphql, schema-design, type-system]
triggers: ["graphql schema design", "design graphql connections", "model graphql mutations"]
Designs a GraphQL type system with queries, mutations, connections, and safe errors
Purpose
Designs a GraphQL type system with queries, mutations, connections, and safe errors.
When to use
Use when the user needs a GraphQL schema that exposes a coherent domain model.
When NOT to use
Do not use this for internal function signatures; use software-engineering instead.
Inputs required
- The consumers and what they need
- The resources and the operations involved
- The versioning, auth and rate-limit policy
Procedure
- Define object, input, enum, and scalar types with explicit nullability.
- Model queries, mutations, and connection-based pagination.
- Define mutation inputs, outputs, and authorization behavior.
- Specify stable error codes through GraphQL extensions.
- Hide internal fields and document the schema version and compatibility policy.
Output contract
A documented contract with endpoints, payloads, error shapes and versioning rules.
Validation checklist
Safety notes
Never change an existing response shape without a version bump and a migration note.
Related skills
design-a-bulk-endpoint
design-a-rest-resource-model
design-a-search-endpoint
1---2name: design-a-graphql-schema3description: Designs a GraphQL type system with queries, mutations, connections, and safe errors. Use when the user needs a GraphQL schema that exposes a coherent domain mod4---5---6name: design-a-graphql-schema7description: Designs a GraphQL type system with queries, mutations, connections, and safe errors. Use when the user needs a GraphQL schema that exposes a coherent domain model.8domain: api-design9tags: [graphql, schema-design, type-system]10triggers: ["graphql schema design", "design graphql connections", "model graphql mutations"]11---1213# Designs a GraphQL type system with queries, mutations, connections, and safe errors1415## Purpose1617Designs a GraphQL type system with queries, mutations, connections, and safe errors.1819## When to use2021Use when the user needs a GraphQL schema that exposes a coherent domain model.2223## When NOT to use2425Do not use this for internal function signatures; use software-engineering instead.2627## Inputs required2829- The consumers and what they need30- The resources and the operations involved31- The versioning, auth and rate-limit policy3233## Procedure34351. Define object, input, enum, and scalar types with explicit nullability.362. Model queries, mutations, and connection-based pagination.373. Define mutation inputs, outputs, and authorization behavior.384. Specify stable error codes through GraphQL extensions.395. Hide internal fields and document the schema version and compatibility policy.4041## Output contract4243A documented contract with endpoints, payloads, error shapes and versioning rules.4445## Validation checklist4647- [ ] Every error has a stable machine-readable code48- [ ] Pagination, filtering and idempotency are defined49- [ ] The contract is versioned and backward compatible5051## Safety notes5253Never change an existing response shape without a version bump and a migration note.5455## Related skills5657- `design-a-bulk-endpoint`58- `design-a-rest-resource-model`59- `design-a-search-endpoint`