# Cursor Tips — Advanced AI Coding Workflow Guide > Comprehensive guide to advanced Cursor workflows. Covers Composer, multi-file edits, .cursorrules, codebase indexing, and prompt engineering for 10x AI coding productivity. ## Install Paste the prompt below into your AI tool: ## Quick Use 1. Install [Cursor](https://cursor.com) (VS Code fork with AI) 2. Open your project and press `Cmd+K` for inline edits 3. Use `Cmd+L` to open AI chat with codebase context ## What is This Guide? This is a curated collection of advanced Cursor tips, prompt patterns, and workflow optimizations compiled from top developers. It covers Composer multi-file editing, effective .cursorrules, codebase indexing strategies, and prompt engineering techniques for maximum AI coding productivity. **Answer-Ready**: A comprehensive guide to advanced Cursor AI coding workflows covering Composer multi-file edits, .cursorrules configuration, codebase indexing, and prompt engineering patterns for 10x developer productivity. **Best for**: Cursor users who want to level up beyond basic autocomplete. **Works with**: Cursor IDE (all plans). **Setup time**: Read and apply immediately. ## Key Workflows ### 1. Composer for Multi-File Edits ``` Cmd+Shift+I → Open Composer - Describe changes spanning multiple files - Composer shows a plan, then edits all files at once - Review diffs before accepting ``` **Pro tip**: Be specific about file paths in your prompt: ``` "Add error handling to src/api/users.ts and update the error types in src/types/errors.ts to match" ``` ### 2. Effective .cursorrules Create `.cursorrules` in your project root: ```markdown # Project Rules ## Tech Stack - Next.js 14 with App Router - TypeScript strict mode - Tailwind CSS for styling - Prisma ORM with PostgreSQL ## Code Style - Use functional components only - Prefer server components; use 'use client' sparingly - Error handling: use Result pattern - Tests: colocate with source files as *.test.ts ## Naming - Components: PascalCase in dedicated files - Hooks: use* prefix (useAuth, useTheme) - API routes: kebab-case (/api/user-settings) ## Don'ts - No 'any' type — use 'unknown' and narrow - No console.log in production code - No default exports except for pages ``` ### 3. @-Mention for Context ``` @file:src/auth/middleware.ts explain the rate limiting logic @folder:src/api/ add input validation to all POST endpoints @codebase how does the payment flow work end-to-end? @docs search the Next.js docs for middleware patterns @web latest React 19 features ``` ### 4. Inline Edit Patterns (Cmd+K) | Pattern | Example | |---------|---------| | Refactor | "Convert to async/await" | | Type | "Add TypeScript types" | | Test | "Write a unit test for this function" | | Fix | "Fix the null pointer on line 42" | | Optimize | "Optimize this query for performance" | ### 5. Chat Prompt Patterns (Cmd+L) **Architecture questions:** ``` @codebase Explain the data flow from user signup to email verification. Include all files involved and the sequence of operations. ``` **Bug investigation:** ``` @file:src/api/orders.ts The createOrder function fails when items array is empty. Trace the issue and suggest a fix with tests. ``` **Code generation:** ``` Create a rate limiter middleware that: 1. Uses Redis for distributed counting 2. Supports per-route configuration 3. Returns proper 429 responses with Retry-After header 4. Has unit tests Follow the patterns in @folder:src/middleware/ ``` ### 6. Codebase Indexing ``` Settings → Features → Codebase Indexing → Enable - Indexes your entire project for @codebase queries - Re-indexes on file changes - Larger projects: add .cursorignore for node_modules, dist, etc. ``` **.cursorignore:** ``` node_modules/ dist/ .next/ coverage/ *.min.js package-lock.json ``` ## FAQ **Q: What model should I use?** A: Claude Sonnet for most coding tasks (best speed/quality). Claude Opus for complex architecture decisions. GPT-4o as fallback. **Q: How do I get better results?** A: Be specific, reference files with @mentions, use .cursorrules, and include expected behavior in your prompts. **Q: Is .cursorrules the same as CLAUDE.md?** A: Similar concept — project-specific AI instructions. .cursorrules is Cursor-specific; CLAUDE.md is for Claude Code. ## Source & Thanks > Compiled from community best practices > > [cursor.com](https://cursor.com) — Cursor IDE > [cursor.directory](https://cursor.directory) — Community rules collection ## 快速使用 安装 Cursor,`Cmd+K` 行内编辑,`Cmd+L` 打开 AI 对话。 ## 这是什么? 高级 Cursor 工作流指南,覆盖 Composer 多文件编辑、.cursorrules 配置、代码库索引和提示词工程技巧。 **一句话总结**:高级 Cursor AI 编码工作流指南,覆盖 Composer、.cursorrules、代码库索引和提示词模式。 ## 核心工作流 ### 1. Composer 多文件编辑 `Cmd+Shift+I` 打开,描述跨文件修改,一次编辑多个文件。 ### 2. .cursorrules 配置 项目根目录创建规则文件,定义技术栈、代码风格和命名规范。 ### 3. @提及精确上下文 @file、@folder、@codebase、@docs、@web 五种上下文源。 ### 4. 代码库索引 开启全项目索引,支持 @codebase 全局搜索。 ## 常见问题 **Q: 用什么模型?** A: 编码用 Claude Sonnet,架构决策用 Claude Opus。 **Q: .cursorrules 和 CLAUDE.md 一样吗?** A: 类似概念,.cursorrules 给 Cursor,CLAUDE.md 给 Claude Code。 ## 来源与致谢 > [cursor.com](https://cursor.com) | [cursor.directory](https://cursor.directory) --- Source: https://tokrepo.com/en/workflows/b7e65852-71d5-4114-bf50-162d16348de3 Author: Prompt Lab