claudeers.
// Claude Skills

claude-code-routing

Spotify's 90% Claude Code routing setup, rebuilt for plain Claude Code and measured on 4 real tasks. A cheap model does the reading and the boilerplate.

// Claude Skills[ cli ][ api ][ mobile ][ claude ]#claude#anthropic#claude-code#hooks#skills◷ MIT$open-sourceupdated 21 days ago
Actively maintained
97/100
last commit 21 days ago
last release none
releases 0
open issues 0

Install with your AI

Paste into Claude Code, Cursor, or any agent — it reads the repo and wires the tool into your project.

Install and set up claude-code-routing (git-clone project) into my current project.
Found on https://claudeers.com/claude-code-routing
Repo: https://github.com/ToolMonsters/claude-code-routing
Homepage/docs: https://toolmonsters.github.io/claude-code-routing/
Detected install method: git-clone → git clone https://github.com/ToolMonsters/claude-code-routing
Category: skills. Platforms: cli, api, mobile.
Read the repo's README for exact setup and env vars, then install it and wire it into my project.

Claudeers Health Verdict:
active; community-verified: false. Confirm the source before running anything.
// or clone
git clone https://github.com/ToolMonsters/claude-code-routing

// compatibility

Platformscli, api, mobile
Operating systems—
AI compatibilityclaude
LicenseMIT
Pricingopen-source
LanguageHTML

Get your FREE $2.50 API credits to access TickAtlas financial data ↗

Claude Code Routing

A cheap model does the reading and the boilerplate. Claude keeps the thinking.

This is a plain Claude Code rebuild of the setup a Spotify product manager published in September 2026, Portal by Spotify cut my Claude Code token usage by 90%. Theirs runs on Portal and Gemini Flash. This one needs nothing but the claude CLI you already have, and uses Haiku.

Not affiliated with Spotify. I rebuilt it, then measured it. The numbers are below, including the ones that don't flatter it.

Page: https://toolmonsters.github.io/claude-code-routing/

What's inside

PieceWhat it does
bin/code-writeHaiku writes predictable code (tests, type stubs, config) from a spec plus a reference file, straight to disk. Claude never reads the reference or the output.
bin/bulk-readSends whole files to Haiku in one call and returns dense bullets with line numbers. The files never enter Claude's context.
hooks/block-big-reads.shPreToolUse hook. Stops any full read over 350 lines (Read, cat, head, tail, less, more) and points Claude to the two scripts. Targeted reads pass.
skills/code-write, skills/bulk-readTell Claude when and how to call the scripts.
benchmark/The 4 scenarios, the runner and the analysis, so you can reproduce every number.

Install

git clone https://github.com/ToolMonsters/claude-code-routing
cd claude-code-routing && ./install.sh

It copies the scripts, hook and skills into ~/.claude and adds the hook to ~/.claude/settings.json (a backup is written first). Restart Claude Code.

Settings: BLOCK_MIN_LINES (default 350) · CHEAP_MODEL (default haiku) · CLAUDE_BIN if claude is not on your PATH.

What I measured

Claude Code 2.1.270, Opus 5, on psf/requests. Four tasks, each run once without the setup and once with it. Total cost includes the Haiku calls. One run per cell, so treat small gaps as noise.

TaskWithoutWithResult
S1 Inventory of all 110 classes and functions across 3 files$0.75$0.71110/110 both. Neither run opened a file.
S2 Every raise and except in 2 files (1,155 + 625 lines)$0.74$0.85Same answer. Without: 2 full file reads. With: ranged reads instead.
S3 Write pytest tests matching a 3,094-line test file$0.96$1.22Worse. 17 tests → 11, 90s → 243s.
S4 Write a type stub for a 1,184-line module$0.82$0.5928% cheaper and better: 51 of 57 functions covered vs 42. 54s → 164s.

What that means

  • The hook never fired. Zero blocked reads across the 4 tasks. Without the setup, Claude read big files in full in 2 of 4 tasks. With it installed, Claude avoided full reads on its own (search, sed -n, ranged reads), so there was nothing left to block.
  • bulk-read was never called. Claude always found a cheaper path itself. On S2 the with-setup run cost more.
  • code-write is the part that pays, on boilerplate. On S4 Claude never opened the module, Haiku wrote the stub, and it came out cheaper and more complete. On S3, which needed judgment about an existing test style, it cost more and did worse.
  • Spotify's 90% measures file tokens that stop entering Claude's context. That is a real number. In these 4 tasks, the reading side barely moved the bill. The writing side is where the money was, and it costs time.

Known gaps

  • A ranged read (offset/limit) passes the hook regardless of size. In S2 Claude read 545 lines at once through that door.
  • The cheap model's cost is billed in separate claude -p calls, so it does not show in the session's /cost. The scripts print it to stderr.
  • Do not route debugging, architecture or anything subtle to the cheap model. Spotify found the same: their worker missed a thread-safety bug Claude caught in seconds.

Reproduce

benchmark/run.sh opus     # ~ $6-7, clones psf/requests into benchmark/work

Built by Yonathan Cohen · Tool Monsters · [email protected]

// faq

What is claude-code-routing?

Spotify's 90% Claude Code routing setup, rebuilt for plain Claude Code and measured on 4 real tasks. A cheap model does the reading and the boilerplate.. It is open-source on GitHub.

Is claude-code-routing free to use?

claude-code-routing is open-source under the MIT license, so it is free to use.

What category does claude-code-routing belong to?

claude-code-routing is listed under skills in the Claudeers registry of Claude-compatible tools.

7 views
★ 24 stars
unclaimed
updated 21 days ago

// embed badge

claude-code-routing on Claudeers
[![Claudeers](https://claudeers.com/api/badge/claude-code-routing.svg)](https://claudeers.com/claude-code-routing)

// retro hit counter

claude-code-routing hit counter
[![Hits](https://claudeers.com/api/counter/claude-code-routing.svg)](https://claudeers.com/claude-code-routing)

// reviews

// guestbook

0/500

// related in Claude Skills

🔓

An agentic skills framework & software development methodology that works.

// skillsobra/⟨Shell⟩★ 292,190◷ MIT[ claude ]
🔓

Public repository for Agent Skills

// skillsanthropics/⟨Python⟩★ 178,324[ claude ]
🔓

💫 Toolkit to help you get started with Spec-Driven Development

// skillsgithub/⟨Python⟩★ 138,919◷ MIT[ claude ]
🔓

AI coding assistant skill (Claude Code, Codex, OpenCode, Cursor, Gemini CLI, and more). Turn any folder of code, SQL schemas, R scripts, shell scripts, docs,…

// skillsGraphify-Labs/⟨Python⟩★ 123,800◷ MIT[ claude ]
→ see how claude-code-routing connects across the ecosystem