Skip to content
cursor-best-practices logo

Cursor Best Practices

cursor-best-practices

Best practices for using Cursor—rules, commands, skills, subagents, ignore files, Agent security, workflows, and community resources. Use when setting up Cursor, initializing or creating the .cursor folder, writing .cursor/rules or AGENTS.md, creating commands or skills, configuring .cursorignore...

SKILL.md

Full skill instructions

cursor-best-practices

A structured repository for creating and maintaining Cursor Best Practices optimized for agents and LLMs. This skill provides rules/ (atomic practices), commands/ & agents/ (templates), skills/​recommended.md, and references/ (deeper dives) covering rules, commands, skills, subagents, ignore files, Agent security, workflows, and community resources.


When to use

Apply this skill when users:

  • Set up or initialize Cursor, create the .cursor folder, or ask "setup my .cursor folder"
  • Write or edit .cursor/​rules, AGENTS.md, or rule frontmatter
  • Create or use slash commands, skills, or subagents
  • Configure .cursorignore or .cursorindexingignore
  • Work with Agent modes (Agent, Ask, Plan, Debug), semantic search, or @mentions
  • Ask about TDD, git-style commands, large codebases, or Cursor workflows
  • Discover rules or MCPs (cursor.directory) or skill recommendations (skills.sh)

Rules

Locations: Project .cursor/​rules/ (.md/.mdc), user Cursor Settings → Rules, Team dashboard. Precedence: Team → Project → User.

Types and when to use:

TypeWhen to use
Always ApplyMust affect every request (e.g. "No any in TS", "Run tests before done"). Use sparingly.
Apply IntelligentlyGeneral guidance when relevant (e.g. "Prefer functional components").
Apply to Specific FilesUse globs (e.g. **/​*.test.ts, **/​api/​**). Rule loads only when those files are in context.
Apply ManuallyUser invokes with @rule-name when needed (e.g. release process, legacy quirks).

Frontmatter: description (keyword-rich, helps relevance), globs (file-specific), alwaysApply (use rarely). Keep each rule <500 lines; split by concern, link to references/. AGENTS.md = project-root plain markdown alternative; no frontmatter.

Best practices: Composable rules, concrete examples. Reference—don't copy—long runbooks. Start simple; add rules when the agent keeps making the same mistake. Migrate legacy .cursorrules to Project Rules or AGENTS.md.

See: Rules. rules/​_sections.md | rules-keep-under-500-lines | rules-use-globs | rules-write-good-descriptions | references/​rules-and-commands.md.


Commands

Locations: Project .cursor/​commands/, user ~/​.cursor/​commands/, Team dashboard. Format: Plain Markdown .md; filename = command name. Trigger with / in chat. Parameters: Text after the command is passed as context (e.g. /​fix-issue 123 → "123").

Available templates (copy into .cursor/​commands/):

CommandPurpose
/​code-reviewReview for correctness, security, quality, tests. Output: Critical / Suggestion / Nice to have.
/​prSummarize changes, propose PR title/​description, suggest review checklist.
/​run-tests-and-fixRun tests, fix failures, re-run until green; summarize changes.
/​security-auditSecurity-focused review (injection, auth, secrets, deps).
/​setup-new-featurePropose plan (files, modules, patterns), suggest implementation steps.
/​fix-issueFix bug or feature from issue # or description.
/​update-depsUpdate deps, run tests, report breaking changes.
/​docsGenerate or update docs for @-mentioned code or current feature.
/​make-cursor-compatibleMake codebase Cursor compatible: add .cursor folder, .cursorignore, AGENTS.md, rules, commands, indexes.
/​lint-and-fixRun linter, auto-fix issues, report remaining issues.
/​formatFormat code according to project standards.
/​check-coverageCheck test coverage, identify gaps, suggest improvements.
/​analyze-depsAnalyze dependency tree, identify unused/​duplicate deps, suggest optimizations.
/​generate-typesGenerate TypeScript/​types from schemas, APIs, or JSON.

See: Commands. commands/.


Skills and subagents

Skills: .cursor/​skills/<name>/ with SKILL.md; optional scripts/, references/, assets/. Agent applies when relevant or via /​skill-name. Subagents: .cursor/​agents/ or ~/​.cursor/​agents/; markdown + YAML name, description. Foreground vs background; built-ins (Explore, Bash, Browser).

When to use: Subagents — context isolation, parallel work, multi-step specialized tasks (e.g. verifier that only runs tests/​lint). Skills — single-purpose, repeatable tasks (changelog, format, domain-specific workflows).

Templates: Copy subagent templates from agents/ → .cursor/​agents/. Available subagents:

Read-only (review/​analysis):

  • verifier.md — Runs tests and lint, reports only
  • reviewer.md — Code review for correctness, security, quality, tests
  • security-auditor.md — Security-focused review
  • linter.md — Linting and code style review
  • architect.md — Architectural pattern and design review

