Skip to content
Guardrails (Token-Lean) cover
Dev WorkflowFree · MIT

Guardrails (Token-Lean)

Estimate the token bill before you spend it — right-size fan-out, model tier, and reads to the task, then stop once the returns flatten.

v1.0.0 · ~731 tokens · ⬇ 0 · Updated July 6, 2026

What it does

Token-budget discipline for agentic work: estimate the cost of an approach (agent fan-out, large file/DB reads, retry loops) before committing to it, match model tier to the sub-task, prefer targeted reads (grep, offset/limit, filtered queries) over full dumps, set explicit caps (files sampled, retries, exploration budget), and stop once extra spend stops surfacing anything new. Reports the planned token budget up front and the actual spend against it.

Example uses

Cap a batch job's spend before it starts

You're about to fan out across many files or spawn several agents and want the cost estimated and capped before it starts.

We need to check about 60 tool pages for a broken pricing format. Keep token usage down: estimate the cost of checking all 60 individually first, and if that's expensive, sample 10 and extrapolate instead — tell me the estimated budget before you start, not after.

Ask for the cheapest reliable way

You want a specific task done as cheaply as possible in tokens, not exhaustively.

What's the cheapest way to find every place we still call the old pricing API in this repo? I don't need a full audit of every file — use grep across the codebase instead of reading each file, and give me the token budget you're planning before you run it.

Stop a runaway retry loop

Something mid-task is burning tokens on failed retries or repeated exploration with no new information.

This scraper keeps failing and retrying — it's burning tokens. Cap it at 3 attempts, and if it's still failing after that, stop and report the error instead of continuing to retry.

Install

# 1. Create the skill folder in your Claude setup
mkdir -p ~/.claude/skills/guardrails-token-lean

# 2. Download SKILL.md into it (or move the file you just downloaded)
#    → ~/.claude/skills/guardrails-token-lean/SKILL.md

# 3. Claude Code auto-discovers it on next launch.

Inside the skill

SKILL.md
---
name: guardrails-token-lean
description: Estimate the token cost of an approach before committing to it, size it to what the task needs, and stop once extra spend stops paying off. Use when the user says "keep token usage down", "this is burning tokens", "what's the cheapest way to do this", "token budget", "don't blow the budget on this" — or before any agent fan-out, large file/DB dump into context, or open-ended retry loop.
---

# Guardrails (Token-Lean)

Token spend is a decision made before the first call, not a cleanup done after. Estimate
the bill an approach will run, size it to what the task actually needs, and stop once extra
spend stops buying anything new.

## Estimate before you commit

- Fan-out (N agents, N parallel searches, N file reads) costs roughly N × cost-per-unit.
  Do that multiplication before launching it, not after the bill is in.
- About to pull a big file, a full DB table, or a long log into context? Estimate its size
  first (line count, row count, rough chars ÷ 4) — that decides whole-read vs. narrow-read.
- About to retry something that might fail again? Estimate retries × cost-per-attempt and
  set the cap before the first attempt, not after the third failure.

## Size the approach to the task

- Match model tier to the sub-task: cheap/fast tier for filtered extraction, formatting, or
  well-specified mechanical work; top tier reserved for the step that actually needs the
  reasoning. Don't default every step to the most expensive tier.
- Read narrow: offset/limit on the lines you need, grep for the exact symbol/string, a
  filtered query for the rows that matter — not the whole file, the whole tree, or `select *`.
- Batch what can be batched. One query for N rows beats N queries; one message with N
  independent calls beats N round-trips.

## Set the cap up front

- Fan-out ceiling — e.g. "more than 20 files → sample a representative handful and report
  the rest by pattern," not process all 20 individually.
- Retry ceiling — a fixed max (e.g. 3 attempts), then stop and report, not open-ended retry.
- Read ceiling — a rough total-lines/tokens budget for exploration before switching from
  "look around" to "read exactly this."

## Stop when returns flatten

- Each extra agent, search, or retry should still surface something new. When the last
  couple came back empty or just repeated what you already had, the next one will too —
  stop there.
- A restated result is not a second data point.
- "Good enough to answer the question" beats "exhaustive" unless exhaustive was the ask.

## Output

State the planned spend before non-trivial work (roughly how many agents/reads/calls, at
what tier). When reporting back, state what was actually spent against that plan — and why,
if it diverged.

## The rule

Every fan-out, every full-file read, every retry loop is a bill picked before it's spent.
Estimate it, cap it, stop once the returns flatten.

Changelog

  • v1.0.02026-07-03Initial clean-room write.

Frequently asked questions

Is Guardrails (Token-Lean) free?

Yes. Guardrails (Token-Lean) is free to download and MIT-licensed.

Where do I install Guardrails (Token-Lean)?

Place the SKILL.md file in ~/.claude/skills/guardrails-token-lean/ and Claude Code auto-discovers it on next launch.

How many tokens does Guardrails (Token-Lean) use?

About 731 tokens — it is designed to be token-lean.

Anthony M. — Founder & Lead Reviewer
Anthony M.Verified Builder

We're developers and SaaS builders who use these tools daily in production. Every review comes from hands-on experience building real products — DealPropFirm, ThePlanetIndicator, PropFirmsCodes, and many more. We don't just review tools — we build and ship with them every day.

Written and tested by developers who build with these tools daily.