This guide explains how to effectively use the editor rules for frontend development. The rules are designed to be selective and contextual, not comprehensive, to maintain performance and relevance when building modern, accessible, and performant web applications.
Rules are available for both Cursor (.cursor/rules) and Antigravity (.agent/rules) editors. Use the copy-editor-rules.sh script to copy them automatically.
frontend-1-architecture-rules.mdc- Frontend architecture and design patternsfrontend-2-ui-patterns-rules.mdc- UI/UX patterns and user interactionsfrontend-3-data-state-rules.mdc- State management and data flowfrontend-4-api-integration-service-layer.mdc- API integration and service layerfrontend-5-performance-rules.mdc- Performance optimization techniquesfrontend-6-security-rules.mdc- Frontend security implementationfrontend-7-accessibility-rules.mdc- Accessibility and inclusive designfrontend-8-testing-rules.mdc- Frontend testing strategies
react-1-architecture-rules.mdc- React architecture patterns and SOLID principlesreact-2-ui-patterns-rules.mdc- React UI patterns and component designreact-3-data-state-rules.mdc- React state management with hooks and contextreact-4-api-integration-rules.mdc- React API integration with React Query/TanStackreact-5-performance-rules.mdc- React performance optimizationreact-6-security-rules.mdc- React security best practicesreact-7-accessibility-rules.mdc- React accessibility implementationreact-8-testing-rules.mdc- React testing with React Testing Library
- New Component → UI component, feature implementation
- State Management → Data flow, hooks, context
- API Integration → Data fetching, server communication
- Performance → Optimization, code splitting, lazy loading
- Accessibility → Screen reader support, keyboard navigation
- Testing → Unit tests, integration tests, user behavior testing
- Security → Input validation, XSS prevention, authentication
Add Based on Task:
- Component work →
frontend-1-architecture-rules.mdc+react-1-architecture-rules.mdc - UI/UX →
frontend-2-ui-patterns-rules.mdc+react-2-ui-patterns-rules.mdc - Data handling →
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc - API work →
frontend-4-api-integration-service-layer.mdc+react-4-api-integration-rules.mdc - Performance →
frontend-5-performance-rules.mdc+react-5-performance-rules.mdc - Security →
frontend-6-security-rules.mdc+react-6-security-rules.mdc - Accessibility →
frontend-7-accessibility-rules.mdc+react-7-accessibility-rules.mdc
Cursor:
- Open Cursor AI settings → Rules
- Rules are stored in
.cursor/rules - Add selected
.mdcrule files - Ask specific questions
- Review and iterate
Antigravity:
- Rules are stored in
.agent/rules - Antigravity picks them up automatically
- Ask specific questions
- Review and iterate
- Basic Component (2-3 rules):
frontend-1-architecture-rules.mdc+react-1-architecture-rules.mdc - Interactive UI (4-5 rules): Add
frontend-2-ui-patterns-rules.mdc+react-2-ui-patterns-rules.mdc+frontend-7-accessibility-rules.mdc - Data-Driven Feature (5-6 rules): Add
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc+react-4-api-integration-rules.mdc
- Responsive Design (3-4 rules):
frontend-2-ui-patterns-rules.mdc+react-2-ui-patterns-rules.mdc+frontend-7-accessibility-rules.mdc - Interactive Components (4-5 rules): Add
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc - Animation/Motion (3-4 rules):
frontend-2-ui-patterns-rules.mdc+react-2-ui-patterns-rules.mdc+frontend-5-performance-rules.mdc
- Local State (3 rules):
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc - Global State (4 rules): Add
frontend-1-architecture-rules.mdc+react-1-architecture-rules.mdc - Server State (4-5 rules): Add
frontend-4-api-integration-service-layer.mdc+react-4-api-integration-rules.mdc
- Data Fetching (4 rules):
frontend-4-api-integration-service-layer.mdc+react-4-api-integration-rules.mdc+frontend-5-performance-rules.mdc - Real-time Data (4-5 rules): Add
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc - Error Handling (3-4 rules):
react-4-api-integration-rules.mdc+frontend-6-security-rules.mdc
- Component Performance (4 rules):
frontend-5-performance-rules.mdc+react-5-performance-rules.mdc+react-1-architecture-rules.mdc - Bundle Optimization (3-4 rules):
frontend-5-performance-rules.mdc+react-5-performance-rules.mdc - Rendering Performance (4-5 rules): Add
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc
- Input Security (4 rules):
frontend-6-security-rules.mdc+react-6-security-rules.mdc+frontend-4-api-integration-service-layer.mdc - Authentication (4-5 rules): Add
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc - Data Protection (3-4 rules):
frontend-6-security-rules.mdc+react-6-security-rules.mdc
- Basic A11y (3 rules):
frontend-7-accessibility-rules.mdc+react-7-accessibility-rules.mdc - Complex Interactions (4-5 rules): Add
frontend-2-ui-patterns-rules.mdc+react-2-ui-patterns-rules.mdc - Forms & Navigation (4 rules): Add
frontend-3-data-state-rules.mdc+react-3-data-state-rules.mdc
- Component Testing (3-4 rules):
frontend-8-testing-rules.mdc+react-8-testing-rules.mdc+react-1-architecture-rules.mdc - Integration Testing (4-5 rules): Add
frontend-4-api-integration-service-layer.mdc+react-4-api-integration-rules.mdc - User Behavior Testing (4-5 rules): Add
frontend-7-accessibility-rules.mdc+react-7-accessibility-rules.mdc
Rules: react-1-architecture-rules.mdc + react-3-data-state-rules.mdc + react-4-api-integration-rules.mdc + react-7-accessibility-rules.mdc + frontend-5-performance-rules.mdc
Why: Component architecture + state management + API data + accessibility + performance
Rules: react-2-ui-patterns-rules.mdc + frontend-6-security-rules.mdc + react-6-security-rules.mdc + react-7-accessibility-rules.mdc
Why: Form patterns + frontend security + React security + accessibility
Rules: react-4-api-integration-rules.mdc + react-3-data-state-rules.mdc + frontend-5-performance-rules.mdc + react-7-accessibility-rules.mdc
Why: WebSocket integration + state management + performance + accessibility
Rules: react-5-performance-rules.mdc + react-3-data-state-rules.mdc + react-7-accessibility-rules.mdc + frontend-2-ui-patterns-rules.mdc
Why: Virtual scrolling + state management + screen reader support + UI patterns
Rules: frontend-2-ui-patterns-rules.mdc + react-2-ui-patterns-rules.mdc + frontend-5-performance-rules.mdc + frontend-7-accessibility-rules.mdc
Why: Responsive design + React patterns + performance + touch accessibility
- Start Minimal - Begin with 2-3 essential rules, add as needed
- Match Framework - Use React-specific rules for React projects
- Task-Specific - Choose rules that directly relate to your current task
- Avoid Overlap - Don't load both general and React rules for the same concern unless needed
frontend-1-architecture-rules.mdc + react-1-architecture-rules.mdc
react-2-ui-patterns-rules.mdc + react-3-data-state-rules.mdc
react-4-api-integration-rules.mdc + react-3-data-state-rules.mdc
frontend-5-performance-rules.mdc + react-5-performance-rules.mdc
frontend-7-accessibility-rules.mdc + react-7-accessibility-rules.mdc
frontend-6-security-rules.mdc + react-6-security-rules.mdc
frontend-8-testing-rules.mdc + react-8-testing-rules.mdc
- Always include
react-1-architecture-rules.mdcfor component architecture - Add specific React rules that match your task (state, UI, API, etc.)
- Use React Testing Library patterns from
react-8-testing-rules.mdc
- All React rules include TypeScript examples and patterns
- Focus on type safety in component interfaces and state management
- Performance rules include modern bundling and optimization strategies
- Code splitting patterns for dynamic imports
- UI pattern rules include examples for popular CSS approaches
- Responsive design patterns work with any CSS framework
- Add React-specific rules for detailed component patterns
- Include task-specific rules (performance, accessibility, etc.)
- Be more specific about your component requirements
- Reduce the number of active rules (start with 2-3)
- Remove rules not relevant to current task
- Focus on framework-specific rules rather than general ones
- Ensure
react-1-architecture-rules.mdcis included - Add React-specific rules for your particular concern area
- Update rules with your team's React conventions
- Include
frontend-5-performance-rules.mdcandreact-5-performance-rules.mdc - Be specific about performance requirements in your prompts
- Always include
react-7-accessibility-rules.mdcfor interactive components - Add
frontend-7-accessibility-rules.mdcfor comprehensive coverage - Test generated components with screen readers
- Match rules to your specific development task
- Start minimal (2-3 rules) and add as needed
- Include accessibility rules for all user-facing components
- Use React-specific rules for React projects
- Be specific in your prompts about requirements
- Consider performance implications from the start
- Include security rules when handling user data
- New React patterns are adopted by the team
- UI design system changes
- Performance requirements evolve
- Accessibility standards are updated
- New development tools are integrated
- Security requirements change
- Update rule descriptions for clarity
- Add new examples for emerging patterns
- Remove outdated patterns (class components, etc.)
- Include new hooks and React features
- Update TypeScript patterns as needed
- Ensure all team members use consistent rule combinations
- Document team-specific rule preferences
- Regular review of rule effectiveness
- Share successful rule combinations for common tasks