omnivore/cursor-rules/language-specific-cursorrules.md

1.7 KiB

Language-Specific - Cursor Rules

TypeScript Standards

  • Use strict TypeScript configuration
  • Prefer interfaces over types for object shapes
  • Use enums for constants with multiple values
  • Always define return types for functions
  • Use optional chaining and nullish coalescing operators
  • Avoid any type - use unknown if needed
  • Use proper generic constraints

Node.js Patterns

  • Use Node.js version 22 for stability (migrate to 23 after stabilization)
  • Implement proper error handling with try-catch blocks
  • Use async/await over callbacks and promises chains
  • Implement proper stream handling
  • Use proper module patterns (ES modules)
  • Handle process signals appropriately

Swift (iOS)

  • Use SwiftUI for modern iOS development
  • Follow Swift naming conventions
  • Use proper optionals handling
  • Implement proper error handling with Result types
  • Use Combine for reactive programming
  • Follow iOS Human Interface Guidelines

Kotlin (Android)

  • Use Jetpack Compose for modern Android development
  • Follow Kotlin coding conventions
  • Use proper null safety features
  • Implement proper coroutines for async operations
  • Use proper dependency injection patterns
  • Follow Material Design guidelines

JavaScript/JSX

  • Use modern JavaScript features (ES2020+)
  • Prefer const over let, avoid var
  • Use proper destructuring patterns
  • Implement proper error boundaries in React
  • Use proper event handling patterns
  • Follow functional programming principles where appropriate

SQL

  • Use descriptive table and column names
  • Implement proper foreign key relationships
  • Use appropriate data types
  • Create proper indexes for performance
  • Use transactions for data consistency
  • Write readable, well-formatted queries