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 ignoreConsider ignoring
node_modules, dist, buildLarge data files (.csv, .json dumps)
.env, credentialsGenerated code
Lock filesBinary 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.

Source: docs.anthropic.com/en/docs/claude-code/overview

Working out which model to run this on? See The Codex. Packaging it as a reusable skill? See The Armory.