Agent skill
cost-tracker
Track session costs, set budget alerts, and optimize token spend. Use to check costs mid-session or set spending limits.
Install this agent skill to your Project
npx add-skill https://github.com/rohitg00/pro-workflow/tree/main/skills/cost-tracker
SKILL.md
Cost Tracker
Monitor and optimize Claude Code session costs.
Trigger
Use when:
- Checking session costs
- Setting budget alerts
- Optimizing token spend
- Planning multi-session work
Cost Awareness
Check Current Costs
# Session cost is shown at the end of each session
# Mid-session: check the status bar or run /cost
Cost Drivers
| Operation | Relative Cost | Optimization |
|---|---|---|
| Large file reads | High | Use offset/limit params |
| Broad grep searches | Medium | Scope to specific dirs |
| Subagent spawning | High (new context) | Reuse agents via SendMessage |
| Repeated tool calls | Cumulative | Batch operations |
| MCP tool calls | Variable | Minimize round-trips |
| Model selection | 3-10x difference | Use haiku for simple tasks |
Token Budget by Task Type
| Task | Typical Cost | Budget Alert |
|---|---|---|
| Bug fix | $0.10-0.50 | $1.00 |
| Feature (small) | $0.50-2.00 | $3.00 |
| Feature (large) | $2.00-8.00 | $10.00 |
| Refactor | $1.00-5.00 | $7.00 |
| Code review | $0.20-1.00 | $2.00 |
Optimization Strategies
- Scope prompts tightly — "Fix the auth bug in src/auth/login.ts" vs "Fix the auth bug"
- Use the right model — Haiku for simple lookups, Sonnet for features, Opus for architecture
- Delegate to subagents — Search/explore operations in subagents keep main context lean
- Compact proactively — Don't wait for auto-compact; compact at task boundaries
- Read selectively — Use
offsetandlimitparams for large files - Batch operations — Multiple independent tool calls in one message
Budget Alerts
Set mental checkpoints:
- 50% budget — Are you on track? Should you compact?
- 80% budget — Wrap up current task, avoid new exploration
- 100% budget — Commit what you have, start fresh session
Output
COST TRACKER
Session cost: $X.XX
Token usage: [input]K in / [output]K out
Cache hit rate: ~XX%
Top cost drivers:
1. [operation] — $X.XX
2. [operation] — $X.XX
Optimization tips:
- [specific suggestion]
Rules
- Track costs as awareness, not hard limits
- Never sacrifice code quality to save tokens
- Compact at task boundaries, not mid-task
- Use subagents for exploration-heavy work
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
auto-setup
Auto-configure quality gates, hooks, and settings for a new project. Detects project type and sets up appropriate tooling. Use when onboarding a new codebase.
agent-teams
Coordinate multiple Claude Code sessions as a team — lead + teammates with shared task lists, mailbox messaging, and file-lock claiming. Patterns for team sizing, task decomposition, and when to use teams vs sub-agents vs worktrees.
permission-tuner
Analyze permission denial patterns and generate optimized alwaysAllow and alwaysDeny rules. Use when permission prompts are slowing you down or after sessions with many denials.
wrap-up
End-of-session ritual that audits changes, runs quality checks, captures learnings, and produces a session summary. Use when saying "wrap up", "done for the day", "finish coding", or ending a coding session.
file-watcher
Configure file watching hooks to auto-react to config changes, env file updates, and dependency modifications. Use to set up reactive workflows.
compact-guard
Smart context compaction with state preservation. Saves critical files, task progress, and working state before compaction, restores after. Use before manual compact or when auto-compact triggers.
Didn't find tool you were looking for?