.claude/skills/autonomous-cost-optimizer/SKILL.md
Token and cost optimization for autonomous coding. Use when tracking token usage, optimizing API costs, managing budgets, or improving efficiency.
npx skillsauth add adaptationio/skrillz autonomous-cost-optimizerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Tracks and optimizes token usage and API costs during autonomous coding.
from scripts.cost_optimizer import CostOptimizer
optimizer = CostOptimizer(project_dir)
optimizer.track_usage(input_tokens=1500, output_tokens=500)
report = optimizer.get_usage_report()
print(f"Total cost: ${report.total_cost:.4f}")
if optimizer.is_within_budget(budget=10.00):
# Continue working
pass
else:
# Trigger cost-saving measures
await optimizer.enter_efficiency_mode()
┌─────────────────────────────────────────────────────────────┐
│ COST OPTIMIZATION │
├─────────────────────────────────────────────────────────────┤
│ │
│ TRACK │
│ ├─ Monitor token usage per request │
│ ├─ Calculate cost per feature │
│ ├─ Track cumulative session cost │
│ └─ Log usage to history │
│ │
│ ANALYZE │
│ ├─ Identify high-cost operations │
│ ├─ Compare efficiency across features │
│ ├─ Detect wasteful patterns │
│ └─ Calculate ROI per feature │
│ │
│ OPTIMIZE │
│ ├─ Compact context when approaching limits │
│ ├─ Cache repeated queries │
│ ├─ Batch similar operations │
│ └─ Prioritize high-ROI features │
│ │
│ REPORT │
│ ├─ Generate cost breakdown │
│ ├─ Show efficiency metrics │
│ └─ Recommend optimizations │
│ │
└─────────────────────────────────────────────────────────────┘
| Model | Input (per 1M) | Output (per 1M) | |-------|----------------|-----------------| | Claude 3.5 Sonnet | $3.00 | $15.00 | | Claude 3 Opus | $15.00 | $75.00 | | Claude 3 Haiku | $0.25 | $1.25 |
@dataclass
class EfficiencyMetrics:
tokens_per_feature: float
cost_per_feature: float
features_per_dollar: float
context_utilization: float
cache_hit_rate: float
| Strategy | Savings | Trade-off | |----------|---------|-----------| | Context compaction | 20-40% | Slight context loss | | Response caching | 30-50% | Storage needed | | Batch operations | 15-25% | Higher latency | | Model selection | 50-90% | Capability reduction |
references/PRICING-GUIDE.md - Cost calculationsreferences/OPTIMIZATION-STRATEGIES.md - Strategiesscripts/cost_optimizer.py - Core optimizerscripts/usage_tracker.py - Track token usagescripts/budget_manager.py - Budget enforcementscripts/efficiency_analyzer.py - Analyze efficiencydevelopment
Setup secure web-based terminal access to WSL2 from mobile/tablet via ttyd + ngrok/Cloudflare/Tailscale. One-command install, start, stop, status. Use when you need remote terminal access, web terminal, browser-based shell, or mobile access to WSL2 environment.
development
Complete development workflows where Claude writes the code while Gemini and Codex provide research, planning, reviews, and different perspectives. Claude remains the main developer. Use for complex projects requiring expert planning and multi-perspective reviews.
development
Systematic progress tracking for skill development. Manages task states (pending/in_progress/completed), updates in real-time, reports progress, identifies blockers, and maintains momentum. Use when tracking skill development, coordinating work, or reporting progress.
testing
Comprehensive testing workflow orchestrating functional testing, example validation, integration testing, and usability assessment. Sequential workflow for complete skill testing from examples through scenarios to integration validation. Use when conducting thorough testing, pre-deployment validation, ensuring skill functionality, or comprehensive quality checks.