cursor-rules / rules
Cursor rule8 starsChanged 19 months agoMITView on GitHub
React Development Standards
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository17 other files it gives its agents.
- .cursor/rules/aws-bedrock.mdcCursor rule
- .cursor/rules/aws-cloudformation.mdcCursor rule
- .cursor/rules/aws-dynamodb.mdcCursor rule
- .cursor/rules/aws-eventbridge.mdcCursor rule
- .cursor/rules/aws-gamelift.mdcCursor rule
- .cursor/rules/aws-iam.mdcCursor rule
- .cursor/rules/aws-lambda.mdcCursor rule
- .cursor/rules/aws-sagemaker.mdcCursor rule
- .cursor/rules/aws-sam.mdcCursor rule
- .cursor/rules/aws-vpc.mdcCursor rule
- .cursor/rules/base.mdcCursor rule
- .cursor/rules/docs-structure.mdcCursor rule
- .cursor/rules/expo.mdcCursor rule
- .cursor/rules/nextjs.mdcCursor rule
- .cursor/rules/react-native.mdcCursor rule
- .cursor/rules/readme-documentation.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
The file
Show its rules and text
We split this react.mdc into the rules it gives an agent
51 rules. About 0 are common, 51 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈51
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use functional components with hooks instead of class components
- Distinctive: line 17
Keep components focused on a single responsibility
- Distinctive: line 18
Create small, reusable UI components
- Distinctive: line 21
Use proper prop types with TypeScript
- Distinctive: line 23
Create presentational/UI components separate from data containers
- Distinctive: line 26
Follow the Rules of Hooks consistently
- Distinctive: line 27
Use useState for component state management
- Distinctive: line 29
Create custom hooks for reusable logic
- Distinctive: line 30
Use useCallback for memoized callbacks
- Distinctive: line 33
Use context hooks for global state access
- Distinctive: line 36
Use local state for component-specific state
- Distinctive: line 38
Use proper state management libraries for complex state
- Distinctive: line 39
Keep state normalized and minimal
- Distinctive: line 41
Use state update functions instead of direct assignment
- Distinctive: line 42
Create proper state update patterns
- Distinctive: line 46
Use React.memo for pure components
- Distinctive: line 48
Use windowing for long lists (react-window/react-virtualized)
- Distinctive: line 51
Use Suspense for async operations
- Distinctive: line 53
Avoid unnecessary renders with proper dependencies
- Distinctive: line 56
Use proper event handler naming (handleEventName)
- Distinctive: line 58
Use synthetic events properly
- Distinctive: line 60
Use debouncing/throttling for frequent events
- Distinctive: line 62
Create controlled components for form elements
- Distinctive: line 66
Keep side effects isolated in useEffect
- Distinctive: line 69
Use async operations correctly in effects
- Distinctive: line 72
Create service layers for external interactions
- Distinctive: line 76
Use props for parent-to-child communication
- Distinctive: line 78
Use context for deep component communication
- Distinctive: line 81
Create proper component interfaces
- Distinctive: line 82
Document component communication patterns
- Distinctive: line 83
Use composition over deep prop passing
- Distinctive: line 86
Use consistent styling methodology (CSS Modules, CSS-in-JS, etc.)
- Distinctive: line 90
Use consistent naming conventions for styles
- Distinctive: line 93
Use design tokens for consistency
- Distinctive: line 96
Write unit tests for components
- Distinctive: line 97
Create integration tests for component interaction
- Distinctive: line 99
Test component behavior, not implementation
- Distinctive: line 100
Use proper test selectors
- Distinctive: line 102
Test error states and edge cases
- Distinctive: line 106
Use semantic HTML elements
- Distinctive: line 110
Test with screen readers
- Distinctive: line 111
Use proper color contrast
- Distinctive: line 117
Create proper fallback UIs
- Distinctive: line 120
Create user-friendly error messages
- Distinctive: line 123
Create proper loading and error states
- Distinctive: line 127
Create logical folder structures
- Distinctive: line 128
Use index files for cleaner imports
- Distinctive: line 132
Use JSDoc comments for component props
- Distinctive: line 136
Use React Router or similar for routing
- Distinctive: line 138
Create authenticated routes when needed
- Distinctive: line 141
Create route-level code splitting
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: React Development Standards globs: alwaysApply: false --- --- Description: React Development Standards Globs: **/*.tsx, **/*.jsx, **/*.ts, **/*.js, **/components/**/*, **/hooks/**/*, **/context/**/* --- # React Development Standards @base.mdc @typescript.mdc ## Component Architecture - Use functional components with hooks instead of class components - Keep components focused on a single responsibility - Create small, reusable UI components - Implement proper component composition - Separate UI components from container components - Use proper prop types with TypeScript - Structure components with a logical folder organization - Create presentational/UI components separate from data containers ## Hooks Usage - Follow the Rules of Hooks consistently - Use useState for component state management - Implement useEffect with proper dependencies - Create custom hooks for reusable logic - Use useCallback for memoized callbacks - Implement useMemo for expensive calculations - Apply useRef for persisted mutable values - Use context hooks for global state access ## State Management - Use local state for component-specific state - Implement React Context for shared state - Use proper state management libraries for complex state - Keep state normalized and minimal - Implement proper state initialization - Use state update functions instead of direct assignment - Create proper state update patterns - Implement state persistence when needed ## Performance Optimization - Use React.memo for pure components - Implement proper key usage in lists - Use windowing for long lists (react-window/react-virtualized) - Implement proper loading and lazy states - Apply code splitting with React.lazy - Use Suspense for async operations - Implement proper bundle optimization - Avoid unnecessary renders with proper dependencies ## Event Handling - Use proper event handler naming (handleEventName) - Implement event handler functions efficiently - Use synthetic events properly - Apply proper event propagation control - Use debouncing/throttling for frequent events - Implement proper form submission handling - Create controlled components for form elements - Apply proper validation for user inputs ## Side Effects - Keep side effects isolated in useEffect - Clean up side effects properly - Implement proper dependency arrays - Use async operations correctly in effects - Apply proper error handling for side effects - Separate API calls from UI components - Create service layers for external interactions - Implement proper loading and error states ## Component Communication - Use props for parent-to-child communication - Implement callback props for child-to-parent communication - Use context for deep component communication - Apply proper prop drilling avoidance - Implement event buses sparingly and carefully - Create proper component interfaces - Document component communication patterns - Use composition over deep prop passing ## Styling Approaches - Use consistent styling methodology (CSS Modules, CSS-in-JS, etc.) - Implement responsive designs - Create theme-aware components - Apply proper style organization - Use consistent naming conventions for styles - Implement proper media queries - Apply accessibility-friendly styles - Use design tokens for consistency ## Testing - Write unit tests for components - Create integration tests for component interaction - Implement snapshot testing judiciously - Test component behavior, not implementation - Use proper test selectors - Mock external dependencies - Test error states and edge cases - Implement proper test coverage goals ## Accessibility - Use semantic HTML elements - Apply proper ARIA attributes - Create keyboard-navigable components - Implement proper focus management - Test with screen readers - Use proper color contrast - Create accessible forms - Implement proper error messaging ## Error Handling - Implement error boundaries for component errors - Create proper fallback UIs - Apply graceful degradation - Implement proper API error handling - Create user-friendly error messages - Log errors appropriately - Implement retry mechanisms when appropriate - Create proper loading and error states ## Code Organization - Organize code by feature or domain - Create logical folder structures - Use index files for cleaner imports - Implement proper barrel exports - Apply consistent file naming conventions - Create component documentation - Use JSDoc comments for component props - Implement proper code splitting ## Routing (if applicable) - Use React Router or similar for routing - Implement proper route organization - Create authenticated routes when needed - Apply proper route parameters - Implement proper navigation guards - Create route-level code splitting - Apply proper loading states for routes - Implement proper 404 handling
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

