Configure and optimize Cursor and Windsurf AI code editors for maximum productivity. Agent mode, composer features, keybindings, and AI-powered refactoring workflows.
#Cursor/WindsurfAIIDESetup&OptimizationSkill##WhatThisSkillEnablesClaudecanhelpyouconfigureandoptimizeCursororWindsurfAIcodeeditorsformaximumproductivity.BotheditorsprovideAI-poweredcodecompletion,multi-fileediting,andintelligentrefactoring.CursorexcelswithitsAgentmodeandComposerfeatures,whileWindsurfemphasizescollaborativeflowsandCascadeAI.Frominitialsetuptoadvancedworkflows,ClaudehandlesIDEconfigurationandoptimization.##Prerequisites**Required:**-ClaudeProsubscriptionorClaudeCodeCLI-macOS,Windows,orLinux-CursororWindsurfIDEinstalled-OpenAIAPIkeyorAnthropicAPIkey-Basiccodeeditorknowledge**WhatClaudehandlesautomatically:**-ConfiguringAPIkeysandmodelselection-SettingupkeybindingsforAIfeatures-Optimizingeditorsettingsforperformance-Creatingcustomrulesandcontextfiles-Configuringagentmodebehaviors-Settingupworkspace-specificsettings-Implementingbestpracticesforprompting-Optimizingtokenusageandcosts##HowtoUseThisSkill###InitialSetup&Configuration**Prompt:**"Help me set up Cursor with Claude Sonnet model. Configure keybindings for: inline completion (Tab), chat (Cmd+K), composer (Cmd+I), and agent mode. Optimize for React/TypeScript projects."Claudewill:1.GuideAPIkeyconfiguration2.SetmodeltoClaudeSonnet3.Configurekeyboardshortcuts4.Add.cursorrulesforReact/TS5.Setupworkspacesettings6.Configureauto-completebehavior7.Addprojectcontextfiles###OptimizingAgentMode**Prompt:**"Configure Cursor Agent mode for: automatic file edits, test generation, refactoring tasks, and documentation. Set guardrails to prevent breaking changes."Claudewill:1.Enableagentmodesettings2.Configurefilepermissions3.Setuptestgenerationrules4.Addrefactoringguidelines5.Create.cursorrulesforsafety6.Configureapprovalworkflows7.Settokenlimits###CustomRules&Context**Prompt:**"Create .cursorrules file for Next.js 15 project with: TypeScript strict mode, shadcn/ui components, Tailwind CSS, server actions, and Zod validation. Include coding standards."Claudewill:1.Create.cursorrulesfile2.Specifytechstackversions3.Addcodingconventions4.Includecommonpatterns5.Seterrorhandlingrules6.Addperformanceguidelines7.DocumentAPIusage###Multi-FileRefactoring**Prompt:**"Set up Windsurf Cascade for: renaming components across files, updating import paths, refactoring prop types, and running type checks. Configure to preview changes before applying."Claudewill:1.ConfigureCascadesettings2.Enablepreviewmode3.Setupdiffviewing4.Addrollbackcapability5.Configuretypechecking6.Setupbatchoperations7.Addsafetyconfirmations##TipsforBestResults1.**Use.cursorrules**:Createproject-specificrulesfilewithtechstack,conventions,andpatterns.AIreadsthisforcontext.2.**ComposerforLargeChanges**:UseCmd+I(Cursor)orCascade(Windsurf)formulti-fileedits.Morepowerfulthaninlinechat.3.**@MentionsforContext**:Use@filename,@folder,@docstogiveAIspecificcontext.Reduceshallucinations.4.**AgentModeGuardrails**:Setfilepermissionsandreviewchanges.Don't let agent edit critical files unsupervised.5. **Model Selection**: Claude Sonnet for code quality, GPT-4 for speed. Switch based on task complexity.6. **Token Optimization**: Use codebase indexing wisely. Exclude node_modules, dist, .next from context.## Common Workflows### React Component Refactoring```"Configure Cursor for React refactoring workflow:1. Set up .cursorrules with React 19 patterns2. Enable TypeScript strict mode validation3. Configure agent mode for component splits4. Add rules for shadcn/ui usage5. Set up automatic prop-types to TS conversion6. Configure test generation with Vitest7. Enable preview for all agent changes8. Add rollback shortcuts"```### API Route Generation```"Set up Windsurf for API development:1. Create .cursorrules for FastAPI/Next.js API routes2. Configure agent to generate OpenAPI docs3. Set up automatic validation with Zod4. Add error handling templates5. Configure test generation6. Set up database query optimization7. Enable security scanning8. Add rate limiting patterns"```### Legacy Code Migration```"Configure Cursor for migrating JS to TS:1. Set up .cursorrules for TypeScript migration2. Configure agent for file-by-file conversion3. Add type inference rules4. Set up any type replacement5. Configure import path updates6. Enable type checking after each file7. Add rollback on type errors8. Generate migration report"```### Test Coverage Improvement```"Set up Windsurf for test generation:1. Configure agent for unit test creation2. Add .cursorrules for testing patterns3. Set up coverage threshold checks4. Configure mock generation5. Add integration test templates6. Set up snapshot testing rules7. Enable test runner integration8. Generate coverage reports"```## Troubleshooting**Issue:** "AI suggestions are slow or timing out"**Solution:** Reduce context size by excluding large folders in settings. Use @filename for specific context instead of full codebase. Check API rate limits. Switch to faster model (GPT-3.5) for simple edits. Clear index and rebuild.**Issue:** "Agent mode making unwanted changes"**Solution:** Add .cursorrules with explicit guidelines. Set file permissions to read-only for critical files. Enable preview mode to review all changes. Use 'explain' prompts before 'do' prompts. Add 'donotmodify' comments in code.**Issue:** "API costs higher than expected"**Solution:** Exclude unnecessary folders from indexing. Use caching (Cursor's@codebase).Switchtosmallermodelsforsimpletasks.Disableauto-completeforcomments.Reviewtokenusageinsettings.Uselocalmodelsforbasiccompletion.**Issue:**"Keybindings conflicting with other extensions"**Solution:**Checkkeybindings.jsonforconflicts.ReassignCursor/Windsurfshortcuts.Disableconflictingextensions.UseCmd+K+S(Cursor)toviewallshortcuts.Exportkeybindingsandversioncontrolthem.**Issue:**"AI not using project context correctly"**Solution:**Createdetailed.cursorrulesfile.Use@docstoreferencedocumentation.AddREADMEwitharchitectureoverview.Use@folderforpackage-specificcontext.Verifycodebaseindexingiscomplete.Rebuildindexifstale.##LearnMore-[CursorDocumentation](https://cursor.sh/docs)-[WindsurfbyCodeium](https://codeium.com/windsurf)-[CursorForum](https://forum.cursor.sh/)-[AICodingBestPractices](https://cursor.sh/blog/agent-mode)-[WindsurfCascadeGuide](https://codeium.com/blog/windsurf-editor)
Features
Key capabilities and functionality
AI-powered multi-file editing with agent modes
Inline code completion with context awareness
Chat interface for code explanations and refactoring
Composer/Cascade for large-scale code changes
Requirements
Prerequisites and dependencies
Cursor IDE or Windsurf IDE
OpenAI API key or Anthropic API key
macOS/Windows/Linux
Installation
Setup instructions and requirements
Claude Code Setup
Install Cursor or Windsurf for your OS
Set up API keys (OpenAI/Anthropic)
Create .cursorrules in project root
Configure settings.json and keybindings.json
Claude Desktop Setup
Download Cursor from cursor.sh or Windsurf from codeium.com
Add API key in Settings > Features > AI
Ask Claude: 'Help me set up .cursorrules for [your project]'
Configure keybindings and workspace settings
Use Cases
Common scenarios and applications
Configuring AI IDE for specific tech stacks
Setting up multi-file refactoring workflows
Optimizing token usage and API costs
Troubleshooting
Common issues and solutions
AI suggestions slow or timing out
Reduce context by excluding large folders. Use @filename for specific context. Check API rate limits. Switch to faster model. Clear and rebuild index.
Agent mode making unwanted changes
Add explicit .cursorrules guidelines. Set read-only permissions for critical files. Enable preview mode. Use 'explain' before 'do' prompts. Add 'do not modify' comments.
High API costs
Exclude unnecessary folders from indexing. Enable caching (@codebase). Use smaller models for simple tasks. Disable auto-complete for comments. Review token usage in settings.
Usage Examples
Practical code examples demonstrating common use cases and implementation patterns
Sample .cursorrules File
sample-cursorrules-file.md
markdown
#Project:Next.js15SaaSApplication##TechStack-Next.js15.0+(AppRouter,ServerActions)-React19.0+-TypeScript5.5+(strictmode)-TailwindCSS4.0+-shadcn/uicomponents-Zodforvalidation-PrismawithPostgreSQL##CodingConventions-Usenamedexports(nodefaultexportsexceptpages)-Prefixserveractionswith'action'-Allasyncfunctionsmusthaveerrorhandling-UseZodschemasforallforminputs-ComponentsinPascalCase,filesinkebab-case-Maxfunctionlength:50lines-AllpropsmusthaveTypeScriptinterfaces##PatternstoFollow-ServerActionsformutations(noAPIroutes)-ReactServerComponentsbydefault-Clientcomponentsonlywhenneeded('use client')-ParalleldatafetchingwithPromise.all-Errorboundariesforallasynccomponents-LoadingstateswithSuspense-FormvalidationwithZod+ReactHookForm##PatternstoAvoid-Don't use 'any' type (use 'unknown' if needed)- Don'tfetchinclientcomponents(useserver)-Don't bypass TypeScript with @ts-ignore- Don'tcreatecustomhookswithoutjsdoc-Don't use inline styles (use Tailwind)## Testing- Unit tests with Vitest- E2E tests with Playwright- Minimum 80% coverage- Test file naming: *.test.ts## Performance- Dynamic imports for heavy components- Image optimization with next/image- Font optimization with next/font- Metadata API for SEO