/apollo-skills:apollo-routerfrom apollo-skills
Generates version-correct YAML configuration for Apollo Router (v1.x and v2.x) for federated GraphQL supergraphs. Covers routing, CORS, custom plugins (Rhai/coprocessors), telemetry, security (JWT, authorization directives, persisted queries), demand control, and CI/CD validation.
Ships in apollo-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Apollo Router is a high-performance graph router written in Rust for running Apollo Federation 2 supergraphs. It sits in front of your subgraphs and handles query planning, execution, and response composition.
This skill generates version-correct configuration. Router v1 and v2 have incompatible config schemas in several critical sections (CORS, JWT auth, connectors). Always determine the target version before generating any config.
Ask the user before generating any config:
Which Apollo Router version are you targeting?
[1] Router v2.x (recommended — current LTS, required for Connectors)
[2] Router v1.x (legacy — end-of-support announced, security patches only)
[3] Not sure — help me decide
If the user picks [3], display:
Quick guide:
• Pick v2 if: you're starting fresh, using Apollo Connectors for REST APIs,
or want backpressure-based overload protection.
• Pick v1 if: you have an existing deployment and haven't migrated yet.
Note: Apollo ended active support for v1.x. The v2.10 LTS (Dec 2025)
is the current baseline. Migration is strongly recommended.
Tip: If you have an existing router.yaml, you can auto-migrate it:
router config upgrade router.yaml
Store the selection as ROUTER_VERSION=v1|v2 to gate all subsequent template generation.
For v2, also ask for the exact version (router --version) when the config includes limits. The limits shape changed in v2.15.0, so store it as ROUTER_MINOR and pick the shape from it (see Ground Rules).
Ask: Production or Development?
Load the appropriate base template from:
templates/{version}/production.yamltemplates/{version}/development.yamlAsk which features to include:
@authenticated / @requiresScopes / @policy directives — requires GraphOS + request claims)connectors, early v2 preview key was preview_connectors)@cost/@listSize directives — measure or enforce modes)For each selected feature, collect required values.
templates/{version}/sections/ for auth, cors, headers, limits, telemetry, and traffic-shaping.templates/v2/sections/connectors.yaml as the source.templates/{version}/production.yaml or templates/{version}/development.yaml) or from references.ROUTER_VERSION=v2."*" for production)issuer, v2 uses plural issuers arrayField- and type-level access control enforced in the router, via the
@authenticated,@requiresScopes, and@policydirectives applied in subgraph schemas. This is the layer that the globalauthorization.require_authenticationgate cannot express. It is a GraphOS feature (Enterprise; Developer/Standard plans require Router v2.6.0+) and requires a router connected to GraphOS. Directives are enabled by default — config only turns them off.
Confirm prerequisites before recommending these:
apollo::authentication::jwt_claims context key. Populate it via JWT authentication (configure that feature too) or a coprocessor that injects claims.@policy additionally requires a Supergraph plugin (Rhai script or coprocessor) to evaluate each policy — the router extracts required policies into apollo::authorization::required_policies but does not decide them itself.Ask:
@authenticated = any valid identity; @requiresScopes = specific scopes; @policy = custom logic.)The directives live in the subgraph schemas, not in router.yaml. The router config only enables/disables the feature and (for @policy) wires the evaluating plugin. See references/configuration.md → Authorization.
Not the same as APQ. APQ (
apq) is a runtime bandwidth optimization that caches any operation a client sends — it provides no security. Safelisting uses a GraphOS-managed Persisted Query List (PQL) that clients register at build time; the router then rejects operations not on the list. This is the "persisted query safelisting" security control. It is a GraphOS feature requiring a router connected to GraphOS (APOLLO_KEY+APOLLO_GRAPH_REF).
Pick a security level (increasing restrictiveness):
| Level | Config | Behavior |
|---|---|---|
| Audit (recommended first) | persisted_queries.log_unknown: true | Logs unregistered operations; rejects nothing. Use to confirm all clients are registered before enforcing. |
| Safelist | safelist.enabled: true | Rejects operations not in the PQL. IDs and full strings both accepted if registered. |
| Safelist, IDs only | safelist.enabled: true + require_id: true | Rejects unregistered operations and any freeform operation string, even if the string is registered. |
Then gather:
local_manifests for offline licenses).rover persisted-queries publish in their CI/CD)? If not, start in audit mode.safelist, APQ must be disabled (apq.enabled: false) — they are mutually exclusive.Config key history: GA persisted_queries since v1.32.0 (was preview_persisted_queries in v1.25.0–v1.32.0); GA in all v2. See references/configuration.md → Persisted Query Safelisting.
connectors.sources.<subgraph>.<source>)$config values for connector runtime configurationpreview_connectors to connectorsPresent the tuning guidance:
Operation depth limit controls how deeply nested a query can be.
Router default: 100 (permissive — allows very deep queries)
Recommended starting point: 50
Lower values (15–25) are more secure but will reject legitimate queries
in schemas with deep entity relationships or nested fragments.
Higher values (75–100) are safer for compatibility but offer less
protection against depth-based abuse.
Tip: Run your router in warn_only mode first to see what depths your
real traffic actually uses, then tighten:
limits:
router: # v2.15.0+; on v1 and v2.0–v2.14 put warn_only directly under limits
warn_only: true
What max_depth would you like? [default: 50]
The same principle applies to max_height, max_aliases, and max_root_fields.
http://otel-collector:4317)9090)0.1 = 10%)Security: data leakage risk. Before generating any response cache config, you MUST ask the user which types and fields return user-specific data. Cached data defaults to shared — subgraph responses without
Cache-Control: privateare visible to all users. User-specific subgraphs must returnCache-Control: privateand haveprivate_idconfigured on the router.
sub claim, session token, API key)redis://localhost:6379)5m)templates/v2/sections/response-caching.yamlreferences/response-caching.md (start with the Security section)measure (observe only) or enforce (reject over-budget operations)max cost thresholdlist_size estimate for undecorated list fieldsreferences/demand-control.mdtemplates/{version}/Run the post-generation checklist:
router: (client-facing), not only all: (subgraph)issuers (v2) not issuer (v1), or vice versarouter config validate <file> if Router binary is availableAfter generating or editing any router.yaml, you MUST:
validation/checklist.md and report pass/fail for each checklist item.router config validate <path-to-router.yaml> if Router CLI is available.router.yaml is the router's contract with every request — treat it like application code, not an ops afterthought. Whenever you generate or edit config, steer the user toward this workflow:
router.yaml to version control. It should live in git alongside the service, with changes reviewed via pull request. This gives you history, blame, and rollback for the most safety-critical file in the API layer.APOLLO_KEY, JWKS URLs, Redis URLs, and invalidation keys out of the file — reference them with ${env.*} expansion and inject at deploy time. The committed file should be safe to read by anyone with repo access.router config validate router.yaml on every PR so a malformed or version-mismatched config fails the build before it ships. Pin the Router version used in CI to the version you deploy.rover subgraph check / rover subgraph publish (the rover skill); config changes flow through this validate-in-CI gate. Both gate the same deploy.A minimal CI step (provide actual commands only if asked):
# Validate router config on every pull request
- run: router config validate router.yaml
After answering any Apollo Router request (config generation, edits, validation, or general Router guidance), decide whether the user already has runnable prerequisites:
APOLLO_KEY + APOLLO_GRAPH_REF, orsupergraph.graphql plus reachable subgraphsIf prerequisites are already present, do not add extra handoff text.
If prerequisites are missing or unknown, end with a concise Next steps handoff (1-3 lines max) that is skill-first and command-free:
rover skill to compose or fetch the supergraph schema.apollo-router once the supergraph is ready to validate and run with the generated config.apollo-server, graphql-schema, and graphql-operations skills to scaffold and test.Do not include raw shell commands in this handoff unless the user explicitly asks for commands.
apollo-router skill to generate or refine router.yaml for your environment.APOLLO_KEY and APOLLO_GRAPH_REF (no local supergraph composition required).graphql-schema + apollo-server to define/run subgraphs, then use graphql-operations for smoke tests, then use the rover skill to compose or fetch supergraph.graphql.apollo-router skill to validate readiness (validation/checklist.md) and walk through runtime startup inputs.Default endpoint remains http://localhost:4000 when using standard Router listen defaults.
If the user asks for executable shell commands, provide them on request. Otherwise keep Quick Start guidance skill-oriented.
| Mode | Command | Use Case |
|---|---|---|
| Local schema | router --supergraph ./schema.graphql | Development, CI/CD |
| GraphOS managed | APOLLO_KEY=... APOLLO_GRAPH_REF=my-graph@prod router | Production with auto-updates |
| Development | router --dev --supergraph ./schema.graphql | Local development |
| Hot reload | router --hot-reload --supergraph ./schema.graphql | Schema changes without restart |
| Variable | Description |
|---|---|
APOLLO_KEY | API key for GraphOS |
APOLLO_GRAPH_REF | Graph reference (graph-id@variant) |
APOLLO_KEY_PATH | Path to file containing API key |
APOLLO_ROUTER_CONFIG_PATH | Path to router.yaml |
APOLLO_ROUTER_SUPERGRAPH_PATH | Path to supergraph schema |
APOLLO_ROUTER_SUPERGRAPH_URLS | Comma-separated URLs for supergraph schema |
APOLLO_ROUTER_HOT_RELOAD | Enable hot reload for config/schema changes |
APOLLO_ROUTER_LOG | Log level (off, error, warn, info, debug, trace) |
APOLLO_ROUTER_LISTEN_ADDRESS | Override listen address |
APOLLO_ROUTER_LICENSE_PATH | Path to offline Enterprise license file |
APOLLO_ROUTER_LICENSE | Offline Enterprise license content (string) |
APOLLO_GRAPH_ARTIFACT_REFERENCE | OCI reference to graph artifact |
APOLLO_UPLINK_ENDPOINTS | Custom Uplink URL(s) |
APOLLO_UPLINK_TIMEOUT | Uplink poll timeout (default 30s) |
APOLLO_TELEMETRY_DISABLED | Disable anonymous usage telemetry |
@cost/@listSize directivesrouter [OPTIONS]
Options:
-s, --supergraph <PATH> Path to supergraph schema file
-c, --config <PATH> Path to router.yaml configuration
--dev Enable development mode
--hr, --hot-reload Watch for config/schema changes
--log <LEVEL> Log level (default: info)
--listen <ADDRESS> Override listen address
--license <PATH> Path to offline Enterprise license
--apollo-key-path <PATH> Path to file containing API key
--graph-artifact-reference <REF> OCI reference to graph artifact
--apollo-uplink-endpoints <URLs> Custom Uplink URL(s)
--apollo-uplink-timeout <DURATION> Uplink poll timeout (default: 30s)
--anonymous-telemetry-disabled Disable anonymous usage telemetry
-V, --version Print version
-h, --help Print help
Subcommands:
router config schema Print the JSON schema for router.yaml
router config upgrade Upgrade v1 config to v2 (use --diff for preview)
router config validate Validate a router.yaml file
--dev mode for local development (enables introspection and sandbox)--hot-reload for local development with file-based schemasAPOLLO_KEY in logs or version control${env.VAR}) for all secrets and sensitive configallow_any_origin or wildcard CORS in productionrouter config upgrade router.yaml for v1 → v2 migration instead of regenerating from scratchvalidation/checklist.md after every router config generation or editrouter config validate <file> when Router CLI is availablemax_depth: 50 as the default starting point, not 15 (too aggressive) or 100 (too permissive)warn_only: true for initial limits rollout to observe real traffic before enforcingROUTER_VERSION=v2 (requires v2.6.0+)${env.*} for Redis URLs, passwords, and invalidation shared keysresponse_cache.debug: true in production configprivate_id for subgraphs that serve user-specific data, and ensure those subgraphs return Cache-Control: private (via @cacheControl(scope: PRIVATE) in Apollo Server, or by setting the header directly in other frameworks)127.0.0.1, NEVER 0.0.0.0 in productionapq) is a bandwidth optimization with no security value; safelisting (persisted_queries.safelist) is the operation allowlist. If a user asks to "lock down which queries can run", point them to safelisting, not APQapq.enabled: false) when enabling persisted_queries.safelist — they are mutually exclusivelog_unknown: true) to confirm all clients are registered before turning on safelist.enabledAPOLLO_KEY + APOLLO_GRAPH_REF, or local_manifests for offline licenses)persisted_queries (GA, v1.32.0+ and all v2), NOT preview_persisted_queries (v1.25.0–v1.32.0)authorization.require_authentication and declarative directives as different layers: the former gates the whole request, the latter (@authenticated / @requiresScopes / @policy) does field- and type-level filteringapollo::authentication::jwt_claims)authorization.directives.enabled: false only turns them off; never imply config is required to "turn them on"@policy additionally requires a Rhai script or coprocessor at the Supergraph stage to evaluate apollo::authorization::required_policiesrouter.yaml — router config only enables/disables the featurerouter.yaml to version control and running router config validate in CI on every PR, with all secrets referenced via ${env.*} and injected at deploy timeAPOLLO_KEY, JWKS/Redis URLs, invalidation keys) to the config file; the committed router.yaml must be safe to share with anyone holding repo accessmeasure mode to observe operation costs before switching to enforcelimits.router.* (for example limits.router.max_depth) on Router v2.15.0+, and the flat limits.* shape on v1 and v2.0–v2.14, which reject limits.routerdivergence-map.md (opens in a new tab)references/configuration.md (opens in a new tab)references/connectors.md (opens in a new tab)references/demand-control.md (opens in a new tab)references/headers.md (opens in a new tab)references/plugins.md (opens in a new tab)references/response-caching.md (opens in a new tab)references/telemetry.md (opens in a new tab)references/troubleshooting.md (opens in a new tab)templates/v1/development.yaml (opens in a new tab)templates/v1/production.yaml (opens in a new tab)templates/v1/sections/auth.yaml (opens in a new tab)templates/v1/sections/cors.yaml (opens in a new tab)templates/v1/sections/headers.yaml (opens in a new tab)templates/v1/sections/limits.yaml (opens in a new tab)templates/v1/sections/telemetry.yaml (opens in a new tab)templates/v1/sections/traffic-shaping.yaml (opens in a new tab)templates/v2/development.yaml (opens in a new tab)templates/v2/production.yaml (opens in a new tab)templates/v2/sections/auth.yaml (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
15 skills in this plugin
/apollo-clientGuide for building React applications with Apollo Client 4.x. Use this skill when: (1) setting up Apollo Client in a React project, (2) writing GraphQL queries or mutations with hooks, (3) configuring caching or cache policies, (4) managing local state with reactive variables, (5) troubleshooting Apollo Client errors or performance issues.
/apollo-connectorsDEPRECATED: superseded by the graphos-factory skill (npx skills add apollographql/skills@graphos-factory), which builds and maintains a Connectors subgraph from a REST API with recorded decisions and verification. Guide for integrating REST APIs into GraphQL supergraphs using Apollo Connectors with @source and @connect directives. Use this skill when the user: (1) mentions "connectors", "Apollo Connectors", or "REST Connector", (2) wants to integrate a REST API into GraphQL, (3) references @source or @connect directives, (4) works with files containing "# Note to AI Friends: This is an Apollo Connectors schema".
/apollo-federationGuide for authoring Apollo Federation subgraph schemas. Use this skill when: (1) creating new subgraph schemas for a federated supergraph, (2) defining or modifying entities with @key, (3) sharing types/fields across subgraphs with @shareable, (4) working with federation directives (@external, @requires, @provides, @override, @inaccessible), (5) troubleshooting composition errors, (6) any task involving federation schema design patterns.
/apollo-iosGuide for building Apple-platform applications with Apollo iOS, the strongly-typed GraphQL client for Swift. Use this skill when: (1) adding Apollo iOS to a Swift Package Manager or Xcode project, (2) configuring `apollo-codegen-config.json` and running code generation, (3) configuring an `ApolloClient` with auth, interceptors, and caching, (4) writing queries, mutations, or subscriptions from SwiftUI views, (5) writing tests against generated operation mocks.
/apollo-kotlinGuide for building applications with Apollo Kotlin, the GraphQL client library for Android and Kotlin. Use this skill when: (1) setting up Apollo Kotlin in a Gradle project for Android, Kotlin/JVM, or KMP, (2) configuring schema download and codegen for GraphQL services, (3) configuring an `ApolloClient` with auth, interceptors, and caching, (4) writing queries, mutations, or subscriptions,
/apollo-mcp-serverGuide for using Apollo MCP Server to connect AI agents with GraphQL APIs. Use this skill when: (1) setting up or configuring Apollo MCP Server, (2) defining MCP tools from GraphQL operations, (3) using introspection tools (introspect, search, validate, execute, explorer), (4) configuring authentication, CORS, health checks, or telemetry, (5) writing Rhai scripts for request lifecycle hooks, (6) defining MCP prompts, (7) troubleshooting MCP server connectivity or tool execution issues, (8) building MCP Apps for interactive UI experiences, (9) deploying Apollo MCP Server to production.
npx claudepluginhub apollographql/skills --plugin apollo-skillsOther plugins' skills for the same job