Editable (can modify code):

  • documenter.md — Generate/​update documentation
  • tester.md — Write and update tests
  • refactorer.md — Refactor code while maintaining functionality
  • debugger.md — Investigate and identify bugs
  • performance-analyzer.md — Analyze performance issues and bottlenecks
  • accessibility-checker.md — Review code for a11y compliance
  • migrator.md — Handle code migrations systematically
  • dependency-manager.md — Review and manage dependencies
  • formatter.md — Format code according to standards
  • type-generator.md — Generate types from schemas/​APIs

Skill recommendations: skills/​recommended.md and skills.sh only; suggest npx skills add <owner/​repo>.

See: Skills, Subagents.


Ignore files

.cursorignore: Project root; same syntax as .gitignore. Excluded paths are not used for semantic search, Tab, Agent, Inline Edit, @mentions. Not terminal/​MCP. Why: Security (secrets, keys, credentials), performance (large repos). .cursorindexingignore: Indexing only; files still usable if @-mentioned.

Must exclude: .env, .env.*, *.key, *.pem, credentials.json, **/​secrets/​**. Add project-specific paths. Use ! carefully; parent exclusions limit re-includes.

See: Ignore files. rules/​ignore-cursorignore-secrets.md.


Agent and security

Agent: Rules + tools (search, read, edit, terminal, MCP) + your messages. Summarization (/​summarize), checkpoints. Queue (Enter) vs Ctrl+Enter (send immediately).

Security: File edits allowed (except protected config); use VCS. Terminal: approval by default; avoid "Run everything". MCP: approve connection + each tool call. Network: GitHub, link fetch, search only. Put secrets in .cursorignore.

See: Agent overview, Agent security. references/​agent-and-security.md.


Agent modes

ModePurposeTools
AgentImplement, refactor, multi-file work.Full (search, read, edit, terminal, MCP).
AskLearning, Q&A, exploration.Search + read only; no edits.
PlanResearch → clarify → plan → you review → "Build".Search + read. Plans in .cursor/​plans/; Shift+Tab to switch.
DebugReproducible bugs; hypotheses → instrument → reproduce → fix → verify.Full.

Switch: Mode picker in chat; Ctrl+. to cycle. Best practice: Plan with Ask/​Plan, implement with Agent. If Agent builds wrong thing, revert → refine plan → re-run.

See: Modes. rules/​modes-plan-then-agent.md. references/​modes-context-tools.md.


Workflows and large codebases

TDD: Write tests → run (expect fail) → commit tests → implement → run until pass → commit impl. Run tests before done: rules/​workflows-run-tests-before-done.md.

Git-style commands: /​pr, /​fix-issue, /​review, /​update-deps, /​docs in .cursor/​commands/. Codebase understanding: "How does X work?", "How do I add Y?"; broad → narrow. Diagrams: Ask for Mermaid architecture/​data-flow. Hooks: .cursor/​hooks.json for long-running loops. Design → code: Paste mockups; use Browser for preview.

Large codebases: Domain rules in .cursor/​rules with globs; Plan with Ask, implement with Agent. Tab = quick edits; Inline Edit (Ctrl+K) = single-file; Chat/​Agent = multi-file. Use @files, @folder, @Code; scope down; new chats when context is noisy.

See: Agent workflows, Large codebases. references/​workflows-and-codebases.md.


Semantic search, @mentions, Tab

Semantic search: Meaning-based; natural-language questions. Indexing on workspace open; usable ~80% completion. Use both grep (exact) and semantic (conceptual): rules/​context-use-grep-and-semantic.md.

@Files & Folders: Reference by path; drag from sidebar. @Code: Specific snippets (most precise). @Docs: Bundled or Add new doc (URL). /​summarize — compress context. Best practice: rules/​context-use-at-mentions.md.

Tab: Inline autocomplete; Tab accept, Esc reject, Ctrl+Right partial. Use for speed; Inline Edit or Chat for larger changes.

See: Semantic search, @ Mentions, Tab.


Bugbot, MCP, shortcuts

Bugbot: PR review (bugs, security, quality). .cursor/​BUGBOT.md per directory; Team → project → User. MCP: External tools; approve connection + tool calls. cursor.directory for community rules & MCPs. Skills: skills.sh only.

Shortcuts: Ctrl+I Agent | Ctrl+K Inline Edit | Ctrl+. cycle modes | Enter queue, Ctrl+Enter send | Tab accept completion, Esc reject.

See: Bugbot, MCP.


.cursor layout and setup workflow

Folders: rules/, commands/, skills/, agents/. AGENTS.md = simple alternative to rules.

Setup my .cursor folder

