Skip to content

SOP-011: @ Mentions

Document Control

FieldValue
SOP IDSOP-011
Version1.0
StatusActive
Last Updated2024-12

Purpose

This SOP covers using @ mentions to provide context to Cursor AI, including files, folders, code, and documentation.

Scope

  • @Files & Folders
  • @Code
  • @Docs
  • Built-in commands

Prerequisites

  • Cursor installed and configured
  • Chat or Inline Edit open

Procedure

@ Mentions Overview

Mention TypePurpose
@Files & FoldersReference entire files or directories
@CodeReference specific code sections
@DocsUse external documentation
/CommandsBuilt-in and custom slash commands

Usage: Type @ in chat or inline edit prompt. Use arrow keys to select, Enter to confirm.

Step 1: Reference Files

Usage: Type @ → Select "Files & Folders" → Search for file

Methods:

  1. Type @filename → Select from suggestions
  2. Type @Files & Folders → Search
  3. Drag file from sidebar into chat

Example: "Update @UserService.ts to add password reset functionality"

Large File Handling: Large files are automatically condensed to fit context limits. See file condensation for details.

Step 2: Reference Folders

Usage: Type @ → Select "Folders" → Navigate to folder

What Agent Receives:

  • Folder path
  • Overview of contents
  • File structure

Navigate Deeper: Type / after selecting folder to see subfolders

Example: "Create a new component in @src/components/ similar to Button"

Step 3: Reference Specific Code

Usage: Type @ → Select "Code" → Search for symbol

More Precise Than @Files:

  • Reference specific functions
  • Reference specific classes
  • Reference specific code blocks

Examples:

  • "Refactor @calculateTotal to handle discounts"
  • "Add validation to @UserSchema"

Step 4: Use Documentation

Usage: Type @Docs → Select from available docs or add new

Built-in Docs: React, Vue, Angular, Node.js, Python, Go, and popular frameworks

Add Custom Docs:

  1. Type @Docs
  2. Select "Add new doc"
  3. Paste documentation URL
  4. Cursor indexes all pages

Example: "Using @Docs:react-query, implement data fetching"

Managing Docs:

  • Go to Cursor Settings → Indexing & Docs
  • View, edit, or remove documentation
  • Toggle "Share with team" for team visibility

Step 5: Combine Mentions

Use multiple @ mentions for comprehensive context:

Example Prompts:

"Update @UserController.ts to use the patterns from @BaseController.ts
and follow @Docs:express best practices"

"Create a component in @src/components/ that looks like @Button.tsx
but for form inputs"

"Fix the bug in @OrderService.ts by checking how @PaymentService.ts
handles errors"

Context Management

How Context is Applied

Context Assembly (in priority order):

  1. Explicit @ mentions (highest priority)
  2. Related files (auto-detected)
  3. Recent changes
  4. Applied rules

Context Condensation:

  • Large files summarized
  • Folders show structure overview
  • Prioritize most relevant sections

Result: Final Context → AI Model

View Applied Context

Hover over the context gauge in the prompt input to see:

  • Files in context
  • Applied rules
  • Token usage

Quick Reference

MentionPurposeExample
@filenameReference file@UserService.ts
@folder/Reference folder@src/components/
@CodeReference symbol@calculateTotal
@DocsUse documentation@Docs:react
/commandRun command/summarize

Built-in Commands

CommandDescription
/summarizeCompress context window

Custom Commands: Create .cursor/commands/[name].md for project-specific commands.


Keyboard Shortcuts for Context

ActionShortcut
Add selection to ChatCmd+Shift+L / Ctrl+Shift+L
Add selection to new chatCmd+L / Ctrl+L
Add selection to EditCmd+Shift+K / Ctrl+Shift+K
Paste as contextCmd+V (with code in clipboard)
Paste as textCmd+Shift+V

Verification Checklist

  • [ ] @Files shows file picker
  • [ ] @Folders shows folder browser
  • [ ] @Code shows symbol search
  • [ ] @Docs shows documentation options
  • [ ] Can add new documentation
  • [ ] Combined mentions work in prompts
  • [ ] Context gauge shows applied context

Troubleshooting

IssueSolution
File not found in @Check file is in workspace
Docs not indexingCheck URL is accessible
Too much contextUse @Code for specific symbols
Context not applyingCheck @ mention is complete
Folder too largeReference specific subfolders

See Also

Built with VitePress | Powered by Claude AI