CC-201b · Module 3

Prompt Compression

3 min read

Every token in your prompt has a cost — not just in billing, but in context space and attention. Prompt compression is the art of conveying maximum information in minimum tokens. The simplest technique is reference patterns: instead of describing a pattern from scratch, point Claude at an example. "Make the new endpoint follow the same pattern as src/routes/users.ts" conveys more information in 15 words than a 200-word description of the pattern could. Claude reads the file, extracts the patterns, and applies them. Your prompt cost was 15 words. The information delivered was the entire file.

Shorthand conventions compound over a session. Early in the conversation, establish shorthand: "When I say 'test it,' run vitest run on the changed files. When I say 'check it,' run tsc --noEmit and eslint." Now every time you type "test it," Claude knows exactly what you mean. Two words replace a full command specification. Over a session with twenty verification requests, that saves hundreds of tokens and dozens of seconds of typing.

Implicit context is the most powerful compression of all. After Claude has read a file, you do not need to re-describe its contents. "Fix the bug on line 47" works because Claude already has the file in context. "Add error handling like the other endpoints" works because Claude has already seen the other endpoints. The longer a session runs, the more implicit context accumulates, and the more compressed your prompts can become. This is why experienced Claude Code users write shorter prompts as sessions progress — they are leveraging accumulated context, not being lazy.