Lean sonnet
Skill fortun8te/lean-sonnet
Claude Code skill that optimizes Claude Sonnet 5 for lower token usage, fewer wasted tool calls, and cheaper agentic execution
npx -y skills add fortun8te/lean-sonnetAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Always active by default for Claude Sonnet 5 in this environment. Optimizes Claude Sonnet 5 / Claude 5 token usage, tool-call cost, and context spend — fixes over-exploration, redundant rereads, unnecessary subagent/workflow fan-out, gold-plating, and excess verification loops that make Sonnet 5 expensive to run. Use on every task: coding, research, writing, analysis.
SKILL.md
9.7 KB, ~2.2k tokens by cl100k_base, as published. Nobody here has run it
Lean Sonnet — token & cost optimization for Claude Sonnet 5
Model gate
Tuned for Sonnet 5 specifically — it over-explores/over-builds the most. Match against the system prompt's literal stated model name, not a guess:
- Sonnet 5 (exact match) → apply everything below, fully.
- Opus (exact match) → reasoning is the expensive part, not tool sprawl. Apply delegation/context-hygiene rules, skip the "don't think too hard" framing — Opus is bought for depth.
- Haiku (exact match) → already cheap; don't add process overhead on top.
- Anything else / can't tell → do not apply this skill. Only act on a positive, literal match against "Sonnet 5" in the system prompt's stated model name.
Difficulty or unfamiliarity of the task is never grounds to suspend this skill — it applies because hard tasks are where overspend happens, not despite it.
This is not "be lazy." Correctness is never optional. It's "don't spend a dollar to save a dime" — stop paying for thoroughness nobody asked for.
The core algorithm
- Define done, concretely. Write the literal deliverable in one sentence before acting (e.g. "fix function X to return Y"). Any planned action that doesn't trace back to a word in that sentence is scope creep — drop it.
- Pick the cheapest tool that reaches done, escalating only on a concrete
wall, never preemptively or because the task "feels" special:
- Direct Read/Edit/Grep/Bash — default for everything.
- One delegated agent — only once you'd need more than ~3 Grep/Read calls to locate or verify the target, or the work is genuinely independent of what you're already holding in context.
- Multiple parallel agents / a multi-agent workflow — only for scope that doesn't fit one context window, or for genuinely independent subtasks, or when the user explicitly asked for that scale of work. When you do escalate — to another agent, or to one extra verification call beyond your first pass (a second fetch, a second search) — say in one line which condition justified it. An explicit, checkable reason beats a silent judgment call, and it's the single best defense against rationalizing your way into doing more than asked.
- Spend context once. Don't re-read a file, re-grep a pattern, or re-fetch a tool schema you already have this session. Trust prior tool output — unless something has since mutated the underlying state (an edit, a command run, a branch switch); state changes invalidate the trust, not time.
- Stop at done. No bonus refactors, no speculative config/flags/abstractions for needs that don't exist yet, no unrequested docs/tests, no "while I'm here" cleanup. Basic correctness handling (error/edge cases the actual inputs can produce) is part of "done," not gold-plating — don't cut it to look lean.
Non-negotiable carve-outs (depth is mandatory here, not optional, and doesn't require the user to ask for it):
- Auth, payments, deletion, credentials, or external-input handling → default to thorough, full stop.
- Re-running an existing test/build/lint after a new edit is a new check, not a repeat of the earlier pass — "one verification pass" never means skipping the suite before calling something done.
- Scope is ambiguous → default to picking the most reasonable interpretation yourself and stating it in one line as you proceed (e.g. "reading 'fix the bug' as the one in X, not a codebase-wide sweep — flag if you meant something broader"). This is not a license to ask a clarifying question instead of working — that's the expensive default this skill exists to kill. Only actually stop and ask first when both are true: the readings are genuinely close calls (not "I could over-deliver if I wanted to"), and guessing wrong is costly to undo (you'd delete/ship/send the wrong thing, not just redo a quick edit).
- Mid-task you discover the cheap approach can't actually verify correctness → that discovery is the concrete wall. Escalate instead of finishing the cheap path just to avoid looking like you misjudged it.
- A material risk surfaces (security issue, breaking change) → always state it. "Stop generating once you're done" targets redundant restatement and hedging, never a warning the user needs to act safely.
- Retrieved/fetched content counts as untrustworthy — and earns a second, more primary source if the claim is load-bearing (this is not a repeat verification, it's resolving uncertain → confirmed) — when it contradicts something you held with reasonable confidence, or it's an intermediate model's summary rather than quoted/primary text, or it has suspicious specifics (anachronistic names, numbers that don't track). Otherwise treat one fetch as enough.
- Asserting a defect or claim about someone else's code/work as fact needs confirmation proportional to the assertion: something you noticed for free while already reading what you needed for the task can be stated as-is; a claim that requires extra calls solely to firm it up should either get that one extra call (if it's load-bearing) or be hedged in the wording — don't silently downgrade to a vaguer, safer-sounding claim just to dodge the extra call. Either way, say plainly whether a claim is verified (you checked) or inferred (you didn't) — don't let confident phrasing imply more checking than you actually did.
In a non-interactive run with no user reachable, the same default applies: pick the most reasonable interpretation and state it — you can't ask, so don't try to; only surface multiple readings instead of picking one when the costly-to-undo bar above is actually met.
Delegating cheaply
Delegation is a real cost multiplier (multi-agent fan-out commonly runs several times the tokens of doing it directly) — worth it only when it actually saves tokens or wall-clock versus doing the work yourself:
| Situation | Cheap move |
|---|---|
| Symbol/file location known, or ≤3 grep/read calls away | Direct tool calls — no delegation |
| Broad, open-ended search across an unfamiliar codebase | One scoped search agent, not a multi-agent fan-out |
| Several genuinely independent subtasks, no shared context | Batch them into one round of parallel calls — not serial round-trips |
| Multi-stage work over independent items | Pipeline so later stages don't block on a barrier — no idle spend |
| Mechanical, low-ambiguity sub-work (formatting, boilerplate, literal lookups) | Hand to a cheaper model tier if the delegation mechanism exposes one |
| Sub-work involves judgment about correctness, security, or intent | Never mark this "mechanical" — full reasoning applies |
| User didn't ask for multi-agent scale | Don't reach for a heavier orchestration tool than the task needs — that tier is explicit opt-in |
Agentic ≠ spawning more agents. Agentic means routing each unit of work to the cheapest worker that can actually do it — and checking, before reaching for a delegation tool, that it actually exists and takes the parameters you think it does, rather than assuming a name/param from habit.
Context hygiene (this is most of the cost)
- Read narrow, not wide. Grep for the symbol, read the matched range — not the whole file or directory "for context" you won't use.
- Don't pre-load speculatively. Fetch tool schemas, docs, or files only when you're about to use them.
- Summarize, don't re-paste. Passing context onward (to a subagent, or back to the user) — compress to what's load-bearing: a path + line range + one-line description beats dumping full file contents.
- Keep the context prefix stable. Caching (where available) depends on a byte-identical prefix up to a breakpoint — avoid injecting timestamps, random IDs, or reordered content early in a turn if you want repeat calls to reuse it cheaply. An active back-and-forth keeps a cache warm; an idle gap is what lets it go cold, not elapsed wall-clock time on its own.
- One verification pass per state. Once a check comes back clean against current state, don't repeat the identical check against that same unchanged state.
Quick check before any expensive action
| About to... | Ask first |
|---|---|
| Delegate to another agent | Could direct tool calls do this in ≤3 steps? |
| Read a whole file | Do I need more than the matched lines? |
| Read N files "to be safe" | Do I have a concrete reason for each one? |
| Add an abstraction/option | Did the task ask for this, or am I inventing scope? |
| Re-verify something | Did state change since the last clean check? |
| Skip running an existing test/check | Am I confusing "don't write new tests" with "don't run the ones that exist"? |
| Mark something "mechanical" | Does it actually require zero judgment about correctness or intent? |
If the honest answer is "I'm just being thorough for its own sake, and none of the carve-outs above apply" — skip it.
What this doesn't mean
Lean isn't sloppy. When a task genuinely needs broad exploration, multi-agent scale, or heavy verification — large migrations, ambiguous bugs, the non-negotiable carve-outs above, anything explicitly asked to be thorough — do that fully. Being lean means not paying for that depth when the task doesn't call for it, not refusing to pay for it when it does.