optimize-ai-setup skill
scriptsAudits local AI coding tools like Claude Code and Cursor to identify token waste and provide ranked fixes for optimizing usage and costs.
- GitHub stars
- 8
- Files
- 24
- Last commit
- Oct 28, 2026
- License
- MIT
- Allowed tools
- —
What does the optimize-ai-setup skill do?
optimize-ai-setup audits local AI coding tools like Claude Code and Cursor to identify token waste and provide ranked fixes for optimizing usage and costs.
Summary generated from the skill's SKILL.md.
About the optimize-ai-setup skill
Auditing local AI coding environments to reduce token waste and expenses is what this skill enables for developers using tools like Claude Code, Cursor, Codex, and Gemini CLI. It identifies specific causes of high costs, such as oversized context files, inefficient prompt-cache usage, or redundant MCP servers and plugins. An agent should load this skill when a user asks why their AI tools are consuming too many tokens or when they want to optimize their development setup for better cost-efficiency.
The process relies on a local Python script that measures session logs and configuration files to generate a compact report. This script focuses on numeric metrics and metadata, ensuring that message content and secrets remain private. Once the audit is complete, the skill produces a ranked list of fixes, ranging from configuration changes in files like .cursor/rules to habit recommendations like using the /compact command. It provides concrete actions, such as specific settings keys or commands, to help users manage their AI resource consumption without deleting essential tools.
What an agent can do with it
- 1Reduce Claude Code token usageAnalyze why Claude Code is burning through usage limits and identify ways to cut costs.
- 2Audit MCP server efficiencyCheck the current MCP server and skill configuration to find unused or duplicate resources.
- 3Fix prompt-cache missesIdentify why prompt caching is not working effectively and apply fixes to improve hit rates.
- 4Optimize startup context sizeMeasure and reduce the amount of context loaded at the start of every session to save tokens.
Written from the skill's SKILL.md. Every use case is checked against a quote from it.
How to install the optimize-ai-setup skill
Each command copies the skill folder into the client's skills directory. Restart the client or start a new session to load it.Install the optimize-ai-setup skill in Plugin
/plugin marketplace add mgiovani/cc-arsenal /plugin install cc-arsenal@cc-arsenal-marketplace
Install the optimize-ai-setup skill in Claude Code
~/.claude/skills/optimize-ai-setup/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/optimize-ai-setup ~/.claude/skills/optimize-ai-setupInstall the optimize-ai-setup skill in Claude Code (project)
.claude/skills/optimize-ai-setup/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/optimize-ai-setup .claude/skills/optimize-ai-setupInstall the optimize-ai-setup skill in Codex
~/.agents/skills/optimize-ai-setup/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/optimize-ai-setup ~/.agents/skills/optimize-ai-setupInstall the optimize-ai-setup skill in Gemini CLI
~/.gemini/skills/optimize-ai-setup/SKILL.md
$ npx degit mgiovani/cc-arsenal/skills/optimize-ai-setup ~/.gemini/skills/optimize-ai-setupInstall the optimize-ai-setup skill in Claude.ai
npx degit mgiovani/cc-arsenal/skills/optimize-ai-setup optimize-ai-setup && zip -r optimize-ai-setup.zip optimize-ai-setup # claude.ai → Customize → Skills → + → Create skill → Upload a skill → optimize-ai-setup.zip
Automated checks
Ran Nov 15, 2026Full report →Not verified yet. A skill needs a score of 80, no serious finding, and enough data for us to check. How checks work · What to fix for more points
- Source repository linked and reachablemgiovani/cc-arsenal/skills/optimize-ai-setup is public and reachablegithub.com/mgiovani/cc-arsenal/tree/HEAD/skills/optimize-ai- ↗Pass
- Open source license (OSI)MITspdx.org/licenses/MIT.html ↗Pass
- Commit or release in the last yearLast commit 2026-10-28github.com/mgiovani/cc-arsenal/commits ↗Pass
- No download-and-run or credential theft in scripts5 of 20 scripts read; none of them downloads and runs code, the rest were not readFinding
- No hidden instructions in SKILL.mdNo override phrases, safeguard switches, credential requests or hidden charactersgithub.com/mgiovani/cc-arsenal/blob/HEAD/skills/optimize-ai- ↗Pass
- Pre-approved tools are scopedNo pre-approved tools; the agent asks before using onegithub.com/mgiovani/cc-arsenal/blob/HEAD/skills/optimize-ai- ↗Pass
- SKILL.md follows the Agent Skills formatValid name and description; says when to use it; 89 linesgithub.com/mgiovani/cc-arsenal/blob/HEAD/skills/optimize-ai- ↗Pass
SKILL.md
View on GitHubOptimize AI Setup
Measure first, then advise. A local script collects every number from configs and session logs; the model reads only its compact report plus the catalog entries for the findings that fired.
Token rules for this skill
- Run the collector once per audit. Do not open transcripts, session logs, SQLite stores, or whole config files: the script already read them, safely and with size caps.
- Read
references/checks.mdonly by ID (theawkrange below), only for findings being presented. - Answer with a short snapshot and a ranked fix table. Do not restate the whole report.
Step 1: Collect evidence
From the user's project directory, run the collector (<skill-dir> is this skill's directory):
uv run <skill-dir>/scripts/collect.py --days 14
Without uv, use python3 <skill-dir>/scripts/collect.py (Python 3.11+). Flags: --days N (lookback window), --project PATH, --all (every finding, not just the top 15), --json.
no harness detected: say so and stop.- A harness line showing
error:: mention it and continue with the others.
Step 2: Explain the top findings
Print the catalog entries for every HIGH finding plus the top five overall, in one call (the awk range prints each entry and stops at the next heading):
awk '/^## (CC-STARTUP|CC-REBUILD|CX-AGENTSMD-CAP)$/{p=1;print;next} /^## /{p=0} p' <skill-dir>/references/checks.md
Interpret the evidence before recommending:
- Startup context is paid by every session and every subagent, so a large one outranks most other findings.
- A high token-weighted cache hit rate can still hide expensive writes; judge caching by the cost-weighted share and the rebuild count.
- Rebuilds after idle are fixed by a habit (
/compactbefore a break); model or effort rebuilds by choosing both at session start; upgrade rebuilds are expected and need no fix. - "Unused" only means no uses inside the window. Say "no uses in the last N days" and suggest demoting (
name-only,user-invocable-only) before disabling. - Before asking whether to demote or disable anything, list every name from each
*-UNUSED/*-DUPfinding'snameslist in the reply (grouped by source, e.g. plugin prefix), not only the truncated evidence line or a count. Run--all --jsonto get the full lists. Users cannot decide on items they cannot see. - Quote the numbers the report printed. Never invent or extrapolate numbers the script did not measure.
- Flag any fix that trades quality for cost (lower effort, a smaller auto-compact window) with its Tradeoff line.
Step 3: Propose fixes on a page (opt-in)
Use the render skill to build the proposals as one audit page (via the Skill tool as render audit, otherwise follow the render skill's steps inline). One anchored item per finding, anchor finding-<harness>-<check-id>, holding:
- the measured evidence exactly as the report printed it
- the concrete fix: the exact command, settings key and value, or file edit. A finding's
--jsonoutput carries anameslist (the actual skills, servers, or plugins it's about); substitute those for any generic<name>placeholder in thefixstring instead of leaving it literal - the impact and, when the catalog has one, the tradeoff
- a
fix/won't fix/discussverdict
Group the distribution by harness and sort by severity. Put the habits in a short section with no verdicts. Deliver the page path in two lines and ask the user to mark it. When they say it's marked, read the marks back per the render skill and apply only the items marked fix. Without a render skill, print the full name lists first (see above), then ask with AskUserQuestion (multi-select) or a numbered list.
Rules for applying the chosen fixes:
- Claude Code settings (
skillOverrides,promptCacheTtl,autoCompactWindow,statusLine, removing aDISABLE_PROMPT_CACHING*env): use theupdate-configskill via theSkilltool where available, otherwise edit the settings JSON directly and keep every other key intact. - Codex
~/.codex/config.toml(enabled = falseorenabled_toolson an MCP server,project_doc_max_bytes),disable-model-invocation: trueon the user's own skills, and.cursor/rulesfrontmatter: edit in place. - Never delete skills, plugins, MCP servers, rules, or memory files. Disable or demote them; deletion stays the user's call.
X-MCP-INLINE-SECRET: name the file and server only, and tell the user to rotate the secret and reference it as${VAR}. Never print or move the value.- Session habits (
/clear,/compact, model choice) are advice, not edits.
Settings changes apply to new sessions. Do not re-run the collector to "verify" in the same session: its evidence comes from past sessions. Suggest re-running after a week or two of normal use to compare.
Step 4: Close with habits
Print the HABITS entry with the same awk range and keep only the lines that match what the report showed (for example, the /compact line only when idle rebuilds were found).
Output shape
In chat, keep it to the snapshot and the page link. The page carries the full proposal list:
**Setup snapshot** (last 14 days): <1-2 lines with the most telling metrics>
**Top fixes:** <the three highest-impact fixes, one line each>
Proposals: <page path> (mark fix / won't fix / discuss, save, then tell me)
Notes
- Privacy: the script reads only numeric usage fields, model/effort/version values, tool names, and attachment sizes from session logs. It skips credential files, prints no env values, URLs, or message text, and makes no network calls.
- Coverage: token metrics come from Claude Code and Codex local logs. Cursor, Antigravity, Gemini CLI, and Claude Desktop keep no readable per-session token data, so their checks are config-based (Claude Desktop also uses its MCP server logs).
- For the current Claude Code session only,
/usage(prompt cache line, usage attribution) and/context(startup composition) complement this audit.
Files in this skill
24optimize-ai-setup skill questions
How do I install the optimize-ai-setup skill in Claude Code?
Run npx degit mgiovani/cc-arsenal/skills/optimize-ai-setup ~/.claude/skills/optimize-ai-setup. Claude Code loads skills from ~/.claude/skills (all projects) or .claude/skills (one project) and uses a skill when its description matches the task.
Which clients can use the optimize-ai-setup skill?
Any client that reads the Agent Skills format: Claude Code, Codex, Gemini CLI and claude.ai (upload as a ZIP). Scripts in the skill run only where the client allows code execution.
What tools does this skill audit?
The skill audits Claude Code, Codex CLI and app, Cursor, Antigravity, Gemini CLI, and Claude Desktop.