Cursor has rapidly become the dominant AI-first code editor for modern development. By blending standard VS Code mechanics with deep LLM orchestration, it allows engineers to write, refactor, and audit code at unprecedented speeds.
This reference sheet covers the essential keyboard shortcuts, AI context steering commands, and provides a production-grade .cursorrules template to align Cursor with your specific stack.
- Cmd+K (Ctrl+K): Edit or generate code in-place inside your active editor window
- Cmd+L (Ctrl+L): Open the AI Sidebar Chat to ask questions about your codebase
- Cmd+I (Ctrl+I): Open Composer for multi-file edits and project-wide creation
- @Files / @Folders: Force the AI to look at specific files or directories for context
- .cursorrules: Commit this file to your project root to enforce custom instructions, style guides, and coding patterns on all AI interactions
Before diving into this cheatsheet, check out my previous deep-dive on Cursor AI Editor Cheat Sheet: Features, Shortcuts & Workflows to see how we structured these patterns in practice.
1. Core AI Keyboard Shortcuts
Mastering these shortcuts is the fastest way to accelerate your daily workflow.
| Action | macOS Shortcut | Windows/Linux Shortcut | Description |
|---|---|---|---|
| Inline Edit | Cmd + K | Ctrl + K | Generate or edit code in-place on selected lines |
| Sidebar Chat | Cmd + L | Ctrl + L | Open the persistent chat pane for codebase queries |
| Open Composer | Cmd + I | Ctrl + I | Open the multi-file editor agent (full window/pane) |
| Accept Edit | Cmd + Y | Ctrl + Y | Accept the diff suggestion generated inline or in Composer |
| Reject Edit | Cmd + N | Ctrl + N | Reject the diff suggestion and revert the changes |
| Add to Context | Cmd + Shift + L | Ctrl + Shift + L | Add selected code lines directly into active chat |
2. Context Modifiers (@ Symbols)
Use these modifiers inside Chat (Cmd+L), Inline Edit (Cmd+K), or Composer (Cmd+I) to constrain the AI’s attention and prevent hallucination.
| Context Modifier | Command | What It Does |
|---|---|---|
| File Reference | @<filename> | Feeds the exact content of a specific file into the prompt context |
| Folder Reference | @<folder_name> | Indexes all files inside the specified directory |
| Codebase Search | @Codebase | Triggers a semantic search across the entire project repository |
| Web Search | @Web | Allows the AI to query Google/Bing for fresh docs or APIs |
| Git Diff | @Git | Passes unstaged changes or git commits to the AI model |
| Terminal Context | @Terminal | Attaches the active terminal buffer for debugging error logs |
3. Writing the Perfect .cursorrules File
Committing a .cursorrules file to your project root forces Cursor’s AI model to follow strict coding standards, preventing generic or outdated boilerplate.
Standard Production .cursorrules Template
Below is a production-grade template tailored for modern TypeScript, Astro, and Tailwind CSS environments:
{
"settings": {
"frameworks": ["Astro", "React"],
"styling": "TailwindCSS v4",
"packageManager": "pnpm"
},
"rules": {
"typescript": {
"prefer": "interfaces over types",
"strictNullChecks": true,
"explicitReturnTypes": false
},
"coding_standards": [
"Always write clean, dry, and modular component designs.",
"Separate business logic from presentational components.",
"Keep functions small and focused on a single responsibility.",
"Avoid deeply indented conditional blocks; use early returns instead.",
"Do not write inline imports; define imports at the top of the file."
],
"naming_conventions": {
"components": "PascalCase (e.g., PostCard.astro)",
"utilities": "camelCase (e.g., dateUtils.ts)",
"folders": "kebab-case (e.g., blog-components/)",
"constants": "UPPER_SNAKE_CASE (e.g., MAX_ITEMS)"
},
"styling_rules": [
"Use utility-first Tailwind classes.",
"Order classes logically: Layout (flex, grid) -> Sizing (w, h) -> Spacing (p, m) -> Typography -> Design (bg, border) -> Interactive (hover, focus).",
"Do not write custom CSS in style blocks unless tailwind classes are insufficient."
],
"ai_response_guidelines": {
"tone": "terse, professional, pragmatic",
"code_only_when_requested": false,
"explain_before_code": true,
"verbosity": "medium",
"forbidden_phrases": [
"obvious",
"clutter",
"repetitive"
]
}
}
}
4. Advanced Composer Operations (Cmd + I)
The Composer is a multi-file orchestration agent. Use these workflows to scaffold features:
Scaffolding a New Module
- Open Composer (
Cmd+I). - Toggle Agentic Mode (enables Cursor to run commands, edit files, and self-correct).
- Issue a structural prompt:
Create a new blog feature under /src/components/blog/. I need a PostCard.astro component, a central author matching utility under /src/utils/authors.ts, and a test suite. Follow the rules in our @.cursorrules file. - Review the multi-file file diffs.
- Click Accept All (
Cmd+Y) or reject individual file diffs manually.
Multi-File Refactoring
- Select a function or folder, hit
Cmd+I, and prompt:Refactor this utility to use the new Drizzle ORM schemas found in @schema.ts. Ensure all files importing this utility are updated to reflect the new return types.
5. Pro Tips for Peak Performance
- Model Selection: Use Claude 3.5 Sonnet (default) for complex logic, refactoring, and code generation. Use GPT-4o for quick formatting, unit tests, and terminal diagnostic queries.
- Rules Inheritance: You can put separate
.cursorrulesfiles inside local subdirectories (e.g.,src/components/blog/.cursorrules) to apply local styling or architectural overrides strictly to that folder. - Avoid Context Bloat: Do not use
@Codebasefor simple questions. Limit@inclusions to the exact files you are editing to prevent the AI from losing track of details due to long context windows.
Related Articles
Deepen your understanding with these curated continuations.
XML Prompt Engineering Cheatsheet: Steering LLMs at Scale
Master XML prompting for Claude 3.5 and Gemini 1.5. Learn how to structure prompt hierarchies, input variables, few-shot templates, and output tags.
Ollama & Local LLM Management Cheatsheet: Self-Hosted AI Guide
Master local LLM operations with Ollama. Learn core CLI commands, custom Modelfile syntax, GPU environment tuning, and REST API integrations.
macOS Keyboard Shortcuts Cheat Sheet: The Ones Worth Knowing
Skip the ones you'll never use. This macOS shortcuts cheat sheet covers the 60+ commands that actually save time — system, Finder, text, screenshots, and more.