benchmark-gql

A performance benchmark for comparing production and staging GraphQL APIs across every public query. GraphQL is an API format where clients request specific data fields; staging is the test environment before production.

In plain words
What is it for?
Measuring client response time, Worker CPU time, wall time, and response size, then appending the comparison to a Markdown report.
Why use it?
It shows whether an upcoming code version is slower or uses more Cloudflare Worker CPU than the live version.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/trainlcd/stationapi/benchmark-gql
Any agent
npx skills add TrainLCD/StationAPI --skill benchmark-gql
Clone the repo
git clone --depth 1 https://github.com/TrainLCD/StationAPI

Made for: Claude Code, Codex.

Per session 95 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,276 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00095 $0.03276
Opus 5 $0.00048 $0.01638
Sonnet 5 $0.00019 $0.00655
Haiku 4.5 $0.00010 $0.00328

Measured 2d ago against content hash d80c5dba1f95, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

benchmark-gql scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (bench.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

for u in https://gql.trainlcd.app https://gql-stg.trainlcd.app; do curl -s "$u/__health"; echo " <- $u"; done
.claude/skills/benchmark-gql/SKILL.md · 147 lines

How it starts

The opening of the file, as written. The whole thing — 147 lines — stays where its author put it; the contents beside it link to each section on GitHub.

benchmark-gql

本番 (https://gql.trainlcd.app / Worker stationapi) とステージング (https://gql-stg.trainlcd.app / Worker stationapi-stg) の GraphQL 性能を、 schema/public.graphql の全 Query フィールドについて比較する。

両環境は同じデータを積んでいる (/__health が返す駅数・路線数・会社数が一致する) ので、 出てくる差は実装差だけ。ステージングは dev、本番は master から出るので、 このベンチは「次のリリースで本番の性能がどう変わるか」を先に見るものになる。

何を測るか

指標 出どころ 何が見えるか
CPU Time wrangler tail --format jsoncpuTime Worker が実際に計算に使った時間。ネットワークもコロの当たり外れも含まないので、実装差はここに出る。判定はこの列で行う
Worker wall time wallTime Worker 内の実時間。この Worker は I/O をしないので CPU Time とほぼ一致し、乖離したら外部待ちが混ざったサイン
クライアント応答時間 keep-alive を張った 1 本の接続での往復時間 利用者から見た体感。回線とエッジ処理と転送を含む
応答サイズ レスポンスのバイト数 転送時間の効き方を読むための補助

CPU Time はリクエストと cf-ray で突き合わせる。wrangler tail 側には --header x-stationapi-bench:<実行 ID> を渡すので、本番に実ユーザーのトラフィックが 流れていてもこの実行のリクエストだけが降ってくる。

前提条件

  • wrangler の認証が済んでいて、権限に workers_tail (read) があること。 無いと CPU Time が欠測になる (応答時間の計測だけは続行する)。 版は MakefileWRANGLER_VERSION に合わせる。版を指定しない npx wrangler は その時点の最新を取ってくるので、Cloudflare の認証情報を持つ環境で走らせるものとしては 固定しておく。bench.py も同じ値を読んで wrangler tail を起動する。

    npx --yes wrangler@"$(sed -n 's/^WRANGLER_VERSION := //p' Makefile)" whoami
    
  • Python 3。依存は標準ライブラリのみ。

  • リポジトリルートで実行すること (wrangler tail の cwd に使う)。

手順

  1. 両環境が同じデータかを先に確認する。 違えば差は実装起因ではない。

    for u in https://gql.trainlcd.app https://gql-stg.trainlcd.app; do curl -s "$u/__health"; echo " <- $u"; done
    

    食い違っていたら、その旨をユーザーに伝えてから続けるか止めるかを決める。

  2. ベンチを回す。 既定は全 23 ケース × 15 反復 × 2 環境で、2〜3 分。 本番側が遅いクエリを抱えているとその分伸びる。

    python3 .claude/skills/benchmark-gql/bench.py
    # make bench でも同じ (追加引数は make bench BENCH_ARGS="--repeat 30")
    

    wrangler tail の接続待ちだけで最大 90 秒かかるので、バックグラウンド実行にして待つこと。 フォアグラウンドだとツールのタイムアウトに当たる。

  3. レポートの「所見」節を埋める。 ここだけは自動生成しない。差が出たクエリについて、 src/graphql/query.rsstationapi/src/use_case/interactor/query.rs の実装、 および jj diff --from 'master@origin' --to 'dev@origin' を見て、 どの変更が効いているかを書く。差が出なかったこと自体が結論なら、それも明記する。

Read the full file on GitHub · 147 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 147 lines · 95 tokens per session scan A d80c5dba1f95

Subscribe to this mod's changes

benchmark-gql is a skill published in the GitHub repository TrainLCD/StationAPI (10 stars, last pushed 2d ago), licensed MIT. It adds 95 tokens to every session and 3,276 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

create-tutorial

Scaffold a new Membrane API Gateway tutorial in the api-gateway repo — the numbered self-teaching YAML under distribution/tutorials/ /, its support files and README links, and the matching auto-discovered integration test. Use whenever the user asks to create, add, write, or scaffold a tutorial (or a tutorial step)…

membrane/api-gateway · 97 tokens

optimize-interceptor-docs

Rewrite the reference documentation of a Membrane config element so the page generated at membrane-api.io comes out clean, exact, and reference-style. Use whenever the user wants to write, improve, optimize, polish, or review the docs / Javadoc / @description / @yaml example of an interceptor, plugin, or any…

membrane/api-gateway · 173 tokens

review-branch

Review the current git branch against master — code quality, refactoring opportunities, regressions, correctness, and test coverage — and print a severity-grouped markdown report. Use whenever the user asks to review the branch, review their changes against master, do a pre-PR / pre-merge review, or asks "is this…

membrane/api-gateway · 125 tokens

membrane-config

Generate a Membrane API Gateway configuration example or snippet — an apis.yaml (default) or, when explicitly asked, a legacy proxies.xml. Use this whenever the user wants a config, example, or snippet for Membrane: routing a port to a backend, a flow with plugins (setHeader, rateLimiter, basicAuthentication, openapi…

membrane/api-gateway · 167 tokens

release-notes

Generate GitHub release notes for the Membrane api-gateway repo by collecting the commits between the last release and master, grouping them into Features / Improvements / Fixes / Security / Dependencies, and linking each to its PR. Use whenever the user wants to draft, extract, or write release notes / a changelog /…

membrane/api-gateway · 124 tokens

run-example-test

Run a single distribution example or tutorial integration test (IT) fast, instead of the whole 6 min example suite. Use when asked to run, verify, or check one example/tutorial test in the api-gateway distribution module.

membrane/api-gateway · 50 tokens