When the user asks to set up, initialize, or create the .cursor folder:

  1. Create: .cursor/​rules/, .cursor/​commands/, .cursor/​skills/, .cursor/​agents/.
  2. Optional .cursorignore: If missing, add minimal (e.g. node_modules/, .env, *.log, dist/). Use .gitignore syntax; adjust for stack.
  3. Optional templates: Offer to copy from this skill. If user agrees:
    • Commands: Copy command templates from commands/ → .cursor/​commands/ (e.g. code-review.md, lint-and-fix.md, format.md, etc.).
    • Agents: Copy any subagent templates from agents/ → .cursor/​agents/ (e.g. verifier.md, reviewer.md, linter.md, formatter.md, etc.).
    • Do not copy rules/ practice files into .cursor/​rules/ as-is (guidance only). Add one starter rule or AGENTS.md if requested.
  4. Confirm: List what was created and how to use it (e.g. "Use /​code-review in chat," "Add rules to .cursor/​rules/").

See: rules/​context-setup-cursor-folder.md.


Troubleshooting

Rules not applying? Check type (Always / Intelligent / Globs / Manual), description (keywords), and globs (paths match). Request ID: "Get request ID" or cursor review verbose=true when reporting. See: Common issues, Troubleshooting guide. references/​modes-context-tools.md.


See also

More skills from diegosouzapw

accessibility logo
diegosouzapw/awesome-omni-skill

accessibility

Accessibility guidelines for VS Code features — covers accessibility help dialogs, accessible views, verbosity settings, accessibility signals, ARIA alerts/status announcements, keyboard navigation, and ARIA labels/roles. Applies to both new interactive UI surfaces and updates to existing feature...

62 1
View
mermaid-diagrams logo
diegosouzapw/awesome-omni-skill

mermaid-diagrams

Mermaid diagram creation for flowcharts, sequences, ERDs, and more. Generate diagrams from text in markdown files. Use for documentation, architecture diagrams, and visual representations. Triggers on mermaid, flowchart, sequence diagram, ERD, entity relationship, gantt chart, pie chart, class di...

62 1
View
tauri2-react-rust logo
diegosouzapw/awesome-omni-skill

tauri2-react-rust

Guides development of cross-platform desktop apps with Tauri 2, TypeScript, React, and Rust. Use when building Tauri apps, implementing IPC, designing Rust backend or TypeScript/React frontend, when researching or cloning a website (open site, snapshot elements), when verifying local dev or built...

62 1
View
fp-ts-errors logo
diegosouzapw/awesome-omni-skill

fp-ts-errors

Handle errors as values using fp-ts Either and TaskEither for cleaner, more predictable TypeScript code. Use when implementing error handling patterns with fp-ts.

62 0
View
ring:pre-dev-research logo
diegosouzapw/awesome-omni-skill

ring:pre-dev-research

Gate 0 research phase for pre-dev workflow. Dispatches 3 parallel research agents to gather codebase patterns, external best practices, and framework documentation BEFORE creating PRD/TRD. Outputs research.md with file:line references.

62 0
View
create-assistant logo
diegosouzapw/awesome-omni-skill

create-assistant

Create and configure Vapi voice AI assistants with models, voices, transcribers, tools, hooks, and advanced settings. Use when building voice agents, phone bots, customer support assistants, or any conversational AI that handles phone or web calls.

62 0
View
codex-headless logo
diegosouzapw/awesome-omni-skill

codex-headless

Delegiere Aufgaben an OpenAI Codex CLI im Headless-Mode. Nutzt ChatGPT Subscription (KEIN API Key). Nur Workspace-Zugriff, KEIN System-Zugriff. Auto-Accept mit --full-auto. Web-Recherche mit --search.

62 0
View
social-media-scheduler logo
diegosouzapw/awesome-omni-skill

social-media-scheduler

Generate a full week of social media content for any topic. Outputs platform-optimized posts for Twitter/X, LinkedIn, and Instagram with hashtags and posting times.

62 0
View
Data Privacy Compliance logo
diegosouzapw/awesome-omni-skill

Data Privacy Compliance

Data privacy and regulatory compliance specialist for GDPR, CCPA, HIPAA, and international data protection laws. Use when implementing privacy controls, conducting data protection impact assessments, ensuring regulatory compliance, or managing data subject rights. Expert in consent management, da...

62 0
View
triple-review logo
diegosouzapw/awesome-omni-skill

triple-review

Reviews a task using the TRIPLE protocol, as the review agent.

62 0
View
Tech Stack & Architecture Decision logo
diegosouzapw/awesome-omni-skill

Tech Stack & Architecture Decision

Define and document the technology stack and architecture decisions for a project. Use when the user needs to choose a tech stack, make architecture decisions, define infrastructure choices, or document technology selections. Triggers on requests like "define the tech stack", "choose technologies...

62 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View