optimization-suggest — Claude Code skill: session analysis and setup
This skill reviews Claude Code session history and ranks ways to cut costs, improve speed, and prevent errors. Use it to plan changes based on recorded activity.
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a claude-codeWhat optimization-suggest does
The skill retrieves session history, tool and token analytics, cost data, and pricing rules from http://localhost:4820. It looks for chances to use a less expensive model, improve caching, split large tasks, and add verification. It also examines recurring errors, unreliable tools, and work that could run in parallel.
Recommendations are ranked by priority and include estimated impact, effort, and confidence. The five highest-ranked items get an implementation guide and before-and-after metrics. Choose a broad scan or focus on cost, speed, quality, or workflow efficiency. The service at localhost:4820 must be reachable; without it, the skill cannot retrieve session data.
What it helps with
- spot sessions where a cheaper model could handle the task
- find work that should be split or run in parallel
- identify recurring errors and tools with high failure rates
- plan changes to caching and result verification
Example prompts for the agent
- Review all my sessions and rank the best optimization actions.
- Look for ways to reduce model costs using my session history.
- Find recurring errors and suggest changes to prevent them.
How to install optimization-suggest
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a claude-code2Manually: put the files in place
~/.claude/skills/optimization-suggest/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/optimization-suggest/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a codex2Manually: put the files in place
.agents/skills/optimization-suggest/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a cursor2Manually: put the files in place
.cursor/skills/optimization-suggest/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install hoangsonww/Claude-Code-Agent-Monitor optimization-suggest2Manually: put the files in place
.github/skills/optimization-suggest/SKILL.md1Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a gemini-cli2Platform CLI
gemini skills install https://github.com/hoangsonww/Claude-Code-Agent-Monitor --path plugins/ccam-insights/skills/optimization-suggestManually: put the files in place
.devin/skills/optimization-suggest/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about optimization-suggest
How do I install optimization-suggest in Claude Code?
Run npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a claude-code. The skill file is at ~/.claude/skills/optimization-suggest/SKILL.md.
What does optimization-suggest do?
It analyzes past Claude Code sessions and ranks recommendations for cost, speed, quality, and workflow improvements.
What does the skill need to run?
It fetches session history, analytics, cost information, and pricing rules from http://localhost:4820, so that service must be reachable.
Source text
SKILL.md · MIT
---
name: optimization-suggest
description: >
Suggest concrete optimizations for Claude Code usage based on historical
session data. Covers cost reduction, speed improvement, error prevention,
and workflow efficiency. Use for data-driven optimization planning.
---
# Optimization Suggest
Generate data-driven optimization recommendations for Claude Code usage.
## Input
The user provides: **$ARGUMENTS**
This may be:
- "all" or empty (default: comprehensive optimization scan)
- "cost" for cost reduction focus
- "speed" for performance/speed focus
- "quality" for error reduction focus
- "efficiency" for workflow efficiency focus
## Procedure
1. **Gather optimization data** from `http://localhost:4820`:
- `GET /api/sessions?limit=200` — session history
- `GET /api/analytics` — tool and token analytics
- `GET /api/pricing/cost` — cost data
- `GET /api/pricing` — pricing rules for model comparison
- Sample event streams for behavioral analysis
2. **Analyze optimization opportunities**:
### 💰 Cost Optimization
- **Model downgrade opportunities**: Tasks completed with expensive models that could use cheaper ones
- Compare success rates per model per task type
- Calculate savings from model substitution
- **Cache optimization**: Sessions with low cache hit rates
- Identify sessions that could benefit from better prompt caching
- **Early termination**: Sessions that ran longer than needed
- Detect sessions where useful work completed well before session end
- **Compaction reduction**: Sessions hitting context limits
- Suggest breaking large tasks into smaller sessions
### ⚡ Speed Optimization
- **Tool selection**: Faster alternatives for commonly-used tool patterns
- **Subagent parallelization**: Tasks that could run in parallel
- **Session planning**: Better upfront context to reduce back-and-forth
- **Preemptive context loading**: Frequently needed files/context
### 🛡 Quality Optimization
- **Error prevention**: Common error patterns with preventive measures
- **Tool reliability**: Tools with high failure rates and alternatives
- **Validation gaps**: Sessions lacking verification steps
- **Recovery strategies**: Better error handling patterns
### 🔄 Workflow Optimization
- **Session sizing**: Optimal session scope based on historical success
- **Task decomposition**: Complex sessions that should be split
- **Automation candidates**: Repetitive workflows to automate
- **Knowledge reuse**: Patterns where previous session context could help
3. **Quantify each recommendation**:
- Estimated impact (cost savings $, time savings %, error reduction %)
- Implementation effort (low/medium/high)
- Confidence level based on data available
- Priority score = Impact × Confidence / Effort
## Output Format
Present as a prioritized optimization plan:
| # | Recommendation | Category | Impact | Effort | Priority |
|---|---------------|----------|--------|--------|----------|
| 1 | Specific action | 💰/⚡/🛡/🔄 | High | Low | ★★★★★ |
| 2 | Specific action | ... | ... | ... | ★★★★☆ |
For the top 5 recommendations, include:
- Detailed explanation with supporting data
- Step-by-step implementation guide
- Expected before/after metrics
- How to measure success
© hoangsonww · MIT · hoangsonww/Claude-Code-Agent-Monitor