Skip to content

Instantly share code, notes, and snippets.

@adityaladwa
Last active July 21, 2025 14:58
Show Gist options
  • Save adityaladwa/d34d3fb39f05a7551ae4a51064ce65a8 to your computer and use it in GitHub Desktop.
Save adityaladwa/d34d3fb39f05a7551ae4a51064ce65a8 to your computer and use it in GitHub Desktop.
Cursor 101
  • Theme setup
  • cursor CLI launcher
  • Keybinding as per your previous editor
  • create account for enhanced support
  • Codebase indexing is the foundation to AI suggestion
    • the more cursor knows about you codebase the better it can give you suggestions
  • Tab, In-line edit and Agent
    • Tab can autocomplete blocks of code
    • CMD + K to open in-line edit box where you can ask what to code using natural language
    • CMD + I to open agent chat
  • Advance
    • Background agents
      • CMD + E to launch a background agent that will create a VM and perform your task which you can review and apply
      • You can integrate with slack as well
    • Cursor Rules
      • You can give rules to cursor like using camelcase for variable names
    • Setup MCP server
      • choose from existing MCP server directory
      • add your own
  • Concepts
    • Tab - Code completion that predicts multi-line edits. Press Tab to accept suggestions based on your current code and recent changes.
    • Agent - An AI that can read and modify code across multiple files. Describe changes in natural language and Agent executes them.
    • Background Agent - Runs tasks asynchronously while you continue working. Can be accessed through the editor or external integrations like Slack.
    • Inline Edit - Edit selected code with natural language. Press ⌘K to describe changes and see them applied in place.
    • Chat - Interface for AI conversations. Supports multiple tabs, conversation history, checkpoints, and export functionality.
    • Rules - Custom instructions that define AI behavior. Set coding standards, framework preferences, and project-specific conventions.
    • Memories - Persistent storage of project context and decisions from past conversations. Automatically referenced in future interactions.
    • Codebase Indexing - Semantic analysis of your codebase. Enables code search, reference finding, and context-aware suggestions.
    • MCP - Model Context Protocol for integrating external tools. Connects to databases, APIs, and documentation sources.
    • Context - Information provided to AI models during code generation. Includes files, symbols, and conversation history.
    • Models - Different AI models available for code generation. Each model has different speed and capability characteristics.
  • Agent
    • CMD + I - Agent is Cursor’s assistant that can complete complex coding tasks independently, run terminal commands, and edit code
    • Modes - Choose between Agent, Ask, Manual, or create custom modes. Each mode has different capabilities and tools to match your workflow.
    • Tools - Agent uses tools to search, edit, and run commands. From semantic codebase search to terminal execution, these tools enable autonomous task completion.
    • Checkpoints - Automatic snapshots track Agent’s changes. Restore previous states if changes don’t work as expected or to try different approaches.
    • Press ⌘T to create new tabs. Each tab maintains separate conversation history, context, and model selection. Cursor prevents multiple tabs from editing the same files. You’ll be prompted to resolve conflicts.
    • Export Agent chats as markdown files for sharing or documentation.
    • Duplicate/fork chats to explore alternative solutions without losing your current conversation.
    • Summarization - Context management for long conversations in chat
      • As conversations grow longer, Cursor automatically summarizes and manages context to keep your chats efficient.
      • While chat summarization handles long conversations, Cursor uses a different strategy for managing large files and folders: smart condensation.
      • When files or folders are too large to fit within the context window, Cursor automatically condenses them. Condensing shows the model key structural elements like function signatures, classes, and methods
      • When a file name appears with a “Significantly Condensed” label, the file was too large to include in full, even in condensed form. Only the file name will be shown to the model.
      • When a warning icon appears next to a file or folder, the item is too large to be included in the context window, even in condensed form.
    • Planning
      • Agent can plan ahead and manage complex tasks with structured to-do lists and message queuing, making long-horizon tasks easier to understand and track.
      • Queue follow-up messages while Agent is working on the current task. Your instructions wait in line and execute automatically when ready.
    • Modes
      • Choose the right mode for your task - from autonomous coding to focused edits
      • Agent - Agent autonomously explores your codebase, edits multiple files, runs commands, and fixes errors to complete your requests.
      • Ask - Read-only mode for learning and exploration. Ask searches your codebase and provides answers without making any changes - perfect for understanding code before modifying it.
      • Manual - Direct editing mode for precise control. Manual only edits the files you explicitly select - no searching, no commands, just focused changes where you need them. Manual mode works best when you know exactly what to edit. Select the right files and give clear instructions.
      • Custom - Create your own modes with specific tool combinations and instructions. Mix and match capabilities to fit your workflow.
      • Press ⌘. for quick switching after you tap on the mode picker dialog
      • Chat can use configured MCP servers to interact with external services, such as databases or 3rd party APIs.
    • Apply - Learn how to apply, accept, or reject code suggestions from chat using Apply
      • Apply is a specialized Cursor model that takes code generated by chat and integrates it into your files. It processes the code blocks from chat conversations and applies the changes to your codebase.
    • Diffs & Review - Review and manage code changes generated by the AI agent
      • When Agent generates code changes, they’re presented in a review interface that shows additions and deletions with color-coded lines. This allows you to examine and control which changes are applied to your codebase.
      • At the end of the agent response, click the Review changes button to see the full diff of the changes.
  • Background Agents - Asynchronous remote agents in Cursor
    • With background agents, spawn asynchronous agents that edit and run code in a remote environment. View their status, send follow-ups, or take over anytime.
    • The machine setup lives in .cursor/environment.json, which can be committed in your repo (recommended) or stored privately
  • Web & Mobile - Run coding agents from any device with seamless handoff to desktop
    • Cursor’s Agent on web brings a powerful coding assistant to every device. Whether you’re on your phone during a walk, or working in your web browser, you can now kick off powerful coding agents that work in the background. When they’re done, you can pick up their work inside Cursor, review and merge changes, or share links with your team to collaborate.
    • Trigger agents directly from Slack by mentioning @Cursor, and when starting agents from web or mobile, opt to receive Slack notifications upon completion.
  • Inline Edit - Edit and ask questions with Inline Edit (Cmd/Ctrl+K) in Cursor
    • Inline Edit lets you edit code or ask questions directly in your editor with ⌘K, which opens an input field where your selected code and instructions create your request.
    • With code selected, ⌘K edits that specific code based on your instructions.
    • Without selection, Cursor generates new code at your cursor position. The AI includes relevant surrounding code for context
    • Quick Question - Press ⌥⏎ in the inline editor to ask questions about selected code.After getting an answer, type “do it” or similar wording to convert the suggestion into code. This lets you explore ideas before implementing.
    • Terminal - In Cursor terminal, press ⌘K to open a prompt bar at the bottom. Describe your desired action and Inline Edit generates a command.
  • Rules - Control how the Agent model behaves with reusable, scoped instructions.
    • Think of them as persistent context, preferences, or workflows for your projects.
    • Project rules live in .cursor/rules. Each rule is a file and version-controlled. They can be scoped using path patterns, invoked manually, or included based on relevance. Subdirectories can include their own .cursor/rules directory scoped to that folder.
    • Rule anatomy - Each rule file is written in MDC (.mdc), a format supporting metadata and content. Control how rules are applied from the type dropdown which changes properties description, globs, alwaysApply.
    • Nested rules - Organize rules by placing them in .cursor/rules directories throughout your project. Nested rules automatically attach when files in their directory are referenced.
    • Good rules are focused, actionable, and scoped. Keep rules under 500 lines. Split large rules into multiple, composable rules Provide concrete examples or referenced files. Avoid vague guidance. Write rules like clear internal docs. Reuse rules when repeating prompts in chat.
  • Memories
    • Memories are automatically generated rules based on your conversations in Chat. These memories are scoped to your project and maintain context across sessions.
  • Codebase Indexing
    • Cursor indexes your codebase by computing embeddings for each file. This improves AI-generated answers about your code.
    • Cursor indexes all files except those in ignore files (e.g. .gitignore, .cursorignore).
    • Agent can fetch PRs, commits, issues, or branches into context using @[PR number], @[commit hash], or @[branch name]. Includes GitHub comments and BugBot reviews when connected.
  • Ignore files
    • Cursor reads and indexes your project’s codebase to power its features. Control which directories and files Cursor can access using a .cursorignore file in your root directory.
    • Why ignore files?
      • Security: Restrict access to API keys, credentials, and secrets. While Cursor blocks ignored files, complete protection isn’t guaranteed due to LLM unpredictability.
      • Performance: In large codebases or monorepos, exclude irrelevant portions for faster indexing and more accurate file discovery.
    • Create a .cursorignore file in your root directory using .gitignore syntax.
    • Use .cursorindexingignore to exclude files from indexing only. These files remain accessible to AI features but won’t appear in codebase searches.
  • Model Context Protocol (MCP) - Connect external tools and data sources to Cursor using MCP
    • MCP connects Cursor to external systems and data. Instead of explaining your project structure repeatedly, integrate directly with your tools.
    • Using mcp.json - Configure custom MCP servers with a JSON file
    • Enable auto-run for Agent to use MCP tools without asking.
  • @ Symbols - Reference code, files, and documentation using @ symbols
    • Navigate suggestions using arrow keys. Press Enter to select. If the suggestion is a category like Files, the suggestions filter to show the most relevant items within that category.
    • @Files - Reference specific files in your project
    • @Folders - Reference entire folders for broader context
    • @Code - Reference specific code snippets or symbols from your codebase
    • @Docs - Access documentation and guides
    • @Git - Access git history and changes
    • @Past Chats - Work with summarized composer sessions
    • @Cursor Rules - Work with cursor rules
    • @Web - Reference external web resources and documentation
    • @Link (paste) - Create links to specific code or documentation
    • @Recent Changes - Create links to specific code or documentation
    • @Lint Errors - Reference lint errors (Chat only)
    • @Definitions - Look up symbol definitions (Inline Edit only)
    • #Files - Add files to the context without referencing
    • / Commands - Add open and active files to the context
  • Git
    • AI Commit Message - Learn how to generate contextual Git commit messages automatically using Cursor’s sparkle icon or shortcuts
    • AI Resolve Conflicts - Let Agent help resolve Git merge conflicts automatically
  • Models
    • A context window is the maximum span of tokens (text and code) an LLM can consider at once, including both the input prompt and output generated by the model.
    • Each chat in Cursor maintains its own context window. The more prompts, attached files, and responses included in a session, the larger the context window grows.
    • Max Mode - Normally, Cursor uses a context window of 128k tokens (~10,000 lines of code). Max Mode is our option to turn on the maximum context windows for all models. This will be a bit slower and more expensive. It is most relevant for Gemini 2.5 Pro and GPT 4.1, which have 1M token context windows.
    • Auto - Enabling Auto configures Cursor to select the premium model best fit for the immediate task and with the highest reliability based on current demand. This feature can detect degraded output performance and automatically switch models to resolve it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment