cost-guardrail
Skill13 starsChanged 27 days agoApache-2.0View on GitHub
LLM and cloud cost awareness — model tiering, token budgets, right-sizing, and when a cheaper model suffices. Trigger before finalising any architecture that calls LLMs, before scaling a workload, or when a cost estimate is needed.
In this repository26 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adk-expertSkill
- adversarial-gateSkill
- cloud-checkupSkill
- cloud-expertSkill
- cxo-oversightSkill
- delivery-orchestratorSkill
- domain-validatorSkill
- frontend-performance-auditSkill
- get-it-doneSkill
- github-managerSkill
- governance-guardrailSkill
- mcp-server-scaffoldSkill
- operating-model-bootstrapSkill
- plugin-submissionSkill
- product-ownerSkill
- pr-reviewerSkill
- release-managerSkill
- release-readinessSkill
- sitrepSkill
- spec-first-deliverySkill
- system-performance-guardrailSkill
- test-strategySkill
- the-architectSkill
- using-the-harnessSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 15
Before scaling a workload to higher volumes
- Distinctive: line 16
When a cost estimate is required for a feature or release
- Distinctive: line 17
When reviewing an architecture for unbounded cost vectors
- Distinctive: line 18
When choosing between model tiers for a given task
- Distinctive: line 39
Use the project's explicitly adopted routing mode.
- Distinctive: line 52
Use current published rates from your provider.
- Distinctive: line 56
Add rate limiting at the application layer
- Distinctive: line 57
Add a budget alert at the infrastructure layer
- Distinctive: line 58
Consider caching repeated calls with identical or near-identical inputs
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cost Guardrail
The most expensive model is the one running on every request when it does not need to.
LLM cost is not a finance problem — it is an architecture problem. The design determines the bill. This skill enforces cost-awareness as a first-class design constraint, not an afterthought.
When to use
- Designing any system that calls an LLM (directly or via an agent)
- Before scaling a workload to higher volumes
- When a cost estimate is required for a feature or release
- When reviewing an architecture for unbounded cost vectors
- When choosing between model tiers for a given task
Procedure
- Identify every LLM call in the system — list: which agent or component makes the call, the model tier used, the approximate input and output token counts, and the call frequency (per user action / per minute / per batch).
Apply the model tiering test — for each LLM call, ask:
- Does this task require deep reasoning, or is it classification / extraction / reformatting?
- Can the task be completed with a smaller or faster model?
- Is the model tier choice based on evidence (benchmark, A/B test) or assumption?
Starting hypotheses only (verify current pricing and qualify each task family before relying on them):
Task type Appropriate tier Simple classification, extraction, summarisation Small / fast model Complex reasoning, multi-step planning, code generation Mid-tier model Deep analysis, architecture decisions, adversarial review Highest-tier model A short ticket or one-file change does not qualify a cheap model. Require independent acceptance, preserve consequence floors, count failed attempts and bound escalation. Use the project's explicitly adopted routing mode; the routing guide is not automatic consumer activation. Model/effort changes require a fresh baseline.
- Identify unbounded cost vectors — flag any call pattern where the token count or call volume has no upper bound:
- Loops that call an LLM until a condition is met (with no max-iteration guard)
- User-triggered calls with no rate limiting
- Context windows that grow unboundedly across a conversation
- Batch jobs with no per-run budget ceiling
- Estimate the monthly cost envelope — for each LLM call:
Use current published rates from your provider. Do not use rates from training data — they change.estimated monthly cost ≈ ((input tokens/call × input price) + (output tokens/call × output price)) × calls/month - Add cost controls — for each unbounded vector:
- Set a max-token budget per call (trim context if needed)
- Add rate limiting at the application layer
- Add a budget alert at the infrastructure layer
- Consider caching repeated calls with identical or near-identical inputs
- Check for caching opportunities — LLM calls that return the same result for the same input are cacheable. Prompt caching (where supported by the provider) can reduce cost significantly on repeated prefixes.
- Document the cost model — in the ADR or design doc, record: model tiers chosen, rationale, estimated monthly cost at target scale, and the controls in place.
Outputs
For engineering-agent routing, use the task/effort matrix in
council.md. Declare requested and resolved
model, reasoning, bounded inputs, timeout, retry ceiling and acceptance test per
lane. Measure total time/known cost to accepted outcomes including review and rework;
unknown usage is not zero. Start with the smallest proven capable model, escalating
on observed failure or ambiguity while preserving the quality and independence floor.
- LLM call inventory: component | model tier | input tokens (est.) | output tokens (est.) | frequency | monthly cost (est.)
- Unbounded cost vectors flagged with mitigations
- Monthly cost estimate at target scale
- Recommended model tier per call with rationale
Guardrails
- Never use pricing from training data. Rates change. Fetch current rates from the provider's documentation before estimating.
- A call that "works" at low volume may be unaffordable at scale. Always estimate at the target scale, not the current scale.
- Caching is not optional for high-frequency repeated calls. An uncached LLM call repeated thousands of times per day is a design flaw.
- Token budgets are architecture decisions. Decide them explicitly; do not let the model decide by consuming whatever context is available.
Anti-rationalization table
| Excuse | Counter |
| "It's only a few cents per call" | At scale, cents become thousands of dollars. Estimate the monthly envelope. |
| "We'll optimise later" | Cost optimisation is hardest after the architecture is set. Do it now. |
| "The big model gives better results" | Verify with a test. Small models are often sufficient for structured tasks. |
| "We don't know the volume yet" | Estimate a range. A 10x cost swing between low and high volume is a design risk. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

