/john-skills:cost-trackingfrom john-skills
Tracks API token costs for Claude Code operations by marking start and stop points in the session log. Calculates input, output, and cache token costs using live Anthropic pricing.
Ships in john-skills. 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.
Track the exact token cost of any Claude Code operation by marking a start and stop point in the session JSONL.
When the user invokes /cost-tracking:
Determine the current session JSONL path. It lives at:
~/.claude/projects/<project-hash>/<session-id>.jsonl
Find the project directory by looking for the most recently modified .jsonl file under ~/.claude/projects/. The project hash is a mangled version of the working directory path (slashes replaced with dashes, e.g., -Users-johndamask-myproject).
Determine the cost tracking output directory:
~/.claude/projects/<project-hash>/cost-tracking/
Run the start script:
python3 <skill-dir>/scripts/start_tracking.py <session_jsonl_path> <cost_tracking_dir>
Store the returned tracking_id — mention it to the user and remember it for the stop step.
Confirm: "Cost tracking started. I'll calculate costs when you say 'stop tracking'."
When the user says "stop tracking", "stop cost tracking", or asks about the cost:
Run the stop script with the tracking_id from the start step:
python3 <skill-dir>/scripts/stop_tracking.py <tracking_id> <cost_tracking_dir>
The script outputs a formatted cost report and writes:
tokens.jsonl — per-entry token log with timestamp, model, input_tokens, output_tokenssummary.json — aggregated cost breakdown by modelPresent the report to the user.
The stop script fetches pricing live from Anthropic's published page
(https://platform.claude.com/docs/en/about-claude/pricing.md) at run time — it parses the
"Model pricing" table, maps the session's model id (e.g. claude-opus-4-8) to the matching
row, and caches the result for 24h in scripts/.pricing_cache.json. It distinguishes
5-minute vs 1-hour cache writes via the cache_creation.ephemeral_* fields, and picks the
correct row when a model has date-scoped pricing (e.g. Sonnet 5's introductory rate).
resources/pricing.json is now only an offline fallback, used if both the live fetch
and the cache are unavailable. If neither the page, the cache, nor the fallback can price a
model, the script reports an error for it — it never silently substitutes another
model's rate (the failure mode that once 3×-overcharged an Opus 4.8 run at legacy Opus
rates). Keep resources/pricing.json reasonably current as a backstop, but the live page
is the source of truth.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub jbdamask/john-claude-skills --plugin john-skills32 skills in this plugin
/architecture-decision-recordsWrite and maintain Architecture Decision Records (ADRs) that capture the context and rationale behind significant technical decisions. Use when documenting an architectural or technology choice, recording a design trade-off, superseding a past decision, or setting up an ADR process. Also use proactively to offer an ADR when a significant decision is made during a coding session (database, framework, auth scheme, API style, integration pattern). Triggers on "write an ADR", "document this decision", "record this architecture choice", "add a decision record", "supersede ADR"./aws-learningsProactively catch common AWS infrastructure mistakes before they happen. Use when creating or modifying AWS components — CloudFormation, CDK, Lambda, API Gateway, IAM, S3, CloudFront, EC2, EventBridge, SQS, Secrets Manager, or SSM — to find and apply hard-won deployment lessons and avoid known pitfalls. Read-only: fetches lessons, does not add them./aws-learnings-addContribute a new lesson to the AWS Learnings library (the llms.txt-format library at github.com/jbdamask/aws-learnings-library). Use this whenever you've just debugged, fixed, or discovered a non-obvious AWS gotcha — CloudFormation, CDK, Lambda, API Gateway, IAM, S3, CloudFront, EC2, EventBridge, SQS, Secrets Manager, SSM — and want to capture it for next time. Triggers on phrases like 'add an AWS learning', 'save this AWS lesson', 'capture this gotcha', 'add this to the learnings library', or after solving a tricky AWS deployment problem worth remembering. This skill WRITES files (a new lesson file + an updated index) and prepares a pull request; it is the write companion to the read-only 'aws-learnings' skill.Other plugins' skills for the same job