From ship-with-ai
Retrospectively analyze the current Claude Code session and estimate how much time and tokens were spent on context work (explaining the codebase, style guide, conventions, correcting Claude when it reinvented existing utilities) vs. actual feature work. Use this skill whenever the user wants to audit session efficiency, measure how much time they lost to re-explaining context, or decide whether to invest in persistent project docs. Trigger on "/context-tax", or phrases like "calculate my context tax", "how much did I waste on context this session", "audit this session", "session breakdown", "was this session efficient", even if the user doesn't explicitly say "context tax".
How this skill is triggered — by the user, by Claude, or both
Slash command
/ship-with-ai:context-taxThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Retrospectively classifies every turn in the current Claude Code session
Retrospectively classifies every turn in the current Claude Code session into five categories — four flavors of "context work" plus actual feature work — then estimates the time and tokens spent on each. The output is a breakdown report that helps the user see exactly what a session cost them beyond building the feature they sat down to build.
Every new Claude Code session starts cold. The user carries context in their head, retypes it, paraphrases it, and corrects Claude when it misremembers or reinvents things. That work is invisible in the moment — it just feels like "coding" — but it's a tax on the session. Measuring it once gives the user the number they need to decide whether persistent project documentation is worth the setup cost.
Numbers from this skill are approximations, not exact measurements. Classification is heuristic and will occasionally miscategorize borderline turns. That's fine — the goal is a roughly accurate breakdown that reveals which category dominates, not a precise audit.
/context-tax at the end of a coding sessionRun this skill BEFORE the session ends — once the transcript is closed, the in-context conversation disappears and only the JSONL file remains.
Primary source: the JSONL file at
~/.claude/projects/<slug>/<session-id>.jsonl where <slug> is the
current working directory with / replaced by - (e.g.,
/home/alice/projects/myapp becomes -home-alice-projects-myapp).
# Find the most recent session file for this project
ls -t ~/.claude/projects/"$(pwd | sed 's|/|-|g')"/*.jsonl 2>/dev/null | head -1
If the JSONL isn't readable (permissions, not yet flushed, or the user is not in Claude Code), fall back to analyzing the conversation visible in the current context window. The JSONL is preferred because it contains precise token counts and timestamps per turn.
For each USER turn, pick exactly one category based on the dominant content. When a turn mixes categories, pick the one the user spent the most words on.
| Category | What to look for |
|---|---|
codebase_explanation | Pointing Claude at files/folders/modules/architecture. "Look at src/auth", "we have a utils/ dir", "the config lives in lib/env.ts" |
style_guide | Rules, conventions, naming, linting, formatting. "Follow the style guide", "we use camelCase", "see CLAUDE.md", "wrap at 80 chars" |
ways_of_doing_things | Approach corrections, pattern preferences. "No, do it like this", "use our pattern", "don't use X, use Y", "we always do it this way" |
reinvented_wheel_fix | Claude built something that already existed; user redirects. "We already have this in lib/foo", "don't rewrite, use the existing helper" |
feature_work | Actual implementation dialogue — new logic, bug fixes, refactors, tests, questions about the feature being built |
For each ASSISTANT turn, classify by dominant activity:
CLAUDE.md, rule files, or style guide references → style_guidecodebase_explanationfeature_workways_of_doing_thingsreinvented_wheel_fixWhen a turn is ambiguous, classify as feature_work — we want a
conservative tax estimate, not an inflated one.
Tokens (preferred — from JSONL):
Each JSONL entry has message.usage.input_tokens and
message.usage.output_tokens. Sum both for the turn's token cost.
Tokens (fallback — from in-context conversation):
Estimate at ~4 characters per token. Count total characters in the turn
(user message or assistant response) and divide by 4. When using this
fallback, prefix the Tokens column in the final report with ~ to
signal approximation.
Time (preferred — from JSONL timestamps):
Each JSONL entry has a timestamp field. Compute the time between
consecutive turns and attribute it to the earlier turn (this captures
user thinking time + assistant response time).
Time (fallback — when timestamps are unavailable):
Across all non-feature_work turns, rank by individual-turn time spent
and pick the top 3. For each, capture a short quote (first 12 words) or
a summary of what the turn was about. Skip this section entirely if the
session has fewer than 5 turns — the sample is too small to be
meaningful.
Output this exact markdown structure, filling in the bracketed values:
# Context Tax Report — [YYYY-MM-DD HH:MM]
**Total session**: [X] minutes · [Y] tokens
## Breakdown
| Category | Time | Tokens | % of session |
| ---------------------- | ------- | ------- | ------------ |
| Codebase explanation | [X] min | [Y] tok | [Z]% |
| Style guide | [X] min | [Y] tok | [Z]% |
| Ways of doing things | [X] min | [Y] tok | [Z]% |
| Reinvented-wheel fixes | [X] min | [Y] tok | [Z]% |
| **Feature work** | [X] min | [Y] tok | [Z]% |
**Context tax**: [100 minus feature_work %]% of this session went to
context, not features.
## Top 3 costliest context moments
1. **[Category]** — [X] min — "[short quote or summary]"
2. **[Category]** — [X] min — "[short quote or summary]"
3. **[Category]** — [X] min — "[short quote or summary]"
## The fix
If your context tax is above 20%, persist this context so you don't pay
it again next session. Create three files in your project root:
- `PROJECT.md` — the "why" (stack decisions, constraints, non-goals)
- `ROADMAP.md` — the "what" (phases, current status)
- `STATE.md` — the "where" (cursor: which phase/task you stopped on)
Then add a Session Protocol to your `CLAUDE.md` that reads all three
files on session start and updates STATE.md on session end. The first
run of `/context-tax` after adopting persistent context usually drops
by 20-40 percentage points.
[X] placeholders in the
final output<1 min12.3k tok)feature_work is above 80%, add a closing line: "Most of this
session went to features — nice work." Skip the "fix" section in that
case since the tax is already low~ (e.g., ~Tokens) and add a single-line
note at the bottom: "Tokens estimated from character counts — add the
--jsonl flag or ensure session transcript access for precise
numbers."Input scenario (session has 18 turns, 45 minutes):
The user spent the first 10 minutes explaining their project structure, then 5 minutes correcting Claude's assumption about their style guide, then 25 minutes pair-programming a feature, then 5 minutes at the end because Claude built a duplicate of an existing helper.
Expected report:
# Context Tax Report — 2026-04-15 21:34
**Total session**: 45 minutes · 38.2k tokens
## Breakdown
| Category | Time | Tokens | % of session |
| ---------------------- | ------ | --------- | ------------ |
| Codebase explanation | 10 min | 8.5k tok | 22% |
| Style guide | 5 min | 4.1k tok | 11% |
| Ways of doing things | <1 min | 0.3k tok | 1% |
| Reinvented-wheel fixes | 5 min | 3.8k tok | 11% |
| **Feature work** | 25 min | 21.5k tok | 55% |
**Context tax**: 45% of this session went to context, not features.
## Top 3 costliest context moments
1. **codebase_explanation** — 6 min — "ok so the project structure is a
monorepo with apps/ and packages/, and..."
2. **reinvented_wheel_fix** — 5 min — "no we already have formatDate in
lib/utils/date.ts, please don't..."
3. **style_guide** — 3 min — "we don't use semicolons, check CLAUDE.md,
also we prefer const over let..."
## The fix
If your context tax is above 20%, persist this context so you don't
pay it again next session. Create three files in your project root:
- `PROJECT.md` — the "why" (stack decisions, constraints, non-goals)
- `ROADMAP.md` — the "what" (phases, current status)
- `STATE.md` — the "where" (cursor: which phase/task you stopped on)
Then add a Session Protocol to your `CLAUDE.md` that reads all three
files on session start and updates STATE.md on session end. The first
run of `/context-tax` after adopting persistent context usually drops
by 20-40 percentage points.
feature_work and doesn't skew resultsnpx claudepluginhub ship-with-ai/skills --plugin ship-with-aiProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.