# "Elite Context Engineering with Claude Code"
<!--
ref: @content/youtube/indy-dev-dan/2025-09-08-elite-context-engineering-with-claude-code
triggers: [context overflow, inefficient agent performance, high token usage, need for task delegation]
trigger_prompt: When the user struggles with managing context for coding agents or seeks to improve agent efficiency through better delegation and context strategies.
version: 4
updated_at: 2026-10-31T19:04:08.617Z
-->

Claude Code (Indy Dev Dan, 2025-09-08): A focused agent is a performant agent, and managing the context window is the single highest-leverage skill for engineers using coding agents.

IndyDevDan walks through 12 context engineering techniques for Claude Code, organized around a simple R&D framework — Reduce and Delegate — and progressing from single-agent hygiene to multi-agent orchestration.

## Core Thesis
A focused agent is a performant agent, and managing the context window is the single highest-leverage skill for engineers using coding agents. There are only two levers: **R**educe context entering the primary agent, and **D**elegate context to sub-agents or other primaries. Mastery progresses from in-loop work, to out-loop delegation, to zero-touch execution where specialized agent workflows ship on your behalf.

## Key Insights

- **Default MCP loading is a hidden tax.** A default `mcp.json` can silently consume ~24k tokens (~12% of the window) before any work begins. Launch MCP servers per-task with `--mcp-config` and `--strict-mcp-config`.
- **CLAUDE.md's strength is its weakness.** Always-loaded memory files grow unbounded into "massive globs of mess." Shrink them to universal essentials (~350 tokens) and prefer dynamic context priming.
- **Context priming beats static memory.** Build reusable slash commands (`/prime-bug`, `/prime-feature`, `/prime-chore`, `/prime-cc`) with a **Purpose → Run → Read → Report** structure to load only the context the task needs.
- **Sub-agents live in system prompts, not user prompts.** A custom agent costs ~122 tokens in the parent context vs ~900 for inline content, because the definition isn't injected into the primary's window.
- **Sub-agents are an intermediate skill.** Each agent has a "core four" — context, model, prompt, tools — and managing N agents means tracking N of them. If you can't keep one primary clean, you're not ready for sub-agents.
- **Web scraping is the canonical sub-agent use case.** Token-heavy input, small focused output. Demo: ~10 parallel scrapers each using ~3k tokens in their own context, saving ~40k from the primary.
- **Context bundles preserve continuity across context blowups.** Append-only execution logs captured via Claude Code hooks — keyed by day/hour/session — record reads, searches, prompts, and tool inputs (but trim writes) so a fresh agent can `/loadbundle` and resume with ~60–70% of prior context.
- **Background agents move you out-of-loop.** A `/background` slash command fires a full Claude Code instance with a prompt, model, and report file. The agent does one job, writes to the report, and renames it as a done-signal.
- **Scaling progression**: in-loop → out-loop → ZTE (zero-touch execution). Stop babysitting as your skill improves.
- **Token economy reframe**: It's not about saving tokens — it's about spending them properly. Wasted cycles correcting agent mistakes are the real cost. LLM scaling laws degrade performance as context grows, so context engineering is a structural bet.
- **Escalation ladder**: Prompt → Prompt Chain → Agent → Many focused specialized agents. The principle: "better agents, then more agents."

## Actionable Takeaways

1. Audit context usage with `/context` in Claude Code.
2. Delete the default `mcp.json`; launch MCP servers per-task with `--mcp-config <path>` and `--strict-mcp-config`.
3. Shrink `CLAUDE.md` to only universal essentials you're 100% sure you want loaded 100% of the time.
4. Create dedicated prime commands in `.claude/commands/` (`/prime-bug`, `/prime-feature`, `/prime-chore`, `/prime-cc`) with a Purpose → Run → Read → Report structure.
5. Use sub-agents for token-heavy, well-scoped tasks (scraping, search, doc fetching) — one prompt, one focused effort.
6. Set up Claude Code hooks to write context bundles; use `/loadbundle <path>` to remount a fresh agent after a context overflow.
7. Build a `background.md` slash command that takes a prompt, model, and report file as args; rename the report file on completion as a done-signal.
8. Wrap delegations in an XML **Primary Agent Delegation** wrapper with explicit context.
9. Pick 1–2 of the 12 techniques and deploy them into your workflow this week — don't wait to adopt all of them.
10. Build specialized **ADWs** (Agent Developer Workflows) that ship on your behalf.

## Notable Quotes

> "A focused engineer is a performant engineer and a focused agent is a performant agent."

> "There are many places to be wasteful as an engineer to move fast and break things. The context window of your agents is not one of them."

> "The CLAUDE.md file is incredible for one reason… and terrible for the exact same reason."

> "Prime, don't default."

> "There's only two ways to manage your context window: reduce context entering your primary agent and delegate context to sub-agents."

> "Compute orchestrating compute, agents orchestrating agents… this is where everything is headed. Better agents and then more agents."

> "It's not necessarily about saving tokens. It's about spending them properly."

> "What's better than a prompt? A prompt chain. What's better than a prompt chain? An agent. What's better than an agent? Many focused, specialized agents."

> "If it's easy, a vibe coder is probably doing it. And that isn't irreplaceable."

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*