Ides
Cursor IDE Integration
Learn how to use OnlyRules with Cursor IDE
Cursor IDE Integration
Cursor is an AI-powered code editor that makes it easy to integrate custom AI prompt rules. This guide shows you how to use OnlyRules with Cursor.
What is Cursor?
Cursor is a fork of VS Code that's designed from the ground up to be the best way to code with AI. It features:
- Built-in AI chat and code generation
- Custom rule support
- Advanced AI features like Composer and Tab completion
- Full VS Code compatibility
Setting Up Rules in Cursor
Method 1: Using .cursorrules File
- Create a .cursorrules file in your project root
- Copy rule content from OnlyRules
- Paste into .cursorrules file
- Save the file - Cursor will automatically detect it
Example .cursorrules file:
# React Development Rules
You are an expert React developer. When writing React components:
1. Use TypeScript with proper type definitions
2. Follow React best practices and modern patterns
3. Use functional components with hooks
4. Include proper error handling
5. Add JSDoc comments for complex functions
6. Ensure accessibility with ARIA attributes
## Code Style
- Use arrow functions for components
- Prefer const assertions for objects
- Use descriptive variable names
- Keep components small and focused
## Testing
- Write unit tests for all components
- Use React Testing Library
- Test user interactions and edge cases
Method 2: Using Cursor Settings
- Open Cursor Settings (Cmd/Ctrl + ,)
- Navigate to AI Rules section
- Add new rule or import from OnlyRules
- Configure rule scope (global, workspace, or file-specific)
Method 3: Using OnlyRules Export
- Find your rule on OnlyRules platform
- Click Export button
- Select "Cursor (.cursorrules)" format
- Download the file
- Place in your project root
Best Practices for Cursor Rules
Rule Structure
# Rule Title
Brief description of what this rule does.
## Context
Explain the role the AI should take.
## Requirements
- List specific requirements
- Include coding standards
- Mention frameworks or libraries
## Examples
Provide concrete examples of desired output.
## Constraints
- What to avoid
- Performance considerations
- Security requirements
Rule Scope
- Global Rules: Apply to all projects
- Workspace Rules: Apply to current workspace
- File Rules: Apply to specific file types
Performance Tips
- Keep rules concise - Longer rules may impact performance
- Use specific examples - Help the AI understand context quickly
- Avoid conflicting rules - Multiple rules can confuse the AI
- Test thoroughly - Verify rules work as expected
Popular OnlyRules for Cursor
React Development
- React Component Generator
- TypeScript React Patterns
- React Testing Best Practices
- React Performance Optimization
Backend Development
- Node.js API Development
- Database Query Optimization
- Error Handling Patterns
- Security Best Practices
General Development
- Code Review Guidelines
- Documentation Standards
- Git Commit Messages
- Debugging Techniques
Troubleshooting
Rule Not Working
- Check file placement (.cursorrules in project root)
- Verify rule syntax
- Restart Cursor
- Check for conflicting rules
Performance Issues
- Reduce rule complexity
- Remove unused rules
- Use more specific contexts
- Update Cursor to latest version
AI Not Following Rules
- Make rules more specific
- Add concrete examples
- Use clear, direct language
- Test with simple cases first
Advanced Features
Conditional Rules
Use different rules based on file type or project structure:
# Conditional React Rules
If working with React components (.tsx, .jsx):
- Use functional components
- Include PropTypes or TypeScript interfaces
If working with tests (.test.ts, .spec.ts):
- Use describe/it structure
- Include setup and teardown
- Test edge cases
Rule Inheritance
Combine multiple rules for complex projects:
- Base coding standards
- Framework-specific rules
- Project-specific requirements
Integration with OnlyRules Platform
- Browse Rules: Find community-created rules
- Fork and Modify: Customize existing rules
- Share Your Rules: Contribute back to the community
- Stay Updated: Get notifications for rule updates
Next Steps
- Explore more IDE integrations
- Learn about rule creation best practices
- Check out community templates
- Join the OnlyRules community