NEW: Claude Code Security — research preview

Troubleshooting & Reference

Common issues, migration from legacy formats, YOLO mode safety, and full keyboard shortcut reference.

Read time: 8 min

title: "Troubleshooting & Reference" description: "Common issues, migration from legacy formats, YOLO mode safety, and full keyboard shortcut reference." section: "Full Guide" readTime: "8 min"

Troubleshooting & Reference

Quick fixes for common Cursor issues and a full keyboard shortcut reference.

Migrating Legacy Config

.cursorrules.cursor/rules/*.md

Old single-file format is deprecated. Split into typed rule files:

Before (.cursorrules):

Always use TypeScript.
Never use any type.
Use Tailwind for styling.

After (.cursor/rules/01-code-style.md):

---
type: rule
alwaysApply: true
---
 
# Code Style
 
- Always use TypeScript
- Never use `any` type — use `unknown` and narrow
- Use Tailwind CSS for all styling — no inline styles

Steps:

  1. Read .cursorrules contents
  2. Group by category (style, testing, patterns, etc.)
  3. Create numbered files: 01-code-style.md, 02-testing.md, etc.
  4. Add frontmatter to each: type: rule, alwaysApply: true/false
  5. Delete .cursorrules

.mdc.md

Rename all rule files if using old .mdc extension:

# In your .cursor/rules/ directory
for file in *.mdc; do mv "$file" "${file%.mdc}.md"; done

No content changes needed — just the extension.

Common Rule Mistakes

MistakeProblemFix
Rule for optional workflowsAgent applies it when not neededUse type: skill instead; call with /skill-name
Constraints in instructions.mdInstructions are project context, not enforcement rulesMove constraints to .cursor/rules/ with alwaysApply: true
One monolithic rule fileHard to maintain, conflictsSplit by domain: style, tests, security, patterns
Rules without examplesAgent interprets looselyAdd concrete before/after code examples in rules
alwaysApply: true on everythingPerformance degradation, context bloatOnly alwaysApply for universal constraints (no any, etc.)

YOLO Mode Safety

YOLO mode (--dangerously-skip-permissions) runs agent actions without confirmation dialogs. Use it for CI environments, not local dev.

If you must use YOLO locally, set explicit lists:

// .cursor/settings.json
{
  "agent": {
    "allowedCommands": [
      "npm test",
      "npm run lint",
      "npm run build",
      "git status",
      "git diff"
    ],
    "deniedCommands": [
      "rm -rf",
      "git push",
      "git push --force",
      "npm publish",
      "DROP TABLE",
      "DELETE FROM"
    ]
  }
}

Rule: never run YOLO mode without an allow/deny list. The default is allow-all.

Indexing Issues

Symptom: Responses are slow, @codebase misses files, agent doesn't know about recent changes.

Diagnose: Settings → Indexing & Docs → check indexed file count and last update time.

Fixes:

SymptomFix
File count lower than expectedCheck .cursorignore — may be excluding too much
Index not updatingRe-index: Settings → Indexing → Re-index Repository
Large repo slowAdd generated files to .cursorignore (dist/, .next/, node_modules/)
Private files in responsesAdd to .cursorignore (secrets, personal notes)

Sample .cursorignore for Next.js:

.next/
node_modules/
dist/
.env*
*.log
coverage/
.turbo/

Context Drift Signs

Your session has drifted when:

  • Agent ignores instructions.md rules it was following earlier
  • Suggestions repeat a mistake you already corrected
  • Agent proposes patterns that don't match your codebase style
  • Responses get shorter/worse over time in the same session

Fix: Reset conversation. Don't try to correct drift with more prompts.

# Start fresh session with:
"Continuing [specific task].
Previous session: [2-3 bullet summary of what was done]
Next step: [exactly one thing]

@relevant-file.ts @instructions.md"

Debugging Workflow Issues

Agent keeps re-implementing already solved things:

  • You need the 3-file rule: reference the existing implementation
  • "Don't re-implement X — it already exists in @src/lib/x.ts. Just use it."

Agent ignores type constraints:

  • Make sure @types/ or the relevant type file is in your @mentions
  • Add "Use ONLY the types defined in @src/types/ — do NOT invent new types" to your prompt

Generated tests don't test the right behavior:

  • Provide the spec or requirements in the prompt explicitly
  • Reference an existing test as pattern: @src/api/orders.test.ts (follow this structure)
  • Say what behaviors must be covered: "Must test: success case, validation failure, 404, and 500 error handling"

Composer goes off on tangents:

  • Use scoped prompts: one task per session
  • End prompts with: "Do not change anything outside of [specific file/function]."

Keyboard Shortcuts Reference

Core

ActionMacWindows
Open Composer (full)Cmd+ICtrl+I
Open Chat (sidebar)Cmd+LCtrl+L
Ask about selectionCmd+Shift+LCtrl+Shift+L
Inline editCmd+KCtrl+K
Accept suggestionTabTab
Reject suggestionEscEsc

Composer Controls

ActionMacWindows
Submit promptEnterEnter
New line in promptShift+EnterShift+Enter
@ mention menu@@
Attach filedrag or @filedrag or @file
Toggle YOLO modeCmd+Shift+YCtrl+Shift+Y
Stop generationEscEsc
ActionMacWindows
Go to definitionF12F12
Find in filesCmd+Shift+FCtrl+Shift+F
Command paletteCmd+Shift+PCtrl+Shift+P
Open terminalCtrl+`Ctrl+`
Switch tabsCmd+PCtrl+P

Git

ActionMacWindows
View git diffCmd+Shift+GCtrl+Shift+G
Stage changesCmd+Shift+ACtrl+Shift+A
CommitCmd+Enter (in SCM)Ctrl+Enter

Quick Reference: File Locations

FilePurposeType
.cursor/rules/*.mdPersistent coding conventionsRules
.cursor/rules/skills/*.mdOn-demand workflows (/skill-name)Skills
instructions.mdProject context for every sessionContext
.cursorignoreFiles to exclude from indexingConfig
.cursor/mcp.jsonMCP server configurationConfig
.cursor/settings.jsonCursor settings overrideConfig