Cursor Best Practice ✨

February 2, 2025 (3d ago)

Basic Editing Experience

  • Tab Engineer
  • Multi-Line Edits
  • Smart Rewrites

Chat

Chat lets you talk with an AI that sees your codebase. The chat can always see your current file and cursor, so you can ask it things like: "Is there a bug here?". You can add particular blocks of code to the context with ⌘+Shift+L or "@." You can chat with your entire codebase with ⌘+Enter.

  • Instant Apply
  • Codebase Answers
  • Directly Reference Code
  • Images using multi-modal to generate code
  • Ask web use @Web indicator (search)
  • Add documentation address as more ctx. for RAG process

Editing Code and Cmd + K

⌘ K lets you edit and write code with the AI. To edit, try selecting some code, click "Edit," and describe how the code should be changed. To generate completely new code, just type ⌘ K without selecting anything.

  • Fast Edits
  • Terminal Cmd + K
  • Quick Questions
  • Inline Generations
  • Inline Edits

Context Engineering

  • Enable Workspace / Project Indexing
  • General Cursor Rule
  • .cursorrules for project system prompt
  • @ Symbol boost
    • Files: auto / full-file / outline / chunks
    • Folders: is especially useful for long context chat where you want to provide a lot of context to the AI.
    • Code : select and add to chat
    • Docs : reference to docs lib in project
    • Git : check the git diff and info
    • CodeBase : Through @Codebase, Cursor Chat goes through these steps until it finds the most important pieces of code to use.
      • Gathering: scanning through your codebase for important files / code chunks
      • Reranking: reordering the context items based on relevancy to the query
      • Reasoning: thinking through a plan of using the context
      • Generating: coming up with a response
    • Web : use extra context searching with web
    • Chat : with specific chat-history / sessions
    • Definitions : symbol adds all nearby definitions to Cmd K as context.
  • PastedLinks
  • .cursorignore : This file allows you to specify which files or directories should be excluded from indexing, ensuring that only relevant content is considered during the context engineering process.

Note Pads

Notepads are powerful context-sharing tools in Cursor that bridge the gap between composers and chat interactions. Think of them as enhanced reference documents that go beyond the capabilities of .cursorrules, allowing you to create reusable contexts for your development workflow.

Notepads serve as collections of thoughts, rules, and documentation that can be:

  • Shared between different parts of your development environment
  • Referenced using the @ syntax
  • Enhanced with file attachments
  • Used as dynamic templates for various development scenarios

General Scenarios

  1. Dynamic Boilerplate Generation

    • Create templates for common code patterns
    • Store project-specific scaffolding rules
    • Maintain consistent code structure across your team
  2. Architecture Documentation

    • Frontend specifications
    • Backend design patterns
    • Data model documentation
    • System architecture guidelines
  3. Development Guidelines

    • Coding standards
    • Project-specific rules
    • Best practices
    • Team conventions

Advanced Composer

Composer is your AI coding assistant that lives in your editor. It helps you explore code, write new features, and modify existing code without leaving your workflow. Use ⌘I to open it, and ⌘N to create a new Composer.

Enable Agent with ⌘. to get a coding partner that proactively works with your codebase:

  • Automatically pull relevant context (try @Recommended)
  • Run terminal commands
  • Create and modify files
  • Search code semantically
  • Execute file operations

Agent can make up to 25 tool calls before stopping. For now, Agent supports only Claude models.

  • Iterate on lints → Composer attempts to fix linting issues in generated code for most programming languages. If Composer detects lint errors, it will try to fix them automatically when this feature is enabled. Currently, only one iteration is supported.

VSCode Features

  • VSCode Extensions and Configs migration

  • Search with Alfred with PROJECT

Engineering Workflow

  • Commit Msg Generation → in git tab
  • Bug Finder → based on the diff info and git related things

Reference


Arno Crafting Apps

ELABORATION STUDIO 🦄

Elaborate your ideas and solve your problems with AI in fully boosted context way ~