cfreshman personal-public .cursorrules file for JavaScript (stars: 1)

# Chat Genius Project Rules

# Component Structure
- Keep React components in src/pages/chat-genius/components/
- Keep hooks in src/pages/chat-genius/hooks/
- Keep server routes in server/routes/chat-genius/
- Keep types in src/pages/chat-genius/types.ts
- Keep utilities in src/pages/chat-genius/utils.ts

# Naming Conventions
- React components: PascalCase (e.g., MessageList.tsx)
- Hook files: snake_case (e.g., use_usernames.tsx)
- Server files: kebab-case (e.g., chat-genius)
- Type interfaces: PascalCase (e.g., Message, Channel)
- Variables/functions: snake_case (e.g., handle_message_click)
- Store keys: 'chat-genius:feature-name'
- Socket events: snake_case with feature prefix
- Voice file IDs: user_voice_{id}
- Constants: UPPER_SNAKE_CASE

# Socket Events
- Prefix all events with 'chat-genius:'
- Handle presence events: join, leave, idle, activity
- Handle workspace events: update, leave
- Handle message events: create, update, delete
- Handle reaction events: add, remove
- Handle file events: upload, delete
- Handle voice events: generate, play
- Handle avatar events: create, clear

# State Management
- Use store.use() for persistent state
- Use useS/useM/useF/useR hooks from lib
- Keep presence state in PresenceProvider
- Keep username state in UsernameProvider
- Keep workspace state in WorkspaceComponent
- Keep message state in MessageList/Thread
- Keep avatar/voice state in ChatArea

# Feature Integration
- Voice: Use ElevenLabs API through voice.js
- Avatar: Handle through model.js avatar channels
- Files: Upload through file.js with proper headers
- Search: Use vector DB through llm.js
- Messages: Handle threading and reactions
- Presence: Track through socket events
- Workspaces: Manage invites and permissions

# Error Handling
- Handle socket disconnects gracefully
- Validate all API responses
- Handle file upload failures
- Handle voice generation limits
- Handle avatar chat errors
- Handle search query failures
- Handle presence sync issues

# Assistant Behavior
- Always read affected files before making changes
- Never modify code unrelated to the requested change
- Keep existing functionality intact when adding features
- Preserve working socket/store/provider patterns
- Make minimal changes to achieve the goal
- Fix only the specific issue reported
- If unsure about a file's purpose, gather more context first
- When editing files:
  - Use "// ... existing code ..." to preserve unmodified sections
  - Show sufficient context around edits
  - Never rewrite entire files unless explicitly requested
  - Keep working imports and dependencies
  - Maintain existing error handling
  - Preserve type definitions
- When suggesting commands:
  - Explain the purpose clearly
  - Use proper error handling
  - Preserve the working environment
  - Never delete or overwrite critical files

# What Not To Change
❌ Socket event patterns
❌ Store key formats
❌ Provider structure
❌ Hook naming patterns
❌ File organization
❌ Error handling flows
❌ API response formats

# Acceptable Changes
✅ Add new features following patterns
✅ Extend existing components
✅ Add new socket events with prefix
✅ Add new store keys with prefix
✅ Add new hooks following pattern
✅ Add new error handlers
✅ Add new API endpoints
css
golang
html
javascript
less
react
shell
typescript
+1 more

First Time Repository

freshman.dev

JavaScript

Languages:

CSS: 24.1KB
HTML: 4752.1KB
JavaScript: 6728.1KB
Shell: 39.5KB
TypeScript: 6035.6KB
Created: 6/16/2024
Updated: 1/17/2025

All Repositories (1)