/dev-pipeline:setup-cost-trackingfrom dev-pipeline
Installs per-session cost tracking for Claude Code by wiring logger scripts into the statusline, preserving existing statusline and hooks. Idempotent and safe to re-run.
Ships in dev-pipeline. 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.
Read when SKILL.md points to them; scripts run unread.
Installs genuine cost capture for every Claude Code session on this machine. Cost data
(cost.total_cost_usd etc.) is computed by Claude Code itself and is available only
in the statusline payload — hooks never receive it. So this skill wires a logger into the
statusline path while preserving whatever statusline and hooks the user already has.
Bundled in this skill's scripts/ directory, copied to ~/.claude/scripts/:
| Script | Role |
|---|---|
cost-logger.js | Capture engine. Silent, crash-proof. Writes the log files below. |
statusline-wrapper.js | Used when the user already has a statusline: logs cost, then delegates the payload to their original command and passes its output through untouched. |
statusline-command.js | Used when the user has no statusline: full display (model, context bar, cost, cache stats) that also logs. |
turn-logger.js | Stop hook: stamps turn boundaries so cost samples can later be grouped into turns for analytics. No cost data itself. |
Log outputs (created lazily, no setup needed):
~/.claude/cost-log.jsonl — one row per session, exact cumulative totals (upserted).~/.claude/projects/<mapped-dir>/<session>.cost.jsonl — cost samples at ~5s resolution during activity.~/.claude/projects/<mapped-dir>/<session>.turn-boundaries.jsonl — one row per turn end, with transcript_path for deep-dive analytics.Follow these steps exactly. Use real JSON manipulation (a node -e script or jq) for
every settings edit — never string/regex edits on settings files.
command -v node — if Node.js is missing, stop and tell the user it's required.
Record the absolute path (call it $NODE). Use $NODE in every command you write
into settings, not bare node (statusline/hook commands don't always get the user's
full shell PATH).~/.claude/settings.json (treat as {} if absent) and ~/.claude/settings.local.json
(if present). The effective statusLine is the local one if defined there, else the
user one. Remember which file defines it — edits must go to that same file.mkdir -p ~/.claude/scripts.js files from this skill's scripts/ directory into ~/.claude/scripts/
and chmod +x them. Overwriting previous versions of these four files is fine (that's
how upgrades work). Never overwrite ~/.claude/scripts/statusline-original.json
if it exists.Decide by the effective statusLine:
statusline-wrapper.js or
statusline-command.js. Nothing to change; report "already installed" and continue to Step 3.~/.claude/settings.json:
"statusLine": { "type": "command", "command": "$NODE /Users/<user>/.claude/scripts/statusline-command.js", "padding": 0 }
(expand $NODE and the home directory to absolute paths).~/.claude/scripts/statusline-original.json containing exactly
{ "command": "<their current statusLine.command>" }.statusLine, replace only the command value with
$NODE /Users/<user>/.claude/scripts/statusline-wrapper.js. Keep type, padding,
refreshInterval, and any other sibling keys untouched.Before the first edit to any settings file, back it up:
cp settings.json settings.json.bak-cost-tracking (same pattern for the local file).
One backup per run is enough.
If no existing hooks.Stop entry's command mentions turn-logger.js, append this entry to
the hooks.Stop array (create the array/path if missing), leaving every existing hook alone:
{ "matcher": "", "hooks": [ { "type": "command", "command": "$NODE /Users/<user>/.claude/scripts/turn-logger.js" } ] }
This hook carries no cost data — it only stamps turn boundaries and the idle timer. If the user objects to hooks, skipping this step still leaves session cost capture fully working.
session_id "cost-setup-verify", a workspace.current_dir
of /tmp/cost-setup-verify, and nonzero cost.total_cost_usd / cost.total_api_duration_ms /
model.display_name values.statusLine.command now in settings (run through sh -c).
~/.claude/projects/-tmp-cost-setup-verify/cost-setup-verify.cost.jsonl now exists
and contains the fake cost.cost-setup-verify line
in ~/.claude/cost-log.jsonl, and /tmp/statusline-*-cost-setup-verify state files.Tell the user, concretely:
.bak-cost-tracking settings backup (or, by hand: point
statusLine.command back to the command saved in ~/.claude/scripts/statusline-original.json
and remove the turn-logger Stop hook entry), then delete the four scripts.What SKILL.md sets; muted values are Claude Code's defaults
inheritThree short reads, in order
npx claudepluginhub foyzulkarim/skills --plugin dev-pipeline17 skills in this plugin
/archive-issueRetire a closed issue's working artifacts out of specs/ into the GitHub wiki. Use only when the user asks to archive a finished issue, empty out specs/ for a done task, or move an issue's requirements/architecture/tasks/review/QA docs to the wiki./commitOne-shot conventional commit; bundled scripts adaptively gather diff context, draft the message, and stage+commit — pass `ask` to confirm first or add a hint for the title. Use only when the user asks for a commit./execute-qaExecutes a QA specification (specs/qa/QA-<N>-<slug>.md) written by /plan-qa: drives every step with the plan's drivers, verifies each Expected line mechanically ([assert]) or by evidence-backed judgment against the plan's written criterion ([judge]), pauses at named operator handoffs, and writes the results artifact QA-RESULTS-<N>-<slug>.md. Use only when the user asks to run or execute a QA plan — never trigger automatically./finish-worktreeAfter an issue's PR has squash-merged on GitHub and its issue has closed: fast-forward the default branch, remove the issue-numbered nested worktree (.worktrees/<issue#>), and delete the local feature branch. Use when the user says to finish, tear down, or clean up a lane or worktree for a merged issue./generate-tasksPhase 3 of 5 — slices the ARCH doc into verification-ready task specs (tdd/test-after/ui/checklist), emitted as a separate TASKS-<N>-<slug>.md file alongside ARCH for the implement skill. Use only when the user asks to run Phase 3 or generate tasks from an ARCH doc — never trigger automatically./implementPhase 4 of 5 — implements tasks from TASKS-<N>-<slug>.md (with ARCH-<N>-<slug>.md as architecture-only context) using mode-appropriate verification (tdd, test-after, ui, checklist); pass 'auto' to run without stepping. Use only when the user asks to run Phase 4 or implement tasks from an ARCH doc — never trigger automatically from a coding request.Other plugins' skills for the same job