Cursor AI Prompts
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Cursor AI Prompts constitute the core logic and operational guidelines for the Cursor agentic AI assistant. Integrated within the IDE, these prompts define how the assistant interacts with users, processes codebase context, and executes technical tasks autonomously. The system is designed to facilitate pair programming by reconciling user intent with automated tool execution, enabling the AI to solve coding tasks ranging from simple debugging to complex feature implementations.
The primary objective of these prompts is to ensure the assistant operates as a high-signal, proactive agent that prioritizes technical accuracy, skimmability, and direct action. It leverages advanced context understanding through semantic search and parallelized tool calling to maintain an efficient workflow within the developer's environment.
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:1-12, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:1-10
Core Operational Logic
Workflow Execution Flow
The Cursor agent follows a specific sequence when a user provides a goal. It begins with a discovery pass to scan the codebase, followed by the creation of a structured plan via a TODO list for medium-to-large tasks. The assistant then executes tool batches, providing status updates before and after significant actions.
The assistant is mandated to keep going until the user's query is completely resolved, only yielding back once the problem is verified as solved.
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:38-44, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:33-38
Task Management (TODO System)
For non-trivial tasks, the todo_write tool is used to manage atomic, verb-led tasks. These items are strictly defined to be high-level and meaningful, excluding minor operational steps.
| Component | Requirement |
|---|---|
| Task Definition | Atomic items ≤ 14 words; verb-led outcomes. |
| Next Task State | Must be set to in_progress before starting work. |
| Completion Rule | Mark as completed immediately after execution; no batching. |
| Justification | One-line explanation required if a task is cancelled. |
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:130-145, Qoder/prompt.txt:27-38
Context and Search Strategy
Semantic vs. Grep Search
The system prioritizes codebase_search (semantic search) as the primary exploration tool. It is designed to capture overall intent (e.g., "authentication flow") rather than just low-level string matches. Grep is reserved for finding exact symbols, strings, or regex patterns.
Parallelization Policy
A critical instruction for the assistant is the maximization of parallel tool calls. Independent operations such as reading multiple files or searching for different patterns must occur concurrently to improve efficiency.
- Batching: Read-only context reads and independent edits should be batched.
- Constraints: Limit to 3-5 tool calls simultaneously to avoid timeouts.
- Serialization: Only serialize when there is a strict dependency (output of A required for input of B).
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:72-88, Amp/gpt-5.yaml:55-75
Code Implementation Standards
Style and Quality Guidelines
Cursor AI is instructed to write "high-verbosity" code to optimize for human readability. This includes using descriptive variable names (nouns) and function names (verbs), avoiding unsafe typecasts, and utilizing guard clauses to reduce nesting levels.
| Category | Guideline |
|---|---|
| Naming | Avoid 1-2 character names; prefer full words over abbreviations. |
| Control Flow | Handle error/edge cases first; limit nesting to 2-3 levels. |
| Comments | Explain "why" not "how"; never use inline comments. |
| Formatting | Match existing project style; prefer multi-line over one-liners. |
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:103-120, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:105-125
Verification and Linter Handling
The system mandates a "Gate before new edits" policy. Before any code change, the assistant must reconcile the TODO list. After substantive edits, it must run get_problems (or read_lints) to check for errors.
- Detection: Use
read_lintson recently edited files. - Correction: Fix errors immediately without compromising type safety.
- Loop Limit: Do not exceed 3 attempts to fix a specific linter error before seeking user intervention.
- Final Check: Ensure a green test/build run before closing the goal.
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:122-128, Qoder/prompt.txt:130-140
Communication and Citations
Feedback Mechanisms
The assistant provides two types of updates:
- Status Updates: Continuous narrative of progress (1-3 sentences) explaining future actions.
- Summaries: High-signal bullet points at the end of a turn, highlighting specific important changes.
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:20-36, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:15-30
Code Citing Methods
Cursor uses a specific format for referencing code, allowing users to navigate directly to the source.
- Method 1 (Internal):
startLine:endLine:filepathblock for code existing in the codebase. - Method 2 (Proposed): Fenced code blocks with language tags for new code.
// Example of Method 1 Citation format
// 12:15:app/components/Todo.tsx
export const Todo = () => {
return <div>Todo</div>;
};
Sources: Cursor Prompts/Agent Prompt 2025-09-03.txt:148-165, Cursor Prompts/Agent CLI Prompt 2025-08-07.txt:135-145
Summary
Cursor AI Prompts define a highly autonomous, tool-oriented assistant specialized in software engineering. By enforcing strict task planning, parallel execution, and rigorous code quality verification, the system ensures that AI-generated contributions are technical, readable, and verified within the project's existing context. The integration of semantic search and a structured TODO system allows the agent to handle complex, multi-file tasks while maintaining clear communication with the developer.