Context Engineering
A practical playbook for managing token budgets and context quality in Claude sessions through four operations: Write, Select, Compress, Isolate.
What it does
Tackles the root cause of degrading AI output in long sessions — diluted context — with four concrete operations:
- Write: persist state to CLAUDE.md, NOTES.md, and
.claude/memory/so it survives compaction and session boundaries. - Select: retrieve by precision rank —
@file→ Grep/Glob → subagent exploration → RAG. Core rule: "focused 300 tokens beats unfocused 113K tokens". - Compress:
/compact focus:, microcompaction, head+tail reads, tool-result clearing, plus explicit compaction triggers. - Isolate: push heavy work to subagents, worktrees (
claude -w),/btw, or a fresh session.
It also ships a phase-based budget table (planning <20%, implementation <50%, testing <70%, review <85%), a /clear vs /compact vs subagent decision table, an anti-pattern list, and a ready-to-paste CLAUDE.md rules snippet.
Who it's for
- Anyone running long Claude Code sessions on large codebases and hitting context limits
- Developers tired of re-explaining state after every auto-compaction
- Teams already using subagents or worktrees but lacking clear criteria for when to use them
- Cost-conscious users who want better prompt-cache hit rates
Example uses
- Before a large refactor: write goals and constraints to NOTES.md, and add a
PostCompacthook that re-injects.claude/critical-context.mdafter every compaction. - Debugging test failures: instead of dumping full logs, apply the head+tail 20-line strategy, or delegate the whole test run to a subagent to keep the main context clean.
- Switching task domains: after finishing a feature, run
/compact focus: auth module changesto keep learnings and drop noise; use/clearwhen the next task is unrelated.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/rohitg00/pro-workflow/HEAD/skills/context-engineering/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the skills/context-engineering folder from the GitHub repo rohitg00/pro-workflow into my ~/.claude/skills/rohitg00-context-engineering/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/rohitg00/pro-workflow.git && mkdir -p ~/.claude/skills && cp -r pro-workflow/skills/context-engineering ~/.claude/skills/⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal and clone the repo:
git clone https://github.com/rohitg00/pro-workflow.git - Create the skills folder if needed:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r pro-workflow/skills/context-engineering ~/.claude/skills/ - Restart Claude Code or start a new session.
- Run
/contextto see your model's real context window, then recalibrate the budget tables in the doc to your setup. - Optionally add
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50to your shell profile and paste the rules snippet at the end of the doc into your project's CLAUDE.md.