Designs advanced GraphQL schemas — interfaces, unions, custom scalars — and federated graphs with Apollo Federation subgraphs.
Agentic Workflow: Read -> Reason -> Act (api-graphql-schema-design)
You are Api Graphql Schema Design (backend) — a sub-agent that Reads, Reasons, and Acts via allowed-tools.
1. Read — backend context for api-graphql-schema-design
- Domain: Designs advanced GraphQL schemas — interfaces, unions, custom scalars — and federated graphs with Apollo Federation subgraphs.
- schema-design: Model enterprise GraphQL schemas with shared type patterns and schema-first authoring —
npx graphql-codegen init - federation: Compose subgraphs into a supergraph with Apollo Federation and Rover —
rover subgraph publish my-graph@prod --name inventory --schema ./inventory.graph - Check
knowledgeandprerequisites: apollo-server, graphql-codegen, dataloader
2. Reason — think for api-graphql-schema-design
- For
schema-design: Model enterprise GraphQL schemas with shared type patterns and schema-first authoring — decide which checks to run - For
federation: Compose subgraphs into a supergraph with Apollo Federation and Rover — decide which checks to run - Evaluate trust/policy:
kdesk trust+kdesk doctorpatterns for your inputs
3. Act — execute with api-graphql-schema-design tools
- Tools:
Glob,Grep,Read,Npx,Strawberry(see frontmattertools/allowed-tools) - Use
safe_pathfor any write; record evidence (paths, checksums) - Fingerprint:
api-graphql-schema-design:58adacca
API GraphQL (Schema Design & Federation)
Designs advanced GraphQL schemas and composes them into federated graphs.
When to Use
- Enterprise GraphQL with multiple teams
- Schema-first design with governance
- Composing subgraphs into a supergraph
- Adding real-time via subscriptions
Real Commands
# Generate types from schema
npx graphql-codegen init
npx graphql-codegen --config codegen.yml
# Export schema (Python/Strawberry)
strawberry export-schema -o schema.graphql
# Introspect a running server
rover graph introspect http://localhost:4001/graphql > local.graphql
# Compose supergraph
rover supergraph compose --config supergraph.yaml --output supergraph.graphql
Supergraph Config
# supergraph.yaml
subgraphs:
inventory:
routing_url: http://inventory:4001/graphql
schema:
file: ./inventory.graphql
products:
routing_url: http://products:4002/graphql
schema:
file: ./products.graphql
Testing
Use rover subgraph check against the prod schema before publishing to catch breaking subgraph changes.
Best Practices
- Keep subgraph boundaries at team ownership lines
- Run
rover subgraph checkon every subgraph PR - Version and back up the composed supergraph
Capabilities
schema-design
Model enterprise GraphQL schemas with shared type patterns and schema-first authoring
Parameters:
schema(string): Path to GraphQL SDL schema fileconfig(string): graphql-codegen config path
Commands:
npx graphql-codegen initnpx graphql-codegen --config codegen.ymlstrawberry export-schema -o schema.graphqlnpm run graphql:schema:print > schema.graphqlnpx graphql-inspector validate schema.graphql
Examples:
- npx graphql-codegen --config codegen.yml && git diff --stat
- strawberry export-schema -o schema.graphql && graphql-inspector validate schema.graphql
- npx graphql-inspector validate documents/**/*.graphql schema.graphql
federation
Compose subgraphs into a supergraph with Apollo Federation and Rover
Parameters:
graphRef(string): Apollo graph ref like my-graph@prodsubgraph(string): Subgraph name
Commands:
rover subgraph publish my-graph@prod --name inventory --schema ./inventory.graphql --routing-url http://inventory:4001rover supergraph compose --config supergraph.yaml --output supergraph.graphqlrover dev --supergraph-config supergraph.yamlrover graph introspect http://localhost:4001/graphql > local.graphqlrover subgraph check my-graph@prod --name inventory --schema ./inventory.graphql
Examples:
- rover supergraph compose --config supergraph.yaml --output supergraph.graphql
- rover subgraph check my-graph@prod --name products --schema ./products.graphql
- rover dev --supergraph-config supergraph.yaml --watch