Claude-skill-registry 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, working with Agent, discovering rules or MCPs (e.g. cursor.directory), making codebases cursor-compatible, or asking about Cursor workflows, TDD, git commands, or large codebases.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/cursor-best-practices" ~/.claude/skills/majiayu000-claude-skill-registry-cursor-best-practices && rm -rf "$T"
skills/data/cursor-best-practices/SKILL.mdcursor-best-practices
A structured repository for creating and maintaining Cursor Best Practices optimized for agents and LLMs. This skill provides
(atomic practices), rules/
& commands/
(templates), agents/
, and skills/recommended.md
(deeper dives) covering rules, commands, skills, subagents, ignore files, Agent security, workflows, and community resources.references/
When to use
Apply this skill when users:
- Set up or initialize Cursor, create the
folder, or ask "setup my .cursor folder".cursor - Write or edit
, AGENTS.md, or rule frontmatter.cursor/rules - Create or use slash commands, skills, or subagents
- Configure
or.cursorignore.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:
| Type | When to use |
|---|---|
| Always Apply | Must affect every request (e.g. "No in TS", "Run tests before done"). Use sparingly. |
| Apply Intelligently | General guidance when relevant (e.g. "Prefer functional components"). |
| Apply to Specific Files | Use (e.g. , ). Rule loads only when those files are in context. |
| Apply Manually | User invokes with 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/):
| Command | Purpose |
|---|---|
| Review for correctness, security, quality, tests. Output: Critical / Suggestion / Nice to have. |
| Summarize changes, propose PR title/description, suggest review checklist. |
| Run tests, fix failures, re-run until green; summarize changes. |
| Security-focused review (injection, auth, secrets, deps). |
| Propose plan (files, modules, patterns), suggest implementation steps. |
| Fix bug or feature from issue # or description. |
| Update deps, run tests, report breaking changes. |
| Generate or update docs for @-mentioned code or current feature. |
| Make codebase Cursor compatible: add .cursor folder, .cursorignore, AGENTS.md, rules, commands, indexes. |
| Run linter, auto-fix issues, report remaining issues. |
| Format code according to project standards. |
| Check test coverage, identify gaps, suggest improvements. |
| Analyze dependency tree, identify unused/duplicate deps, suggest optimizations. |
| Generate TypeScript/types from schemas, APIs, or JSON. |
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):
— Runs tests and lint, reports onlyverifier.md
— Code review for correctness, security, quality, testsreviewer.md
— Security-focused reviewsecurity-auditor.md
— Linting and code style reviewlinter.md
— Architectural pattern and design reviewarchitect.md
Editable (can modify code):
— Generate/update documentationdocumenter.md
— Write and update teststester.md
— Refactor code while maintaining functionalityrefactorer.md
— Investigate and identify bugsdebugger.md
— Analyze performance issues and bottlenecksperformance-analyzer.md
— Review code for a11y complianceaccessibility-checker.md
— Handle code migrations systematicallymigrator.md
— Review and manage dependenciesdependency-manager.md
— Format code according to standardsformatter.md
— Generate types from schemas/APIstype-generator.md
Skill recommendations: skills/recommended.md and skills.sh only; suggest
npx skills add <owner/repo>.
Ignore files
: Project root; same syntax as .cursorignore
.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
| Mode | Purpose | Tools |
|---|---|---|
| Agent | Implement, refactor, multi-file work. | Full (search, read, edit, terminal, MCP). |
| Ask | Learning, Q&A, exploration. | Search + read only; no edits. |
| Plan | Research → clarify → plan → you review → "Build". | Search + read. Plans in ; Shift+Tab to switch. |
| Debug | Reproducible 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.
.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:
- Create:
,.cursor/rules/
,.cursor/commands/
,.cursor/skills/
..cursor/agents/ - Optional
: If missing, add minimal (e.g..cursorignore
,node_modules/
,.env
,*.log
). Usedist/
syntax; adjust for stack..gitignore - Optional templates: Offer to copy from this skill. If user agrees:
- Commands: Copy command templates from
→commands/
(e.g..cursor/commands/
,code-review.md
,lint-and-fix.md
, etc.).format.md - Agents: Copy any subagent templates from
→agents/
(e.g..cursor/agents/
,verifier.md
,reviewer.md
,linter.md
, etc.).formatter.md - Do not copy
practice files intorules/
as-is (guidance only). Add one starter rule or AGENTS.md if requested..cursor/rules/
- Commands: Copy command templates from
- Confirm: List what was created and how to use it (e.g. "Use
in chat," "Add rules to/code-review
")..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
- Rules index: rules/_sections.md
- Templates: commands/ (14 command templates), agents/ (15 subagent templates), skills/recommended.md
- References: rules-and-commands | agent-and-security | workflows-and-codebases | modes-context-tools | quick-reference
- Canonical: Cursor docs | cursor.directory (rules & MCPs) | skills.sh (skills)