Agent skill

Apollo Router Plugin Creator

by apollographql in apollographql/skills

Guide for writing Apollo Router native Rust plugins. An agent skill from apollographql/skills.

MITAuto-check passedAgent Workflows

Install Apollo Router Plugin Creator

skills CLI
$ npx skills add apollographql/skills --skill apollo-router-plugin-creator -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install apollographql/skills apollo-router-plugin-creator --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/apollographql/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/apollo-router-plugin-creator .claude/skills/apollo-router-plugin-creator && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
apollo-router-plugin-creator
GitHub stars
117
Token cost
~4.1k tokens
SKILL.md length
579 words
Files
4 (incl. references)
Skills in repo
12
Repo updated
First seen
Licence
MIT

At a glance

Guide for writing Apollo Router native Rust plugins. An agent skill from apollographql/skills.

  • Works in 8 steps: Create Plugin File → Define Configuration Struct → Define Plugin Struct → …
  • Users want to create a new router plugin
  • SKILL.md covers Request Lifecycle, Service Hooks, Quick Start and Common Patterns, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Apollo Router Plugin Creator is an agent skill from apollographql/skills. 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 (routerservice, supergraphservice, executionservice, subgraphservice), (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 subgraphservice hook".

Its SKILL.md is about 4.1k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including reference files (for example `references/examples.md`, `references/existing-plugins.md` and `references/service-hooks.md`).

It sits in Agent Workflows, covering Hooks and plugins. It works with Apollo GraphQL and Rust. The repository describes itself as: Apollo GraphQL Agent Skills. The licence is MIT.

When your agent uses it

  • Users want to create a new router plugin
  • Users want to add service hooks (routerservice
  • Supergraphservice
  • Executionservice

Example prompts

  • “create a new plugin”
  • “add a router plugin”
  • “modify the X plugin”
  • “/apollo-router-plugin-creator”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Glob, Grep

Workflow steps

8 steps, taken from the step headings in SKILL.md.

  1. Create Plugin File
  2. Define Configuration Struct
  3. Define Plugin Struct
  4. Implement Plugin Trait
  5. Add Service Hooks
  6. Register Plugin
  7. Add Module to mod.rs
  8. Configure in YAML

What it can do on your machine

Read from SKILL.md and the folder at commit 5f02fcf. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are rust and yaml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • skills.sh

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Apollo Router Plugin Creator loads about 4.1k tokens when it runs, and up to ~7.6k if it reads all its reference files. Until then it costs about 130 tokens; SKILL.md has 579 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~130
When it runs · the whole SKILL.md, loaded when a task matches
~4.1k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~7.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from apollographql/skills at commit 5f02fcf, republished under its MIT licence (© apollographql). 579 words, ~4,125 tokens.

Download SKILL.mdSave it as .claude/skills/apollo-router-plugin-creator/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
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".
allowed-tools
Read, Write, Edit, Glob, Grep
license
MIT
metadata.author
apollographql
metadata.version
1.0.0
metadata.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) │
└────┬───┘             └────────┬───────┘                                   └──────────┬─────────┘               └─────────┬─────────┘       └──────────┬──────────┘
     │                          │                                                      │                                   │                            │
     │      Sends request       │                                                      │                                   │                            │
     │──────────────────────────▶                                                      │                                   │                            │
     │                          │                                                      │                                   │                            │
     │                          │  Converts raw HTTP request to GraphQL/JSON request   │                                   │                            │
     │                          │──────────────────────────────────────────────────────▶                                   │                            │
     │                          │                                                      │                                   │                            │
     │                          │                                                      │  Initiates query plan execution   │                            │
     │                          │                                                      │───────────────────────────────────▶                            │
     │                          │                                                      │                                   │                            │
     │                          │                                                      │                               ┌par [Initiates sub-operation]───────┐
     │                          │                                                      │                               │   │                            │   │
     │                          │                                                      │                               │   │  Initiates sub-operation   │   │
     │                          │                                                      │                               │   │────────────────────────────▶   │
     │                          │                                                      │                               │   │                            │   │
     │                          │                                                      │                               ├[Initiates sub-operation]╌╌╌╌╌╌╌╌╌╌╌┤
     │                          │                                                      │                               │   │                            │   │
     │                          │                                                      │                               │   │  Initiates sub-operation   │   │
     │                          │                                                      │                               │   │────────────────────────────▶   │
     │                          │                                                      │                               │   │                            │   │
     │                          │                                                      │                               ├[Initiates sub-operation]╌╌╌╌╌╌╌╌╌╌╌┤
     │                          │                                                      │                               │   │                            │   │
     │                          │                                                      │                               │   │  Initiates sub-operation   │   │
     │                          │                                                      │                               │   │────────────────────────────▶   │
     │                          │                                                      │                               │   │                            │   │
     │                          │                                                      │                               └────────────────────────────────────┘
     │                          │                                                      │                                   │                            │
     │                          │                                                      │  Assembles and returns response   │                            │
     │                          │                                                      ◀╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌│                            │
     │                          │                                                      │                                   │                            │
     │                          │            Returns GraphQL/JSON response             │                                   │                            │
     │                          ◀╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌│                                   │                            │
     │                          │                                                      │                                   │                            │
     │  Returns HTTP response   │                                                      │                                   │                            │
     ◀╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌│                                                      │                                   │                            │
     │                          │                                                      │                                   │                            │
┌────┴───┐             ┌────────┴───────┐                                   ┌──────────┴─────────┐               ┌─────────┴─────────┐       ┌──────────┴──────────┐
│ Client │             │ Router Service │                                   │ Supergraph Service │               │ Execution Service │       │ Subgraph Service(s) │
└────────┘             └────────────────┘                                   └────────────────────┘               └───────────────────┘       └─────────────────────┘

Service Hooks

Service Overview
ServiceDescription
router_serviceRuns 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_serviceRuns 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_serviceHandles 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_serviceHandles 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.

Signatures:

rust
fn router_service(&self, service: router::BoxService) -> router::BoxService
fn supergraph_service(&self, service: supergraph::BoxService) -> supergraph::BoxService
fn execution_service(&self, service: execution::BoxService) -> execution::BoxService
fn subgraph_service(&self, name: &str, service: subgraph::BoxService) -> subgraph::BoxService
Individual Hooks (Tower Layers)

Use ServiceBuilder to compose these hooks within any service:

HookPurposeSync/Async
map_request(fn)Transform request before proceedingSync
map_response(fn)Transform response before returningSync
checkpoint(fn)Validate/filter, can short-circuitSync
checkpoint_async(fn)Async validation, can short-circuitAsync
buffered()Enable service cloning (needed for async)-
instrument(span)Add tracing span around service-
rate_limit(num, period)Control request throughput-
timeout(duration)Set operation time limit-
Choosing a Service Hook

By data needed:

  • HTTP headers only → router_service
  • GraphQL query/variables → supergraph_service
  • Query plan → execution_service
  • Per-subgraph control → subgraph_service

By timing:

  • Before GraphQL parsing → router_service request
  • After parsing, before planning → supergraph_service request
  • After planning, before execution → execution_service request
  • Before/after each subgraph call → subgraph_service
  • Final response to client → router_service response

See references/service-hooks.md for implementation patterns.

Quick Start

Step 1: Create Plugin File

Create a new file src/plugins/my_plugin.rs with required imports:

rust
use std::ops::ControlFlow;
use apollo_router::plugin::{Plugin, PluginInit};
use apollo_router::register_plugin;
use apollo_router::services::{router, subgraph, supergraph};
use schemars::JsonSchema;
use serde::Deserialize;
use tower::{BoxError, ServiceBuilder, ServiceExt};

const PLUGIN_NAME: &str = "my_plugin";
Step 2: Define Configuration Struct

Every plugin needs a configuration struct with Deserialize and JsonSchema derives. The JsonSchema enables configuration validation in editors:

rust
#[derive(Debug, Clone, Default, Deserialize, JsonSchema)]
struct MyPluginConfig {
  /// Enable the plugin
  enabled: bool,
  // Add other configuration fields as needed
}
Show full SKILL.md (222 more words)Show less
Step 3: Define Plugin Struct
rust
#[derive(Debug)]
struct MyPlugin {
  configuration: MyPluginConfig,
}
Step 4: Implement Plugin Trait

Implement the Plugin trait with the required Config type and new constructor:

rust
#[async_trait::async_trait]
impl Plugin for MyPlugin {
  type Config = MyPluginConfig;

  async fn new(init: PluginInit<Self::Config>) -> Result<Self, BoxError> {
    Ok(MyPlugin { configuration: init.config })
  }

  // Add service hooks based on your needs (see "Choosing a Service Hook" section)
}
Step 5: Add Service Hooks

Choose which service(s) to hook based on your requirements, see Service Overview for details.

Example service hook:

rust
fn supergraph_service(&self, service: supergraph::BoxService) -> supergraph::BoxService {
  if !self.configuration.enabled {
    return service;
  }

  ServiceBuilder::new()
    .map_request(|req| { /* transform request */ req })
    .map_response(|res| { /* transform response */ res })
    .service(service)
    .boxed()
}
Step 6: Register Plugin

At the bottom of your plugin file, register it with the router:

rust
register_plugin!("acme", "my_plugin", MyPlugin);
Step 7: Add Module to mod.rs

In src/plugins/mod.rs, add your module:

rust
pub mod my_plugin;
Step 8: Configure in YAML

Enable your plugin in the router configuration:

yaml
plugins:
  acme.my_plugin:
    enabled: true

Common Patterns

For implementation patterns and code examples, see references/service-hooks.md:

  • Enable/disable pattern
  • Request/response transformation (map_request, map_response)
  • Checkpoint (early return/short-circuit)
  • Context passing between hooks
  • Async operations (checkpoint_async, buffered)
  • Error response builders

Examples

Apollo Router Examples

Located in the Apollo Router plugins directory:

PluginService HookPatternDescription
forbid_mutations.rsexecution_servicecheckpointSimple gate on query plan
expose_query_plan.rsexecution + supergraphContext passingMulti-service coordination
cors.rsrouter_serviceHTTP layerCORS handling at HTTP level
headers/subgraph_serviceLayer compositionComplex header manipulation

For full code examples and testing patterns, see references/examples.md.

Prerequisites

It is advised to have the 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

© apollographql, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (references) in skills/apollo-router-plugin-creator of apollographql/skills.

  • SKILL.md
  • references/examples.md
  • references/existing-plugins.md
  • references/service-hooks.md

Open the folder on GitHubat commit 5f02fcf

Compare with similar skills

Apollo Router Plugin Creator next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Apollo Router Plugin Creator compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Apollo Router Plugin Creator this skillapollographql/skills117—~4.1kAutomated safety check: PassMIT
Plugin CreatoruseLexora/Lexora566—~1kAutomated safety check: PassAGPL-3.0
Creating Zed Extensionspr-pm/prpm122—~3.1kAutomated safety check: NotesMIT
Rust Best Practicesfarm-fe/farm5.6k3 repos~1.1kAutomated safety check: PassMIT
Tabularis Database Driver PluginTabularisDB/tabularis5.1k—~2.1kAutomated safety check: PassApache-2.0
Rust Best Practicesscott-fryxell/brayness125—~888Automated safety check: PassMIT

Similar skills

  • Plugin Creator

    useLexora/Lexora

    创建、修改并验证可安装的 Lexora 桌面插件,包括工作台装饰、导航与面板、文件阅读工具、控件样式、网络查询、通知和定时命令。也响应 $plugin-creator。普通任务执行、使用现有插件、其他产品的插件开发不属于此技能。

    566 GitHub stars~1k tokensUpdated today
    Agent WorkflowsAuto-check passed
  • A skill your agent uses when creating Zed extensions with custom slash commands, language support, themes, or MCP servers - provides Rust/WASM extension structure, slash command API…

    122 GitHub stars~3.1k tokensUpdated 2 days ago
    Agent WorkflowsAuto-check: notes
  • Guide for writing idiomatic Rust code based on Apollo GraphQL's best practices handbook.

    5.6k GitHub starsUsed in 3 repos~1.1k tokens
    DevelopmentAuto-check passed
  • Guides building or updating a Tabularis database driver plugin in Rust that speaks JSON-RPC over stdio and follows the repository's rules.

    5.1k GitHub stars~2.1k tokensUpdated today
    DatabasesAuto-check passed
  • Rust Best Practices

    scott-fryxell/brayness

    Idiomatic Rust guide based on Apollo GraphQL's best practices handbook.

    125 GitHub stars~888 tokensUpdated 11 days ago
    DevelopmentAuto-check passed
  • Hook Development for Claude Code Plugins

    anthropics/claude-plugins-official

    Official

    Explains how to write Claude Code plugin hooks, both prompt-based checks and bash commands, for events such as PreToolUse, Stop and SessionStart.

    38k GitHub starsUsed in 10 repos~4.1k tokens
    Agent WorkflowsAuto-check: notes

More from apollographql/skills

All 12 skills in this repo
  • Graphos Factory

    apollographql/skills

    Build and iterate on an Apollo Connectors subgraph for a GraphOS supergraph from a REST API, with or without an OpenAPI or Swagger spec, in a dedicated git workspace that records what the API…

    117 GitHub stars~15k tokensUpdated yesterday
    Auto-check passed
  • Apollo Client

    apollographql/skills

    Guide for building React applications with Apollo Client 4.x.

    117 GitHub stars~1.9k tokensUpdated yesterday
    Auto-check passed
  • Apollo Connectors

    apollographql/skills

    DEPRECATED: 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…

    117 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed
  • Apollo Federation

    apollographql/skills

    Guide for authoring Apollo Federation subgraph schemas. An agent skill from apollographql/skills.

    117 GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • Apollo iOS

    apollographql/skills

    Guide for building Apple-platform applications with Apollo iOS, the strongly-typed GraphQL client for Swift.

    117 GitHub stars~2k tokensUpdated yesterday
    Auto-check passed
  • Apollo Server

    apollographql/skills

    Guide for building GraphQL servers with Apollo Server 5.x. An agent skill from apollographql/skills.

    117 GitHub stars~1.8k tokensUpdated yesterday
    Auto-check passed

Categories

Questions about Apollo Router Plugin Creator

What does Apollo Router Plugin Creator do?

Guide for writing Apollo Router native Rust plugins. An agent skill from apollographql/skills. Apollo Router Plugin Creator is an agent skill from apollographql/skills. Guide for writing Apollo Router native Rust plugins.

When should I use Apollo Router Plugin Creator?

Apollo Router Plugin Creator fits situations like: users want to create a new router plugin; users want to add service hooks (routerservice; supergraphservice; executionservice.

How do I install Apollo Router Plugin Creator in Claude Code?

Run `npx skills add apollographql/skills --skill apollo-router-plugin-creator -a claude-code`. Or copy the skill folder (skills/apollo-router-plugin-creator in apollographql/skills) into .claude/skills/apollo-router-plugin-creator in your project. Claude Code loads it when a task matches its description.

How do I install Apollo Router Plugin Creator in Codex?

Run `npx skills add apollographql/skills --skill apollo-router-plugin-creator -a codex`. Or copy the skill folder (skills/apollo-router-plugin-creator in apollographql/skills) into .agents/skills/apollo-router-plugin-creator in your project. Codex loads it when a task matches its description.

Can I use Apollo Router Plugin Creator in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add apollographql/skills --skill apollo-router-plugin-creator -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/apollo-router-plugin-creator, .gemini/skills/apollo-router-plugin-creator, .github/skills/apollo-router-plugin-creator and .opencode/skills/apollo-router-plugin-creator in your project.

What does Apollo Router Plugin Creator need to run?

SKILL.md names no scripts, command-line tools or credentials: Apollo Router Plugin Creator is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Edit, Glob, Grep.

Does Apollo Router Plugin Creator access the network?

SKILL.md names 2 domains. As links in the text: github.com and skills.sh. This is read from the text; nothing was executed.

Is Apollo Router Plugin Creator safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Apollo Router Plugin Creator use?

Apollo Router Plugin Creator is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Apollo Router Plugin Creator use?

About 4.1k tokens (SKILL.md is roughly 17k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.5k tokens, read only when the agent opens those files.

What are the alternatives to Apollo Router Plugin Creator?

Skills that share tags, products or a category with Apollo Router Plugin Creator: Plugin Creator (useLexora/Lexora, 566 stars), Creating Zed Extensions (pr-pm/prpm, 122 stars), Rust Best Practices (farm-fe/farm, 5.6k stars) and Tabularis Database Driver Plugin (TabularisDB/tabularis, 5.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Apollo Router Plugin Creator?

apollographql (a GitHub organization) maintains it in apollographql/skills, which has 117 GitHub stars. The repository holds 12 skills in this directory. The repository was last updated on October 7, 2026.

Source: apollographql/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.