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 ApexIQ/skillsmith --skill harness_optimizergit clone --depth 1 https://github.com/ApexIQ/skillsmithWrote 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/apexiq/skillsmith/harness_optimizer)<a href="https://agentmods.dev/skills/apexiq/skillsmith/harness_optimizer"><img src="https://agentmods.dev/badge/skills/apexiq/skillsmith/harness_optimizer.svg" alt="Measured on agentmods" height="20"></a>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.00039 | $0.01902 |
| Opus 5 | $0.00019 | $0.00951 |
| Sonnet 5 | $0.00008 | $0.00380 |
| Haiku 4.5 | $0.00004 | $0.00190 |
Grade A, and why
harness-optimizer scanned grade A with 0 findings 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 7d 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 228 lines — stays where its author put it; the contents beside it link to each section on GitHub.
⚡ Harness Optimizer — Tune Your Agent for Peak Performance
Philosophy: The best agent configuration is the one that ships the most correct code per dollar spent. Optimize for outcome-per-token, not raw capability.
1. When to Use This Skill
- Agent token costs are too high
- Agent is hitting context window limits
- Agent performance is inconsistent or degrading
- Switching between models for different tasks
- Setting up a new project's agent configuration
- Debugging why agent quality has dropped
2. Token Cost Optimization
The Token Budget Framework
| Task Type | Recommended Model | Context Budget | Target Cost |
|---|---|---|---|
| Simple code edits | Fast/small model | 8K tokens | $0.01-0.05 |
| Code review | Medium model | 16K tokens | $0.05-0.20 |
| Architecture design | Best available model | 32K tokens | $0.20-1.00 |
| Complex debugging | Best available model | 64K tokens | $0.50-2.00 |
| Documentation | Medium model | 16K tokens | $0.05-0.15 |
| Test generation | Medium model | 32K tokens | $0.10-0.30 |
Cost Reduction Strategies
Strategy 1: Tiered Model Routing
# Route tasks to the cheapest model that can handle them
routing:
simple_edits:
model: claude-3-haiku # Cheapest
max_tokens: 4096
code_review:
model: claude-3.5-sonnet # Mid-tier
max_tokens: 8192
architecture:
model: claude-3.5-opus # Premium — only when needed
max_tokens: 16384
Strategy 2: Context Compression
## Before (wasteful — 2000 tokens)
Here is the entire file contents of user_service.py:
[... 200 lines of code ...]
Please fix the bug on line 45.
## After (efficient — 400 tokens)
In user_service.py, the `create_user` method (lines 40-55):
```python
def create_user(self, data):
# BUG: missing email validation
user = User(**data)
self.db.save(user)
Fix: add email validation before line 43.
#### Strategy 3: Result Caching
```python
# Cache expensive operations
# Don't re-analyze unchanged files
cache = load_cache(".agent/context/recall_cache.json")
if file_hash == cache.get(file_path, {}).get("hash"):
# File hasn't changed — reuse previous analysis
return cache[file_path]["result"]
else:
# File changed — re-analyze
result = analyze(file_path)
cache[file_path] = {"hash": file_hash, "result": result}
save_cache(cache)
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.
- 7d ago First seen · 228 lines · 39 tokens per session scan A caaf80fc2ee7
harness-optimizer is a skill published in the GitHub repository ApexIQ/skillsmith (5 stars, last pushed 5mo ago), licensed MIT. It adds 39 tokens to every session and 1,902 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other skills, from other repositories
prompt-engineering
Prompt engineering patterns for Claude including system prompts, few-shot examples, chain-of-thought, structured output, templates, and prefilling. Use when the user is writing prompts, designing system instructions, extracting structured data, building prompt templates, or optimizing Claude responses for quality and…
token-diet
Production-ready token optimization: reduce costs 40–75% through retrieval pruning, smart caching, and model routing. Use whenever optimizing API costs, latency, or managing long context—especially for RAG pipelines, high-volume systems, multi-turn conversations, or when context exceeds 2K tokens.
chain-of-thought-prompts
Chain-of-thought and step-by-step reasoning prompts for complex problem solving.
few-shot-example-gen
Few-shot example generation and optimization for improved LLM performance.
llm-classifier
LLM-based zero-shot and few-shot classification for flexible intent detection.
software-ai-integration
Applies production AI integration patterns for chat, structured output, guardrails, provider routing, and AI UX. Use when adding LLM-powered features to an application.