Guide for writing Apollo Router native Rust plugins. Use this skill when: (1) users want to create a new router plugin, (2) users want to add service hooks (router_service, supergraph_service, execution_service, subgraph_service), (3) users want to modify an existing router
Installs just this skill. Get the whole plugin for auto-invocation.
β‘ How it fires
How this skill gets triggered: by you, by Claude, or both.
Fires itselfClaude auto-loads it when your prompt matches the work.
You can call itInvoke it directly when you want it.
Slash command/apollo-router-plugin-creator
ποΈ Context preview
The summary Claude sees to decide when to auto-load this skill.
Guide for writing Apollo Router native Rust plugins. Use this skill when: (1) users want to create a new router plugin, (2) users want to add service hooks (router_service, supergraph_service, execution_service, subgraph_service), (3) users want to modify an existing router
π Stats
Stars98
Forks11
LanguageShell
LicenseMIT
π¦ Ships with apollo-skills
</> SKILL.md
apollo-router-plugin-creator.SKILL.md
---name: apollo-router-plugin-creator
description: >
Guide for writing Apollo Router native Rust plugins. Use this skill when:
(1) users want to create a new router plugin,
(2) users want to add service hooks (router_service, supergraph_service, execution_service, subgraph_service),
(3) users want to modify an existing router plugin,
(4) users need to understand router plugin patterns or the request lifecycle.
(5) triggers on requests like "create a new plugin", "add a router plugin", "modify the X plugin", or "add subgraph_service hook".
license: MIT
allowed-tools: Read Write Edit Glob Grep
metadata:
author: apollographql
version: "1.0.0"
compatibility: "Requires Apollo Router with native plugin support"
---# Apollo Router Plugin Creator
Create native Rust plugins for Apollo Router.
## Request Lifecycle
```
ββββββββββ ββββββββββββββββββ ββββββββββββββββββββββ βββββββββββββββββββββ βββββββββββββββββββββββ
β Client β β Router Service β β Supergraph Service β β Execution Service β β Subgraph Service(s) β
ββββββ¬ββββ ββββββββββ¬ββββββββ ββββββββββββ¬ββββββββββ βββββββββββ¬ββββββββββ ββββββββββββ¬βββββββββββ
| `router_service` | Runs at the very beginning and very end of the HTTP request lifecycle.For example, JWT authentication is performed within the RouterService.Define router_service if your customization needs to interact with HTTP context and headers. It doesn't support access to the body property |
| `supergraph_service` | Runs at the very beginning and very end of the GraphQL request lifecycle.Define supergraph_service if your customization needs to interact with the GraphQL request or the GraphQL response. For example, you can add a check for anonymous queries. |
| `execution_service` | Handles initiating the execution of a query plan after it's been generated.Define execution_service if your customization includes logic to govern execution (for example, if you want to block a particular query based on a policy decision). |
| `subgraph_service` | Handles communication between the router and your subgraphs.Define subgraph_service to configure this communication (for example, to dynamically add HTTP headers to pass to a subgraph).Whereas other services are called once per client request, this service is called once per subgraph request that's required to resolve the client's request. Each call is passed a subgraph parameter that indicates the name of the corresponding subgraph. |
For full code examples and testing patterns, see [references/examples.md](references/examples.md).
## Prerequisites
It is advised to have the [rust-best-practices](https://skills.sh/apollographql/skills/rust-best-practices) skill installed for writing idiomatic Rust code when developing router plugins. If installed, follow those best practices when generating or modifying plugin code.
## Resources
- [references/service-hooks.md](references/service-hooks.md) - Detailed service hook implementations
- [references/existing-plugins.md](references/existing-plugins.md) - Index of existing plugins
- [references/examples.md](references/examples.md) - Full code examples and testing patterns
- Apollo Router plugins: https://github.com/apollographql/router/tree/dev/apollo-router/src/plugins