A repeatable pattern for reducing the cost of Claude Code skills by 90-95%. Works for any agentic workflow where the frontier model is doing mechanical work that doesn't require frontier-level reasoning.
When you build a skill (slash command) for Claude Code, the frontier model handles everything: parsing files, constructing shell commands, making API calls, formatting output. Most of this is deterministic work that doesn't need intelligence — you're paying $0.50-1.00 per run for what a Python script could do for free.
| Mechanical (script it — free) | Needs some intelligence (Haiku — cheap) | Needs frontier reasoning (keep Opus) |
|---|---|---|
| Parsing structured files | Web research / data extraction | Writing personalized content |
| String formatting / templating | Classification / filtering with judgment | Complex multi-step planning |
| File I/O, status updates | CRUD operations with conditional logic | Novel problem-solving |
| URL construction, API calls with known params | Summarization | Ambiguous user intent |
| Regex extraction |
- No external dependencies if possible (stdlib only)
- CLI arguments with
argparse— batch number, count, flags -
--dry-runflag — parse and preview without side effects - JSON output file (
/tmp/<skill>-pending.json) for downstream AI steps - Human-readable stdout — summary tables, skip warnings, confirmation prompts
- Edge case handling — missing fields, already-processed entries, malformed input
- Idempotent updates — safe to re-run if interrupted
- Give complete context — the agent can't ask clarifying questions
- One clear task — search, create, log (not "figure out what to do")
- Structured input/output — JSON in, one-line status reports out
- Parallel, not sequential — launch all agents in one message
- Batch size — 5-7 items per agent
Step 1 Run script (Python — parse, transform, act) FREE
Step 2 AI follow-up (Haiku agents in parallel — API work) ~$0.02
Step 3 Clean up (delete temp files) FREE
Opus reads batch markdown file → parses with regex knowledge
Opus constructs AppleScript per email → string templating
Opus shows email to user → formatting
Opus waits for "sent" → flow control
Opus uses Edit tool 7 times → find-and-replace
Opus calls CRM search 7 times → API calls
Opus calls CRM create 7 times → API calls
Opus calls CRM log 7 times → API calls
21 tool calls, all Opus. ~$0.50-1.00.
Opus runs: python3 scripts/send-outreach.py --batch 9 --next 10
└─ Script parses, opens Mail, confirms, updates statuses (free)
└─ Script writes /tmp/outreach-crm-pending.json (free)
Opus reads JSON, spawns 2 Haiku agents for CRM logging (~$0.02)
Opus cleans up temp file (free)
3 Opus tool calls + 2 Haiku agents. ~$0.02-0.05.
- One-off tasks — if you run it once a month, the cost doesn't matter
- Tasks that are mostly creative — writing, strategy, novel debugging
- Tasks where the AI's judgment IS the value — code review, content evaluation
- Prototype phase — get it working first, optimize after the workflow stabilizes