If you've been using Claude Code on larger repositories, you've probably noticed your usage costs spiking fast.
The issue usually isn't the code changes you're making. It's that Claude is automatically indexing giant, irrelevant folders, like node_modules, build artifacts, or huge media files—every single time you run a command.
You can instantly cut your token usage by creating a .claudeignore file in your root folder.
It works exactly like a .gitignore file. It tells the terminal agent precisely what to ignore so it stops
paying attention to things it doesn't need to see.
Here is a quick template to drop into your repo today:
# Dependencies
node_modules/
.npm/
# Build outputs and caches
dist/
build/
.next/
.cache/
# Large assets and environments
public/assets/
*.mp4
*.png
.env*
Why this fixes your budget:
- Smaller Context Window: Claude doesn't waste time or tokens reading compiled code, images, or third-party packages.
- Faster Responses: Because the AI doesn't have to scan thousands of unneeded lines, your terminal commands execute in a fraction of the time.
If your API bill has been creeping up, take thirty seconds to drop a .claudeignore file into your workspace. Your wallet will thank you.