What This Course Covers
This course is about working smarter with AI coding agents. Whether you use Claude Code, Cursor, or the Anthropic API directly, every interaction consumes tokens - the units that LLMs use to process and generate text. More tokens mean higher costs and slower responses.
But the goal is not to use the fewest tokens possible - it is to get the best results per token. This course teaches you to design prompts, structure tasks, and build workflows so that every token you send does meaningful work.
| Lesson | What you learn |
|---|---|
| Token Basics | How tokens are counted, input vs output, context windows |
| Context Management | What to include, what to exclude, CLAUDE.md patterns |
| Precise Prompting | Writing surgical prompts, avoiding verbose noise |
| Prompt Caching | Anthropic cache system, cache-friendly patterns, TTL |
| Task Decomposition | Breaking large tasks, subagent patterns, parallel calls |
| Tool Selection | Specific vs broad tools, read-only first, targeted search |
| Agentic Workflow | Session structure, memory, hooks, CLAUDE.md |
| Cost Monitoring | Token counting, usage APIs, budget alerts |
| Real-World Patterns | Daily coding workflows, review patterns, refactor sessions |
Why Tokens Matter
Tokens are the currency of LLM interactions. Every character you send, every file you include, every message in the conversation history - all of it counts as input tokens. Every word the model generates is an output token. On most APIs:
- Input tokens are cheaper than output tokens (roughly 3-5x cheaper on Claude)
- Output tokens are expensive because generation is sequential and compute-intensive
- Cached input tokens are cheapest - up to 90% less than uncached (Anthropic prompt caching)
# Approximate Anthropic pricing (per million tokens):
Input tokens: $3.00
Output tokens: $15.00
Cache write: $3.75 (slightly more than input, one-time)
Cache read: $0.30 (90% cheaper than input - huge savings)
# A naive "dump all files" approach:
context = 50,000 tokens (20 source files pasted in)
response = 500 tokens
cost = (50000 * $3.00 / 1_000_000) + (500 * $15.00 / 1_000_000)
cost = $0.15 + $0.0075 = $0.1575 per request
# 100 such requests/day = $15.75/day = $472/month
# A focused approach (only relevant files, cached system prompt):
context = 3,000 tokens (2 relevant files + cached 2,000-token system prompt)
response = 500 tokens
cost = (1000 * $3.00 / 1_000_000) + (2000 * $0.30 / 1_000_000) + (500 * $15.00 / 1_000_000)
cost = $0.003 + $0.0006 + $0.0075 = $0.011 per request
# Same 100 requests/day = $1.10/day = $33/month (~93% cheaper)
Cost vs Quality Trade-off
The common assumption is that more context always means better results. This is false. Providing 20 files when only 2 are relevant does not help the model - it forces the model to figure out which parts matter, introducing noise.
A well-scoped prompt with 3 relevant files consistently outperforms a 20-file dump. The model can focus on what actually matters. Precision is a feature, not a limitation.
| Context approach | Tokens | Result quality | Cost |
|---|---|---|---|
| Dump all project files | 50k-200k | Often confused, verbose | Very high |
| Paste relevant files manually | 5k-20k | Good | Medium |
| Targeted reads via tools | 2k-8k | Good to excellent | Low |
| Focused + cached system prompt | 1k-5k input + cache | Excellent | Very low |
Chat vs Agentic Coding
There are two main ways to use AI for coding:
- Chat mode - you paste code, ask questions, get answers. Simple, one-shot, no tools.
- Agentic mode - the AI uses tools (read file, write file, run tests, search code) to accomplish tasks autonomously. This is where token costs can spiral without good practices.
Agentic coding is far more powerful but each tool call adds tokens. A naive agent that reads every file in the project before answering a simple question wastes enormous context. This course focuses on agentic coding because that is where the biggest efficiency gains are available.
# Agentic task: "Fix the bug in the login function"
# Inefficient agent approach:
1. Read all 40 PHP files (40,000 tokens)
2. Read all CSS files (10,000 tokens)
3. Read all JS files (15,000 tokens)
4. Read config files (5,000 tokens)
Total input: 70,000+ tokens
# Efficient agent approach:
1. Grep for "login" function (200 tokens result)
2. Read only auth.php where login is defined (800 tokens)
3. Read the test that fails (400 tokens)
Total input: 1,400 tokens (50x cheaper)
The Three Levers
Every token efficiency technique in this course falls under one of three levers:
1. Reduce Input
Send only what the model actually needs. Context management, precise prompting, targeted tool use.
2. Reuse via Cache
Cache stable system prompts and large documents. Pay once, read cheaply for 5 minutes (or longer).
3. Limit Output
Ask for exactly what you need. Avoid open-ended "explain everything" prompts. Request diffs not full rewrites.
What You Will Learn
By the end of this course you will be able to:
- Understand the token lifecycle and why certain actions are expensive
- Design CLAUDE.md files that give AI agents focused context without bloat
- Enable and measure prompt caching in your API integrations
- Decompose large coding tasks into subagent-friendly units
- Select the right tools (Grep, Glob, Read) over blunt Bash commands
- Structure a coding session as an efficient agentic workflow
- Monitor token usage and set budget guardrails
- Apply proven daily workflow patterns used by professional AI-augmented developers
You should be comfortable using an AI coding tool (Claude Code, Cursor, or similar) and have written code in at least one language. Knowledge of how LLMs work at a basic level (tokens, context window, system prompt) is helpful but not required - the next lesson covers that.