Skip to content
>_devvkit
$devvkit learn --librarie cursor-guide

Cursor Guide

[ai][editor][completion][vibe-coding]
AI / LLM Tools
Install
# Download from cursor.com
# macOS:
brew install --cask cursor
# Linux/WSL: download .AppImage from cursor.com
# Windows: download .exe installer

Cursor is the most popular AI-native IDE. It starts with VS Code's ecosystem (extensions, themes, terminal, debugger) and adds deep AI integration: Tab (autocomplete that predicts multi-line edits), Chat (Ctrl+K to edit, Ctrl+L to ask), and Composer (Ctrl+I for multi-file agentic edits).

The key to vibe coding in Cursor is the Composer mode. Press Ctrl+I, describe what you want in natural language, and Cursor reads your project files, generates the code, and creates diffs across multiple files. Review each diff before accepting with Cmd+Enter. The Agent mode writes files, creates them, runs terminal commands, and fixes errors autonomously.

Cursor's .cursorrules file at project root defines the AI's behavior — specify your stack, coding conventions, and preferences. Use `.cursor/rules/` directory for scoped rules per folder. Cursor supports custom models via API keys (Claude, GPT-4o, Gemini) or local models via Ollama.

Tab Completion

Tab completionAI autocomplete.
# Tab works automatically as you type.
# Accept suggestion: Tab
# Accept word: Ctrl+Right
# Reject: Esc
# Next suggestion: Alt+]
# Previous suggestion: Alt+[

# To get Tab for a comment-to-code workflow:
# Type a comment describing the function, then hit Enter
# Tab will suggest the implementation

Chat & Edit

Chat — edit selectionEdit highlighted code.
# Select code, press Ctrl+K (Cmd+K on Mac)
# Type your edit instruction:
"add error handling"
"convert to async/await"
"add JSDoc types"
"make this O(n) instead of O(n^2)"
"extract this into a utility function"

# Press Enter to apply the diff
# Use Ctrl+Z to undo the AI edit if needed
Chat — ask about codeUnderstand your codebase.
# Select code, press Ctrl+L (Cmd+L on Mac)
# Or open chat panel with Cmd+Shift+I

# Questions to ask:
"how does this auth middleware work?"
"what does this regex match?"
"find the bug in this function"
"add type annotations to this"
"explain this complex logic in simple terms"

Composer

ComposerMulti-file agentic edits.
# Open Composer: Cmd+I (Ctrl+I on Windows)

# Write your prompt in natural language:
"Create a full CRUD API for users in Express.
  Use Prisma for the database layer.
  Follow the existing patterns in src/routes/."

# Composer will:
# 1. Read relevant files for context
# 2. Create/modify files as needed
# 3. Show diffs for each file
# 4. Apply with Cmd+Enter (accept all)
# Or accept/reject individual files
Composer — Agent modeAutonomous agent.
# Switch Composer to Agent mode:
# Click the dropdown in Composer and select "Agent"

# Agent mode can:
# - Create files: "create a new React component"
# - Run terminal commands: "install zod and set it up"
# - Fix errors: "the build is failing, fix it"
# - Search the web: "find the latest Prisma docs"

# Always review the terminal output!
# Agent runs commands with your permission

Rules

.cursorrules best practicesCraft effective rules.
# .cursorrules — do's and don'ts

# DO: Be specific about your stack
"Our stack: Next.js 14, Tailwind CSS, Prisma, PostgreSQL"

# DO: Specify patterns to follow
"Use server actions for mutations, not API routes"
"Components go in src/components/, pages in src/app/"

# DON'T: Be too verbose (wastes context)
"Be good. Write clean code." # useless

# DO: Include critical constraints
"Never use `any` type. Avoid `// eslint-disable-next-line`"

Custom Models

Custom model setupUse your own API key or local model.
# Cursor Settings > Models > OpenAI API Key
# Enter your API key for GPT-4o, Claude, etc.

# Or use local models via Ollama:
# Settings > Models > Add Model > Provider: Ollama
# Model name: llama3.2
# Base URL: http://localhost:11434

# Recommended models for vibe coding:
# - Claude Sonnet 4 (best overall)
# - GPT-4o (close second)
# - Gemini 2.5 Flash (fast, good for simple tasks)

Tips

Basic setupConfigure Cursor for vibe coding.
# .cursorrules — project-level AI instructions
You are an expert TypeScript developer.
- Prefer functional patterns over classes
- Use Zod for validation
- Write async/await, no callbacks
- Follow existing patterns in the codebase
- Add comprehensive error handling
- Add JSDoc comments for public APIs

# Place this file at the root of your project