Context
ClaudeCursor
Foundations
Ignore Files for AI
Use .claudeignore and .cursorignore to exclude files from AI context
10 of 66
Why ignore files?
AI agents read your project files for context. Large or irrelevant files waste tokens, slow responses, and can confuse the agent.
.claudeignore
Works like .gitignore. Place at your project root:
node_modules/ dist/ build/ *.min.js *.lock .env coverage/
Claude Code skips these files when reading your project.
.cursorignore
Same syntax, same purpose for Cursor:
node_modules/ dist/ *.min.js .env
Place at your project root. Cursor will not index or read these files.
What to ignore
| Always ignore | Consider ignoring |
|---|---|
| node_modules, dist, build | Large data files (.csv, .json dumps) |
| .env, credentials | Generated code |
| Lock files | Binary assets (images, fonts) |
| coverage/ | Vendored dependencies |
Tip
Start with your .gitignore as a base, then add project-specific exclusions. Both tools respect their own ignore file independently of git.