Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add hoangsonww/Claude-Code-Agent-Monitor --skill optimization-suggest -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/optimization-suggest/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/optimization-suggest/

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

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set60

alert-management Inspects fired CCAM alerts and manages monitoring rules for token thresholds, inactivity, and status duration. CX Codex +1 ★ 1,121repo stars session-compare Compare two Agent Monitor sessions across cost, tokens, events, and agent activity. Use it to see what changed between runs with different outcomes. CX Codex +1 ★ 1,121repo stars regression-watch Compares an older baseline window of session history with a recent one and reports which metrics got worse: errors, cache, compactions, cost per session. CX Codex +1 ★ 1,121repo stars pattern-detect Analyzes agent sessions via Agent Monitor to find recurring tool sequences, error cascades, and delegation habits. Generates a ranked report with recommendations. CX Codex +1 ★ 1,121repo stars benchmark The benchmark skill takes one session or a few recent ones and compares them with the rolling average from Agent Monitor data: cost, tokens, tool count and workflow complexity. Each metric comes back as a percentile of the population. CX Codex +1 ★ 1,121repo stars anomaly-alert Flags anomalous Claude Code sessions by checking spending spikes and tool execution errors via local Agent Monitor. CX Codex +1 ★ 1,121repo stars transcript-grep Search a session’s conversation for text or a regex and inspect each hit in context. Handy when you need to track down a prompt, tool call, or error. CX Codex +1 ★ 1,121repo stars session-debug Pulls a single Claude session out of Agent Monitor and reports its event chain, subagent tree, token spend and failures. CX Codex +1 ★ 1,121repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor