SOP-011: @ Mentions
Document Control
| Field | Value |
|---|---|
| SOP ID | SOP-011 |
| Version | 1.0 |
| Status | Active |
| Last Updated | 2024-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 Type | Purpose |
|---|---|
@Files & Folders | Reference entire files or directories |
@Code | Reference specific code sections |
@Docs | Use external documentation |
/Commands | Built-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:
- Type
@filename→ Select from suggestions - Type
@Files & Folders→ Search - 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
@calculateTotalto 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:
- Type
@Docs - Select "Add new doc"
- Paste documentation URL
- 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):
- Explicit @ mentions (highest priority)
- Related files (auto-detected)
- Recent changes
- 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
| Mention | Purpose | Example |
|---|---|---|
@filename | Reference file | @UserService.ts |
@folder/ | Reference folder | @src/components/ |
@Code | Reference symbol | @calculateTotal |
@Docs | Use documentation | @Docs:react |
/command | Run command | /summarize |
Built-in Commands
| Command | Description |
|---|---|
/summarize | Compress context window |
Custom Commands: Create .cursor/commands/[name].md for project-specific commands.
Keyboard Shortcuts for Context
| Action | Shortcut |
|---|---|
| Add selection to Chat | Cmd+Shift+L / Ctrl+Shift+L |
| Add selection to new chat | Cmd+L / Ctrl+L |
| Add selection to Edit | Cmd+Shift+K / Ctrl+Shift+K |
| Paste as context | Cmd+V (with code in clipboard) |
| Paste as text | Cmd+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
| Issue | Solution |
|---|---|
| File not found in @ | Check file is in workspace |
| Docs not indexing | Check URL is accessible |
| Too much context | Use @Code for specific symbols |
| Context not applying | Check @ mention is complete |
| Folder too large | Reference specific subfolders |