.cursorignore: how it works
.cursorignore uses .gitignore syntax to list files Cursor should leave out of codebase indexing and AI features such as chat, Agent, inline edit and @-mentions. Cursor already skips files in .gitignore when indexing, so .cursorignore is for files you track or keep locally but do not want sent to a model: .env files, keys, large fixtures and generated code. Exclusion is best effort: commands the agent runs in the terminal, and MCP tools, can still read ignored files. To keep files out of the index but still usable on request, use .cursorindexingignore.
Where the file goes
./.cursorignoreRepo rootExcludes matching files from indexing and AI features../.cursorindexingignoreRepo rootExcludes files from the index only; you can still add them to a request.
What goes in it
! re-includes a file a wider pattern excluded.# Secrets and credentials .env* !.env.example *.pem *.key service-account*.json
# Build output and generated code .next/ dist/ coverage/ src/generated/ *.min.js # Large fixtures fixtures/**/*.json
Tips
- Start with secrets:
.env*(except.env.example), keys, certificates and service-account files. - Add generated code and build output that is tracked in git;
.gitignorealready covers the rest for indexing. - Do not treat it as a security boundary. Keep real secrets out of the repo and out of the agent's shell.
- Use
!patternto re-include a file that a wider pattern excluded, such as!.env.example.
.cursorignore presets (21)
Each one opens the generator with that file filled in for the stack. Change what you need, then copy or download it.
- Next.js 16 App Router
Frontend
- React 19 & Vite
Frontend
- Python FastAPI & Pydantic v2
Backend
- Supabase & PostgreSQL
Fullstack & DB
- Prisma ORM
Fullstack & DB
- Drizzle ORM
Fullstack & DB
- Go (Golang) & Fiber
Backend
- Rust & Axum
Backend
- Tailwind CSS v4
Frontend
- Vue 3 & Nuxt 4
Frontend
- SvelteKit & Svelte 5
Frontend
- Docker & CI/CD
DevOps & Tooling
- Django 6 & Ninja / DRF
Backend
- Bun & Elysia / Hono
Backend
- React Native & Expo Router
Frontend
- Flutter 3 & Riverpod / Dart
Frontend
- Kubernetes & Helm Charts
DevOps & Tooling
- Terraform & OpenTofu IaC
DevOps & Tooling
- Playwright End-to-End Testing
DevOps & Tooling
- Spring Boot 4 & Java 25
Backend
- .NET 10 & C# 14 Minimal APIs
Backend
Not sure .cursorignore is the file you need? Each AI coding tool reads its own file from its own place.
Which file do I need?Frequently asked questions
Does .cursorignore replace .gitignore?
No. .gitignore decides what git tracks; .cursorignore decides what Cursor's indexing and AI features can use. Cursor already respects .gitignore for indexing, so list only the extra files.
Is a file in .cursorignore hidden from the agent completely?
No. Cursor treats it as best effort: ignored files stay out of indexing, chat context and edits, but terminal commands and MCP tools the agent runs can still read them.
.cursorignore vs .cursorindexingignore?
.cursorignore excludes files from indexing and AI features. .cursorindexingignore only keeps files out of the index, so codebase search skips them but you can still add them to a request.