Claude Code cheat sheet
One minute setup.
If someone asks me how to make Claude Code less wasteful, this is what I send them. Run the shell setup, add the repo rules, then use the compact prompt when the chat starts getting fat.
1. Shell setup
Copy this if you want the quick baseline. It sets cheaper defaults, starts measurement, and installs RTK for noisy command output.
Caps the default thinking budget at 8k.
Routes routine subagent work to Haiku.
Shows current spend with ccusage.
Installs RTK so noisy command output is compressed.
Assumes zsh on macOS. If you use bash, replace `~/.zshrc` with `~/.bashrc`. Open a new terminal afterward.
# 1. Put the cheap defaults in your shell rc
grep -qxF 'export MAX_THINKING_TOKENS=8000' ~/.zshrc || echo 'export MAX_THINKING_TOKENS=8000' >> ~/.zshrc
grep -qxF 'export CLAUDE_CODE_SUBAGENT_MODEL=haiku' ~/.zshrc || echo 'export CLAUDE_CODE_SUBAGENT_MODEL=haiku' >> ~/.zshrc
# 2. Measure before guessing
# Optional sanity check inside Claude Code: /context
npx ccusage@latest daily
npx ccusage@latest blocks --live
# 3. Compress noisy command output
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | bash
rtk init -g After a few sessions, check whether RTK is actually doing anything:
# Check whether RTK is helping
rtk gain
rtk gain --graph
rtk discover 2. Repo rules
This is the part that cuts pointless assistant prose. Put it in the repo root as `CLAUDE.md`. Use `~/.claude/CLAUDE.md` if you want the same rules everywhere.
# Token rules
- No preamble.
- No flattery.
- No recap unless I ask.
- Do not echo files back after editing them.
- Use Edit or patch for small changes.
- Read file ranges when possible. Do not dump huge files "just in case".
- Do not offer three options when one clear recommendation is enough.
- For small tasks, act. For larger tasks, give 3-5 bullets and stop. 3. Session habits
These matter more than another plugin. Most wasted tokens come from long messy chats and careless reads.
Edit the previous prompt
If you forgot one detail, edit the last message. Do not send three tiny correction messages.
Start a new chat after 15-20 turns
Long threads get expensive because old context keeps coming along for the ride.
Compact around 60%
Do it before the transcript is full, and tell Claude what to keep.
Ask for narrow reads
Say "read the relevant function" or "read lines around the error", not "inspect the whole file".
Batch questions
Three related questions in one message are cheaper than three separate context reloads.
Compact prompt
Use this around 60% context, or when the task is still the same but the chat has collected too much junk.
/compact keep: current task, file paths in play, decisions made, last failing test output 4. Optional tools
Do not install everything on day one. Add these only when the pain is obvious.
Graphify
Use for large repos where Claude keeps searching to understand structure.
pip install graphifyy
graphify install
graphify claude install claude-mem
Use when you keep re-explaining the same project state across sessions.
npx claude-mem install Caveman
Use for prose-heavy reviews, docs, and long exploratory chats.
npx skills add JuliusBrussee/caveman
/caveman
# or: caveman mode
# disable: stop caveman 5. What this is reducing
Input
Tool output, file dumps, logs, grep results.
Output
Preambles, summaries, full-file echoes, extra alternatives.
Thinking
Large hidden reasoning budgets on routine tasks.
Context
Old chat history being resent as the thread grows.
The page is short on purpose. Send less junk in, ask for less junk out, keep the thread short, and make the codebase easier to read.
6. Choose by pain
Do not install a pile of tools. Pick the thing that matches the leak you can see.
Terminal output
RTK
Prose output
CLAUDE.md + Caveman
Large repo navigation
Graphify first; test heavier index tools later
MCP or log dumps
Consider Context Mode later
7. Full copy/paste script
Run this from the repo root. It updates your shell rc, installs RTK, and appends the token rules to `CLAUDE.md` without overwriting the file.
#!/usr/bin/env bash
set -euo pipefail
RC_FILE="${HOME}/.zshrc"
if [ -n "${BASH_VERSION:-}" ]; then
RC_FILE="${HOME}/.bashrc"
fi
add_line() {
local line="$1"
grep -qxF "$line" "$RC_FILE" 2>/dev/null || echo "$line" >> "$RC_FILE"
}
touch "$RC_FILE"
echo "Adding Claude Code defaults to $RC_FILE"
add_line 'export MAX_THINKING_TOKENS=8000'
add_line 'export CLAUDE_CODE_SUBAGENT_MODEL=haiku'
echo "Installing RTK for compressed command output"
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/master/install.sh | bash
rtk init -g
CLAUDE_MD="./CLAUDE.md"
MARKER="<!-- claude-token-rules -->"
if [ ! -f "$CLAUDE_MD" ]; then
touch "$CLAUDE_MD"
fi
if ! grep -q "$MARKER" "$CLAUDE_MD"; then
cat >> "$CLAUDE_MD" <<'EOF'
<!-- claude-token-rules -->
## Token rules
- No preamble.
- No flattery.
- No recap unless I ask.
- Do not echo files back after editing them.
- Use Edit or patch for small changes.
- Read file ranges when possible. Do not dump huge files "just in case".
- Do not offer three options when one clear recommendation is enough.
- For small tasks, act. For larger tasks, give 3-5 bullets and stop.
<!-- /claude-token-rules -->
EOF
fi
echo
echo "Done. Open a new terminal, then measure usage with:"
echo " npx ccusage@latest daily"
echo " npx ccusage@latest blocks --live"
echo " /context # run inside Claude Code"
echo
echo "Check RTK after a few sessions with:"
echo " rtk gain"
echo " rtk gain --graph"
echo " rtk discover"
echo
echo "Compact prompt to keep nearby:"
echo " /compact keep: current task, file paths in play, decisions made, last failing test output"