Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add khalilbenaz/claude-skills-collection --skill cost-optimizergit clone --depth 1 https://github.com/khalilbenaz/claude-skills-collectionWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/cost-optimizer)<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/cost-optimizer"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/cost-optimizer/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/khalilbenaz/claude-skills-collection/cost-optimizer"><img src="https://agentmods.dev/badge/skills/khalilbenaz/claude-skills-collection/cost-optimizer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 2 findings, up to medium
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- medium Data Exfiltration · line 186 Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
- medium Data Exfiltration · line 186 Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.Fix: Verify the destination URL is trusted and necessary. Remove or replace with documented APIs. Ensure no secrets, tokens, or PII are transmitted.
What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00093 | $0.02779 |
| Opus 5 | $0.00046 | $0.01389 |
| Sonnet 5 | $0.00019 | $0.00556 |
| Haiku 4.5 | $0.00009 | $0.00278 |
Grade A, and why
cost-optimizer scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl https://api.anthropic.com/v1/messages/batches \ How it starts
The opening of the file, as written. The whole thing — 282 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agent Cost Optimizer
Quand utiliser ce skill
Dès qu'un agent IA consomme trop de tokens, que la facture API dépasse le budget, ou qu'on cherche à passer en production à coût maîtrisé. S'applique aussi pour mettre en place des garde-fous préventifs avant le déploiement.
Workflow
Étape 1 — Audit baseline (ne rien optimiser sans mesure)
Objectif : identifier les 20 % de requêtes qui causent 80 % du coût.
# Structure minimale de log — ajouter à chaque appel LLM
import anthropic, time
client = anthropic.Anthropic()
def call_with_cost_log(messages, model, system=""):
t0 = time.time()
resp = client.messages.create(
model=model, max_tokens=1024,
system=system, messages=messages
)
cost = (
resp.usage.input_tokens * pricing[model]["in"] +
resp.usage.output_tokens * pricing[model]["out"]
)
print(f"[COST] model={model} in={resp.usage.input_tokens} "
f"out={resp.usage.output_tokens} cost_usd={cost:.5f} "
f"latency_ms={int((time.time()-t0)*1000)}")
return resp
Tarifs 2026 indicatifs (vérifier anthropic.com/pricing) :
| Modèle | Input / 1M tokens | Output / 1M tokens |
|---|---|---|
| claude-haiku-3-5 | $0.80 | $4.00 |
| claude-sonnet-4 | $3.00 | $15.00 |
| claude-opus-4 | $15.00 | $75.00 |
| gpt-4o-mini | $0.15 | $0.60 |
| gemini-2.0-flash | $0.10 | $0.40 |
Critère de décision : si le coût médian par requête > $0.02, optimiser en priorité. Si variance > 10×, le routing est le levier le plus impactant.
Étape 2 — Model routing (levier le plus rapide)
Router chaque tâche vers le modèle le moins cher capable de la traiter.
ROUTING_RULES = {
"simple": "claude-haiku-3-5", # classification, extraction, reformulation
"moderate": "claude-sonnet-4", # raisonnement, synthèse, code standard
"complex": "claude-opus-4", # architecture, décisions critiques, audit
}
def classify_task(prompt: str) -> str:
"""Classifier cheap (Haiku) pour décider du modèle à utiliser."""
resp = client.messages.create(
model="claude-haiku-3-5", max_tokens=10,
messages=[{"role": "user", "content":
f"Complexity of this task (simple/moderate/complex):\n{prompt[:300]}"}]
)
return resp.content[0].text.strip().lower()
def route(prompt: str):
level = classify_task(prompt)
return ROUTING_RULES.get(level, "claude-sonnet-4")
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 11d ago First seen · 282 lines · 93 tokens per session scan A a7e2f7606729
cost-optimizer is a skill published in the GitHub repository khalilbenaz/claude-skills-collection (22 stars, last pushed 17d ago), licensed MIT. It adds 93 tokens to every session and 2,779 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
api-patterns
API design: naming, versioning, pagination, idempotency, OpenAPI, error contracts and safe retries. Triggers: API design, REST, GraphQL, OpenAPI, Swagger, error response, HTTP status, rate limit.
csharp-patterns
C#/.NET: LINQ, async/await, DI, records, nullable refs, ASP.NET Core, EF Core, MediatR. Triggers: C#, .NET, dotnet, ASP.NET, EF Core, LINQ, record type, IServiceCollection.
java-patterns
Java: Spring Boot, CompletableFuture, records, sealed types, JPA/Hibernate, virtual threads. Triggers: Java, Spring, JPA, Hibernate, Maven, Gradle, virtual thread, sealed class.
explain
Explains code/architecture with Mermaid diagrams and sequence flows. Triggers: what does X do, how does Y work, explain code, sequence diagram.
common-sense-index-investing-bogle
Apply John Bogle index investing rules for low-cost funds, asset allocation, fees, taxes, ETFs, advisers, and buy-hold discipline.
medplum-rules
Medplum (FHIR healthcare) coding rules: style, patterns, security, testing. Triggers: medplum.config.mts, medplum.config.ts, FHIR, Medplum, Bot, Subscription, Questionnaire.