home / skills / jeremylongshore / claude-code-plugins-plus-skills / cursor-codebase-indexing

This skill helps you set up and optimize Cursor codebase indexing for fast semantic search and improved AI context awareness.

npx playbooks add skill jeremylongshore/claude-code-plugins-plus-skills --skill cursor-codebase-indexing

Review the files below or copy the command above to add this skill to your agents.

Files (9)
SKILL.md
1.8 KB
---
name: "cursor-codebase-indexing"
description: |
  Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup",
  "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".
allowed-tools: "Read, Write, Edit, Bash(cmd:*)"
version: 1.0.0
license: MIT
author: "Jeremy Longshore <[email protected]>"
---

# Cursor Codebase Indexing

## Overview

### What is Codebase Indexing?
```
Codebase indexing creates a searchable representation of your code:
- Enables @codebase queries
- Powers semantic code search
- Improves AI context awareness
- Helps AI understand project structure
```

## Prerequisites

- Cursor IDE installed and authenticated
- Project workspace with source files
- Sufficient disk space for index storage
- Stable network connection for initial setup

## Instructions

1. Open your project in Cursor
2. Navigate to Settings > Cursor > Codebase Indexing
3. Enable "Index this workspace"
4. Create `.cursorignore` file at project root
5. Add exclusion patterns for large/irrelevant directories
6. Wait for indexing to complete (check status bar)
7. Test with `@codebase` queries in chat

## Output

- Indexed codebase enabling `@codebase` queries
- Semantic code search functionality
- Improved AI context awareness
- Searchable symbol table and definitions

## Error Handling

See `{baseDir}/references/errors.md` for comprehensive error handling.

## Examples

See `{baseDir}/references/examples.md` for detailed examples.

## Resources

- [Cursor Indexing Documentation](https://cursor.com/docs/indexing)
- [gitignore Pattern Syntax](https://git-scm.com/docs/gitignore)
- [Cursor Performance Guide](https://cursor.com/docs/performance)

Overview

This skill sets up and optimizes Cursor codebase indexing to enable fast semantic search and improved AI context for your project. It walks through enabling indexing, creating exclusion rules, monitoring progress, and validating results so your Cursor workspace becomes queryable with @codebase. Use this skill to turn a code repository into a searchable, AI-aware knowledge source.

How this skill works

The skill inspects your project workspace and builds a searchable index of source files, symbols, and definitions. It guides you to enable indexing in Cursor, add a .cursorignore file to exclude large or irrelevant paths, and monitor the status bar until indexing finishes. Once complete, the index powers @codebase queries and semantic code search inside Cursor.

When to use it

  • Enabling semantic code search for a new Cursor project
  • Improving AI suggestions by giving the agent structured project context
  • Reducing irrelevant results by excluding large generated folders
  • After cloning or pulling large repositories that need fresh indexing
  • Before running cross-file code analysis or automated refactoring tasks

Best practices

  • Create a .cursorignore at the project root and exclude node_modules, build, dist, and other generated folders
  • Prioritize indexing only source directories to save disk and speed up queries
  • Ensure Cursor is authenticated and you have enough disk space before starting indexing
  • Monitor the status bar and retry if network issues interrupt initial indexing
  • Test with simple @codebase queries after indexing to validate results

Example use cases

  • Search for function definitions and usages across a monorepo using @codebase queries
  • Improve code review context by letting AI reference exact symbol definitions
  • Exclude large test fixtures so semantic search returns relevant production code
  • Rebuild the index after major refactors to keep AI suggestions accurate
  • Set up indexing in CI environments to support automated analysis tools

FAQ

How long does indexing take?

Indexing time depends on repository size and machine performance; small projects finish in minutes while large monorepos can take longer. Use .cursorignore to speed up the process.

What if indexing fails?

Check network connectivity, available disk space, and authentication. Review Cursor status messages and retry. Consult the Cursor error references for detailed troubleshooting.

Can I update the index incrementally?

Yes. Cursor typically updates indexes incrementally as files change. After large changes, a full reindex may be recommended.