Claude Code Best Practices

Habits that save tokens and get better results

Your setup already includes optimized settings. This guide covers the habits and commands that make the biggest difference in day-to-day use. Bookmark this page for reference.

The one thing to remember: Every message you send carries your entire conversation history. Longer conversations = more expensive messages. Keep sessions short and focused.

1. Session Habits

Keep sessions short High Impact

Token cost accelerates as conversations grow. By message 30, a single prompt costs ~167,000 tokens because the entire history is re-sent. Start fresh sessions for new tasks. A series of short sessions is dramatically cheaper than one long marathon.

Use handoff before context gets high High Impact

Watch the context percentage in your status bar. When it reaches around 50%, type handoff. Claude saves everything to a file. Then type /exit and start fresh with cc. Your next session picks up exactly where you left off.

Why not wait? When context gets too full, Claude automatically compresses the conversation, which can lose important details about your work. A clean handoff preserves everything perfectly.

Never resume old sessions High Impact

Resuming a day-old conversation forces Claude to re-process the entire history at full price (the cache has expired). Multiple users reported losing 20-28% of their usage on a single resumed message. Start a new session instead.

Use /btw for side questions Medium Impact

The /btw command asks a question in a popup that never enters your conversation history. Perfect for quick questions like "what does this error mean?" without bloating your context. Can reduce usage by up to 50% in question-heavy sessions.

If Claude seems confused, start fresh Medium Impact

After 2-3 failed attempts at the same fix, type /clear and write a better prompt that includes what you learned. A clean session with a good prompt beats a bloated session with accumulated confusion.

2. Writing Better Prompts

Be as specific as you can

When possible, point Claude to the specific file or area. For example, "the login page crashes when I leave email empty" is better than "something is broken". If you know the file name, even better: "Fix the bug in src/login.js". The more specific you are, the fewer tokens Claude uses searching.

Paste errors, don't describe them

Copy-paste the actual error message or output. Your description loses details Claude needs and costs extra tokens for less information.

One task at a time

Instead of "fix the login bug and also add a signup page and update the database schema", break it into separate requests. Each focused prompt gets better results and uses fewer tokens.

3. Model Selection

Claude Code can use different models. Matching the model to the task saves significant tokens.

ModelBest ForRelative Cost
Haiku File lookups, search, renaming, formatting 1x (cheapest)
Sonnet Daily coding, tests, simple edits ~4x
Opus Complex architecture, subtle debugging ~15x

Type /model sonnet or /model opus to switch mid-session. For everyday work, Sonnet is usually enough. Switch to Opus only when you genuinely need deep reasoning.

If a task is straightforward and you want even faster responses, type /effort low. For hard problems, type ultrathink in your message for one-off deep reasoning.

4. Commands Quick Reference

Essential

Useful

5. What NOT to Do

Don't resume old sessions

The cache expires after inactivity. Resuming reprocesses everything at full price. Start a new session instead.

Don't wait for context to fill up

Type handoff at 50%. Don't wait for Claude to auto-compress your conversation - compression loses details.

Don't use Opus for everything

Opus costs ~15x more per token than Haiku. Most coding tasks work perfectly fine on Sonnet.

Don't keep iterating in a broken session

After 2-3 failed attempts, /clear and start over with a better prompt. Cheaper and usually more effective.