CursorReactCode Style
React (Styled Components) Rules
const preferFunctionalComponents = true;
.cursorrules
// React + Styled Components .cursorrules
// Prefer functional components with hooks
const preferFunctionalComponents = true;
// Styled Components best practices
const styledComponentsBestPractices = [
"Use the styled-components/macro for better debugging",
"Implement a global theme using ThemeProvider",
"Create reusable styled components",
"Use props for dynamic styling",
"Utilize CSS helper functions like css`` when needed",
];
// Folder structure
const folderStructure = `
src/
components/
styled/
styles/
theme.js
globalStyles.js
pages/
utils/
`;
// Additional instructions
const additionalInstructions = `
1. Use proper naming conventions for styled components (e.g., StyledButton)
2. Implement a consistent theming system
3. Use CSS-in-JS for all styling needs
4. Utilize styled-components' attrs method for frequently used props
5. Implement proper TypeScript support for styled-components
6. Use the css prop for conditional styling when appropriate
7. Follow the styled-components documentation for best practices
`;How to use with Cursor
Create a `.cursorrules` file in your project root and paste these rules. Cursor reads this automatically on every AI interaction.
#cursor#react#ai-coding-rules
Related Rules
Python Cursor Rules
CursorPython
Best Cursor AI coding rules for Python development. Enforce type hints, PEP 8, Pythonic patterns, and modern Python best practices in your .cursorrules file.
Code Style
python · type-hintsCopy Ready
TypeScript Cursor Rules
CursorTypeScript
Cursor rules for TypeScript: enforce strict mode, eliminate any types, and write type-safe code with these .cursorrules configurations.
Code Style
typescript · strictCopy Ready
React Cursor Rules
CursorReact
Cursor rules for React: component patterns, hooks best practices, performance optimization, and clean state management conventions.
Architecture
react · hooksCopy Ready
Next.js Cursor Rules
CursorNext.js
Cursor rules for Next.js App Router: server components, data fetching, routing, and deployment best practices.
Architecture
nextjs · app-routerCopy Ready