Use when long-lived agents, project memories, system prompts, or playbooks are repeatedly summarized, rewritten, or optimized and risk losing domain detail, provenance, or execution learnings.
中文简介正在准备中。当前显示原文说明。
Use when a coding agent (Claude Code, Cursor, Codex, Copilot CLI) burns through tokens or usage limits, sessions get slow or hit context limits, or the user asks to cut agent cost. Measures where the tokens go, then applies levers in order: session hygiene, always-loaded context (CLAUDE.md, skills, MCP), tool-output filtering, subagent delegation, output verbosity, and model/effort choice.
中文简介正在准备中。当前显示原文说明。
查看安装方法安装前可以查看交给 AI 代理的指令内容。
A coding agent re-sends the whole conversation — system prompt, memory files, skill descriptions, tool schemas, every tool result so far — on every request. Prompt caching makes the repeats cheaper, not free. Most waste comes from context that is loaded but never used and from tool output nobody needed. Measure first, then cut in the order below; the early levers cost nothing in quality.
Not for cutting the cost of an application that calls an LLM API — use llm-cost-optimization.
Token efficiency pass:
- [ ] 1. Baseline measured
- [ ] 2. Always-loaded context trimmed
- [ ] 3. Session habits fixed
- [ ] 4. Tool output filtered
- [ ] 5. Output and model/effort tuned
- [ ] 6. Re-measured on comparable work
Pick the measurements the client offers:
| Client | Where tokens go | Spend over time |
|---|---|---|
| Claude Code | /context (breakdown of the window), /usage (session tokens, cache hit rate, and on subscription plans a breakdown by skills, subagents, and MCP servers) | /usage daily/weekly view; npx ccusage reads local session logs |
| Any client | python3 scripts/context_budget.py <project> --client claude (or cursor, agents) | Provider console |
scripts/context_budget.py is read-only and uses only the Python standard library. It estimates the
context loaded before the first prompt: memory files (CLAUDE.md, CLAUDE.local.md, AGENTS.md,
~/.claude/CLAUDE.md) and the name and description of every installed skill, which clients keep in
context on every request. It does not see plugin skills, tool schemas, or MCP servers — /context does.
Write the baseline down: always-loaded tokens, cache hit rate, and tokens for one representative task.
| Source | Do | Default target |
|---|---|---|
CLAUDE.md / AGENTS.md | Keep only what every task needs. Move workflow-specific instructions (release steps, migration rules) into skills, which load on demand. | Under 200 lines (Anthropic's guidance) |
| Installed skills | Every description is sent on every request. Uninstall unused ones; install by need, not whole libraries. For large libraries, discover skills on demand (this repository's skills MCP server, docs/skills-mcp.md). | Only skills you used this month |
| Skill bodies | A skill body over ~500 lines costs that much on every use. Split reference into references/. | Under 500 lines |
| MCP servers | Disable servers you are not using (/mcp). Prefer a CLI (gh, aws, kubectl) when one exists: it adds no tool listing. | Only servers this project needs |
/clear between unrelated tasks. Stale history is re-sent with every message. /clear costs
nothing; /compact is itself a large request because it reads what it summarizes./compact keep the failing test output and the API decisions.session-handoff skill writes a summary a fresh
session can start from.login() in auth.ts" reads one file; "improve this
codebase" reads many. Use plan mode for large changes so a wrong direction is caught before it is
built, and stop a wrong turn early (Esc, /rewind).Tool results are usually the largest input. In order of effort:
PreToolUse hook can rewrite npm test to keep only failures
(grep -A 5 -E '(FAIL|ERROR|error:)' | head -100); Anthropic's cost guide has a complete example.git,
ls, test runners, linters, docker) to compressed forms through a hook installed with
rtk init -g, and reports savings with rtk gain. It publishes 60–90% reductions on command output,
but command output is only part of the input bill. Caveats: it only sees shell commands, so built-in
Read/Grep/Glob tools bypass it; and the compression engine is BUSL-1.1 source-available (an
Apache-only edition omits it).caveman skill applies rules that keep code,
commands, and errors verbatim. Its own benchmark is honest about the size: about 3% fewer output tokens
than a plain "answer concisely" at the median, with its rules costing about 1,160 input tokens. It
saves nothing on per-request billing (some IDE plans), and caveman-compress shrinks memory files
instead (it sends their text to a model provider).model: haiku in a subagent definition)./effort in Claude Code). Thinking tokens bill
as output.Repeat step 1 on comparable work. Keep a change only if tokens per completed task fell and the work did not get worse: more turns, more retries, or a missed requirement cost more than they save.
CLAUDE.md used to tell it, it spends turns reading files. Move instructions into skills, do not
delete them.CLAUDE.md, the tool list, or MCP servers mid-session invalidates the prompt cache. Make
those changes between sessions./usage on real work.claude --version and the guide if one is missing.caveman, caveman-compress, session-handoff, context-compression, context-optimization,
llm-cost-optimization.
还没有评价。欢迎分享你的使用感受。
无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。
还没有评论。来写第一条吧。
Use when long-lived agents, project memories, system prompts, or playbooks are repeatedly summarized, rewritten, or optimized and risk losing domain detail, provenance, or execution learnings.
中文简介正在准备中。当前显示原文说明。
Use this skill when the user explicitly asks to map, document, or onboard into an existing codebase. Trigger for prompts like "map this codebase", "document this architecture", "onboard me to this repo", or "create codebase docs". Do not trigger for routine feature implementation, bug fixes, or narrow code edits unless the user asks for repository-level discovery.
中文简介正在准备中。当前显示原文说明。
Adds educational comments to a code file so it becomes a learning resource, asking for the file (with a list of close matches) if none is given. Use when preparing code for learners, onboarding, or teaching.
中文简介正在准备中。当前显示原文说明。
Write, debug, and optimize Adobe Illustrator automation scripts using ExtendScript (JavaScript/JSX). Use when creating or modifying scripts that manipulate documents, layers, paths, text frames, colors, symbols, artboards, or any Illustrator DOM objects. Covers the complete JavaScript object model, coordinate system, measurement units, export workflows, and scripting best practices.
中文简介正在准备中。当前显示原文说明。
Patterns and techniques for adding governance, safety, and trust controls to AI agent systems. Use this skill when: - Building AI agents that call external tools (APIs, databases, file systems) - Implementing policy-based access controls for agent tool usage - Adding semantic intent classification to detect dangerous prompts - Creating trust scoring systems for multi-agent workflows - Building audit trails for agent actions and decisions - Enforcing rate limits, content filters, or tool restrictions on agents - Working with any agent framework (PydanticAI, CrewAI, OpenAI Agents, LangChain, AutoGen)
中文简介正在准备中。当前显示原文说明。
Check any AI agent codebase against the OWASP Agentic Security Initiative (ASI) Top 10 risks. Use this skill when: - Evaluating an agent system's security posture before production deployment - Running a compliance check against OWASP ASI 2026 standards - Mapping existing security controls to the 10 agentic risks - Generating a compliance report for security review or audit - Comparing agent framework security features against the standard - Any request like "is my agent OWASP compliant?", "check ASI compliance", or "agentic security audit"
中文简介正在准备中。当前显示原文说明。