/cclens:optimizefrom cclens
Investigates cclens findings about Claude Code usage to root cause issues and propose config fixes. Use to cut token waste, fix recurring tool failures, or act on cclens doctor results.
Ships in cclens. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
cclens optimize normally launches a new claude session seeded with an
advisor prompt. This skill runs the same analysis but adopts that prompt in the
current session instead, so the user stays where they are.
cclens if command -v cclens finds it. Otherwise run every
command below through Nix instead: nix run github:lambdalisue/cclens -- <subcommand …>.
If neither cclens nor nix is available, stop and tell the user how to
install it (nix profile install github:lambdalisue/cclens, or
cargo install --git https://github.com/lambdalisue/cclens).Omit --db everywhere: the store defaults to a per-user path
(${XDG_STATE_HOME:-~/.local/state}/cclens/cclens.db), so nothing is dropped
into the current project.
cclens analyze
PROMPT="$(mktemp)"
cclens optimize --frozen --print > "$PROMPT"
If the user asked to optimize their global setup or one specific project, add
--scope global or --scope project:<slug> to the optimize command — the
prompt then pins the work to that config layer.
--print writes the full advisor prompt — the prescribed instructions plus the
complete findings briefing — to stdout. It goes through a temp file (mktemp
creates it private, 0600), not your tool-output stream, because the briefing
carries real paths and error excerpts from the user's transcripts.
Read the temp file and adopt its contents as your instructions for the rest
of the task: investigate each finding to a root cause yourself (using
cclens sql against the store, and the user's actual config files), conclude
with a prioritized fix-plan naming specific file edits, and pause only for the
user's approval of that plan before editing anything.
Delete the temp file (rm -f "$PROMPT") as soon as you have read it. Do not
paste the briefing wholesale back to the user — deliver the conclusions.
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/doctorOne-screen health check of the user's Claude Code usage via cclens — where tokens go, always-on context cost, recurring tool failures, unused config. Use when the user asks how their Claude Code setup is doing, where time or tokens are being spent or wasted, or for a cclens doctor / health check./queryAnswer ad-hoc questions about the user's Claude Code usage with read-only SQL over the cclens store (cclens sql) — which files keep failing to edit, which tool errors most, usage per month, any slice the fixed views don't cover. Use when the user asks a specific question about their Claude Code sessions, tool errors, or skill usage.npx claudepluginhub lambdalisue/cclens --plugin cclensOther plugins' skills for the same job