cost-benchmark — Claude Code skill: what it does, how to install
Runs corpus benchmarks to evaluate booster performance and compare spend against Gemini or Claude baselines. Generates verifiable cost tables before releases.
npx skills add ruvnet/ruflo --skill cost-benchmark -a claude-codeWhat cost-benchmark does
This skill runs scripts/bench.mjs from the v3/ directory against test cases defined in bench/booster-corpus.json. The local booster test executes in approximately 85 ms without incurring API costs. Setting BENCH_LLM_BASELINE=1 or BENCH_ANTHROPIC=1 adds comparison baselines across Gemini 2.0 Flash, Claude Sonnet 4.6, and Claude Opus 4.7.
Results write to docs/benchmarks/runs/latest.json and historical ISO-timestamped records. Smoke checks evaluate Tier 1 cases against a winRate ≥ 0.80 requirement, while adversarial scenarios report an unblocked escalationRate. Running external model baselines requires API keys accessible via gcloud secrets or the explicit environment variables BENCH_LLM_API_KEY and BENCH_ANTHROPIC_API_KEY.
What it helps with
- verify booster win rate before publishing a release
- compare task execution costs between Sonnet 4.6 and Opus 4.7
- persist benchmark run metrics to docs/benchmarks/runs/
- audit routing accuracy on new cases in booster-corpus.json
Example prompts for the agent
- Run cost-benchmark to evaluate the local booster
- Execute cost-benchmark with --anthropic to compare Sonnet and Opus costs
- Run cost-benchmark with BENCH_LLM_BASELINE=1 to check Gemini 2.0 Flash performance
How to install cost-benchmark
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-benchmark -a claude-code2Manually: put the files in place
~/.claude/skills/cost-benchmark/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cost-benchmark/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-benchmark -a codex2Manually: put the files in place
.agents/skills/cost-benchmark/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-benchmark -a cursor2Manually: put the files in place
.cursor/skills/cost-benchmark/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install ruvnet/ruflo cost-benchmark2Manually: put the files in place
.github/skills/cost-benchmark/SKILL.md1Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-benchmark -a gemini-cli2Platform CLI
gemini skills install https://github.com/ruvnet/ruflo --path plugins/ruflo-cost-tracker/skills/cost-benchmarkManually: put the files in place
.devin/skills/cost-benchmark/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add ruvnet/ruflo --skill cost-benchmark -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set104
The whole set →Similar
Questions about cost-benchmark
How do I install cost-benchmark in Claude Code?
Run npx skills add ruvnet/ruflo --skill cost-benchmark -a claude-code.
What does cost-benchmark do?
It runs scripts/bench.mjs across a test corpus, calculates routing win rates, and outputs comparative cost metrics to docs/benchmarks/runs/latest.json.
What credentials are needed for baseline benchmarks?
Local booster runs do not need credentials. Baselines pull GOOGLE_AI_API_KEY and ANTHROPIC_API_KEY from gcloud secrets, or accept overrides from BENCH_LLM_API_KEY and BENCH_ANTHROPIC_API_KEY.
Source text
SKILL.md · MIT
---
name: cost-benchmark
description: Run the corpus benchmark — booster locally, optional Gemini/Sonnet/Opus baselines — and persist a verifiable measured-vs-claimed table
argument-hint: "[--llm] [--anthropic]"
allowed-tools: Bash
---
# Cost Benchmark
Runs `scripts/bench.mjs` against the structural+adversarial corpus and writes per-case + summary results to `docs/benchmarks/runs/`. This is the verification gate that backs every measurable claim in `cost-booster-edit` / `cost-booster-route`.
## When to use
- Before publishing a release — verify booster win rate didn't regress.
- After expanding `bench/booster-corpus.json` — confirm new cases route correctly.
- When auditing a "claimed upstream" tag — flip it to "verified" once the bench supports it.
- On a cost question ("is Sonnet 4.6 cheaper than Opus 4.7 for these tasks?") — re-run with `BENCH_ANTHROPIC=1`.
## Steps
1. **Run the bench from `v3/`** (where `agent-booster` resolves):
```bash
( cd v3 && node ../plugins/ruflo-cost-tracker/scripts/bench.mjs ) # booster only — free, ~85 ms
( cd v3 && BENCH_LLM_BASELINE=1 node ../plugins/ruflo-cost-tracker/scripts/bench.mjs ) # + Gemini 2.0 Flash (cheap)
( cd v3 && BENCH_LLM_BASELINE=1 BENCH_ANTHROPIC=1 \
node ../plugins/ruflo-cost-tracker/scripts/bench.mjs ) # + Sonnet 4.6 + Opus 4.7
```
2. **Inspect the markdown summary** printed to stdout. The gate metric is `winRate` (Tier 1 cases). Adversarial cases are tracked separately as `escalationRate`.
3. **Persisted output** lands at:
- `docs/benchmarks/runs/latest.json` — pointer to the most recent run
- `docs/benchmarks/runs/<ISO-timestamp>.json` — historical record
4. **Read it back** in subsequent skills (e.g. `cost-report` step 2 reads `latest.json` for live tier-spend numbers).
## Smoke gates
- `winRate ≥ 0.80` on Tier 1 cases (smoke step 23). Lower the threshold by editing `scripts/smoke.sh`.
- `escalationRate` is reported but ungated — adversarial cases are diagnostic.
## Env overrides
| Env var | Default | Purpose |
|---|---|---|
| `BENCH_LLM_BASELINE` | unset | `=1` runs the OpenAI-compat baseline |
| `BENCH_LLM_MODEL` | `models/gemini-2.0-flash` | Override the OpenAI-compat model |
| `BENCH_LLM_BASE_URL` | Gemini OpenAI shim | Override endpoint |
| `BENCH_ANTHROPIC` | unset | `=1` runs Anthropic baseline (Sonnet 4.6 + Opus 4.7) |
| `BENCH_ANTHROPIC_MODELS` | `claude-sonnet-4-6,claude-opus-4-7` | Comma-separated Claude IDs |
| `BENCH_OUT` | timestamped file | Override output path |
| `BENCH_QUIET=1` | unset | Suppress markdown summary |
API keys auto-pulled from `gcloud secrets` (`GOOGLE_AI_API_KEY`, `ANTHROPIC_API_KEY`); override with `BENCH_LLM_API_KEY` / `BENCH_ANTHROPIC_API_KEY`.
## Cross-references
ADR-0002 §"Decision 1" / §"Riskiest assumption" · `cost-booster-edit/SKILL.md` (verification table consumes this skill's output) · `cost-report/SKILL.md` step 2 (reads `runs/latest.json`).
© ruvnet · MIT · ruvnet/ruflo