一键导入
cost-audit
Analyzes the current session's token usage, pinpoints where tokens were wasted, and produces concrete optimization actions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Analyzes the current session's token usage, pinpoints where tokens were wasted, and produces concrete optimization actions
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | cost-audit |
| description | Analyzes the current session's token usage, pinpoints where tokens were wasted, and produces concrete optimization actions |
| user-invocable | true |
| allowed-tools | Bash(claude*), Read, Grep |
| effort | low |
Make it visible where the tokens in this session actually went. Not guesses — evidence. Output: "do these 3 things next time and you save ~X%."
/cost
Note the output: total tokens, input/output split, cache hit rate, total $.
Scan the transcript for these signals:
| Signal | How to detect it | Why it wastes tokens |
|---|---|---|
| Unnecessary file reads | Read calls touching node_modules/, dist/, *.lock, coverage/ | Missing .claudeignore |
| Re-reading the same file | Same path appears in multiple Read calls | Context lost — /compact should have happened earlier |
| Reading entire large files | Read without limit on files >500 lines | Should have used offset/limit or Grep |
| Bash + grep/cat/find | Bash calls to grep, cat, find, ls -R | Dedicated tools (Grep/Glob/Read) are cheaper and more precise |
| Vague prompt → many tool calls | Single-word asks ("improve", "fix", "look") followed by 5+ tool calls | Prompt wasn't specific |
| Repeated onboarding research | Same concept re-discovered across sessions | Belongs in CLAUDE.md |
Give the user a report in this shape:
## Session summary
- Total: <tokens> (<$>)
- Cache hit: <%>
## Top 3 leaks
1. [Evidence]: X files under src/components/ were read in full; ~Y tokens combined
Fix: add to .claudeignore → <lines>
Estimated savings: ~Z%
2. ...
3. ...
## Action list
- [ ] Create .claudeignore with <lines>
- [ ] Add a "<topic>" section to CLAUDE.md
- [ ] Use `/compact <hint>` earlier in long sessions
If the user approves:
.claudeignore if missing, add the detected pathsCLAUDE.md scaffold if missing, seed it with the repeated-research topics/compact hint phrase for this projectGenerates API documentation from route definitions (Express, Fastify, Hono, etc.)
Adds caching to expensive operations - Redis, in-memory, HTTP cache headers
Staged değişiklikleri analiz edip Conventional Commits formatında commit mesajı oluşturur
Reports cyclomatic complexity hotspots and refactoring suggestions
Finds unused functions, variables, exports, and dependencies across the codebase
Hata mesajı veya stack trace alır, kök nedeni bulur ve düzeltir