- Add TypeScript project structure with Bun runtime - Implement CLI commands for session, project, stats, and optimization - Add SQLite database integration with prepared statements - Include AGENTS.md for development guidelines - Add Makefile for common development tasks - Configure ESLint and TypeScript with strict mode
3.7 KiB
3.7 KiB
Here are the best tips and best practices for maximizing your Claude Code usage and avoiding those dreaded limits:
1. Master Your Context (The Token Saver)
Every message you send re-sends the entire conversation history to Claude, which is what eats up your tokens. The goal is to keep this history short and clean.
- Use
/clearFrequently: This is the most crucial command. Use it to completely wipe the current conversation history when you finish a task, switch to an unrelated bug, or start a new feature.- Tip: When you clear, have Claude first write a summary of the finished work to a file (e.g.,
session-notes.md). Then, in the new session, simply reference that file to catch Claude up without re-sending the hundreds of messages.
- Tip: When you clear, have Claude first write a summary of the finished work to a file (e.g.,
- Use
/compact: If the conversation is getting long but you still need the history, use the/compactcommand. Claude will summarize the history, reducing the token count while preserving key context. - Leverage
CLAUDE.mdfor Long-Term Memory: Create aCLAUDE.mdfile in your project root. Claude Code reads this automatically at the start of every session. Use it for:- Project architecture and tech stack.
- Coding style guides (e.g., "Use snake_case for APIs").
- Common commands (e.g.,
npm run test). - This saves you tokens by preventing you from repeating the same instructions or context in every new chat.
- Target Your Files: Instead of letting Claude try to search for the right file, explicitly mention the files it needs to read or modify using the
@symbol or full file paths. This prevents Claude from wasting tokens reading unnecessary parts of your codebase.
2. Optimize Your Workflow (The Efficiency Booster)
- Batch Your Requests: Group similar requests or steps into a single, detailed prompt.
- Instead of: 1. "Fix the typo in the config file." 2. "Now, run the tests." 3. "Commit the change."
- Use: "Fix the typo in the config file, run the unit tests, and if they pass, commit the change with the message 'fix: corrected config typo'."
- Use the Right Model for the Job:
- Claude Opus (Max Plans): Reserve Opus for high-level, complex tasks like architecture planning, intricate debugging, or large refactors. Opus consumes your allowance much faster.
- Claude Sonnet: Use Sonnet for implementation, writing boilerplate code, documentation, or routine fixes. It offers a much higher number of prompts per session.
- Adopt a "Plan First" Approach:
- Plan: Ask Claude to first create a detailed, step-by-step plan for the task. You can use phrases like
"think hard"to give it a higher computation budget for this step. - Review: Review and approve the plan.
- Execute: Give the final go-ahead. This avoids wasting tokens on a long, iterative conversation if Claude was on the wrong path from the start.
- Plan: Ask Claude to first create a detailed, step-by-step plan for the task. You can use phrases like
3. Be Strategic with the 5-Hour Window (The Time Hack)
- The Overlap Hack: If you know you have an intensive work session coming up, you can deliberately send a very short message 2-3 hours before you start your main work. This starts the 5-hour timer for your first session. When your first session allowance is depleted, the second 5-hour session will be due for a reset, allowing you to seamlessly start fresh and continue working without a prolonged break.
- Cycle Your Work: When your Claude Code session runs out, switch to tasks that do not require the AI (e.g., meeting prep, email, manual testing, or architecture review). Come back to Claude when the 5-hour window has reset.
These strategies allow you to treat Claude Code like a powerful, highly-focused partner, giving it concentrated work blocks to maximize your session usage.