Hi,
in all those cursorrules files most is written in natural language.
When i tried to add functionality that in Chat Code always has a file to link with (often Cursor has the behaviour for me, that it generates code but for example does not specifiy t which route.ts it should be applied or does not specify at all to which file it should be applied)
Cursor reformatted my cursorrules file in this annotation.
Maybe thats a better way for Cursor to understand the rules file?
Development Guidelines
development_rules:
react_native:
code_style: - description: “Write Clean, Readable Code”
details: “Ensure code is easy to read and understand. Use descriptive names.”
-
description: “Use Functional Components”
details: “Prefer functional components with hooks over class components.” -
description: “Component Modularity”
-
details: “Break down components into smaller, reusable pieces.”
-
description: “Organize by Feature”
-
details: “Group related components into feature-based directories.”
naming_conventions:
variables: “camelCase (e.g., isFetchingData)”
components: “PascalCase (e.g., UserProfile)”
directories: “lowercase-hyphenated (e.g., user-profile)”javascript_usage:
- “Avoid Global Variables”
- “Use ES6+ Features”
- “PropTypes for type checking”performance:
- “Optimize State Management”
- “Use React.memo() for memoization”
- “Optimize FlatList configurations”
- “Avoid anonymous functions in renders”
Code Block Formatting Rules
code_block_rules:
-
name: file_specification
required: true
format: “```language:path/to/file:line-numbers”
rules:- “Always specify full file path”
- “Include method/class location”
- “Show context for partial changes”
- “Separate multiple file changes”
- “Use comments for skipped code”
- “Include line numbers in format :start-end”
- “Specify change type (add/replace/modify)”
examples:
complete_replacement:
description: “Complete file replacement”
format: |
typescript:app/api/stories/route.ts // Complete new file content
partial_change:
description: “Partial file change”
format: |
typescript:app/components/Button.tsx:15-27 export function Button() { // ... existing code ... const newMethod = () => { // New code here } // ... existing code ... }
multiple_files:
description: “Multiple file changes”
format: |
typescript:app/api/auth/[...nextauth]/route.ts:10-20 // First file changes
```typescript:middleware.ts:5-15 // Second file changes ```