When an agent searches your repo, everything it can see is a candidate for context: dependency folders, build output, lockfiles, logs, coverage reports. That is how a simple question ends up burning a large share of your usage limit.
The ignore files
- Claude Code:
.claudeignore(gitignore syntax) - Cursor:
.cursorignorefor indexing and context - Both still benefit from a sane
.gitignore
A starting point
node_modules/ .venv/ venv/ dist/ build/ .next/ out/ coverage/ *.log *.lock package-lock.json pnpm-lock.yaml *.min.js *.map .env* Lockfiles are worth calling out. They are large, change often and almost never help the agent answer a question.
Check what is actually being read
Ask the agent to list the files it opened for a typical task. If you see anything generated, vendored or minified, add it to the ignore file.
Monorepos
Ignore the packages you are not working on, or start the session from the package folder. An agent scoped to packages/api does not need to know packages/mobile exists.
Checklist
- [ ] Ignore file exists for each tool you use
- [ ] Dependency, build and coverage folders are listed
- [ ] Lockfiles and minified bundles are listed
- [ ]
.env*is listed (and denied in permissions too)
Disclosure: I built a small tool for this. It reads only your folder and file names (no source code), flags missing setup files, ignore rules and secret exposure, and can generate a CLAUDE.md / ignore / settings bundle for your repo.
- Free diagnosis (3 per day): https://web-production-e6e1bf3c.up.railway.app/en?utm_source=devto&utm_campaign=article&utm_content=145
- Sample reports: https://web-production-e6e1bf3c.up.railway.app/samples?utm_source=devto&utm_campaign=article&utm_content=145
Launch deal: $10 instead of $19 until Dec 19.
