# .cursorrules
## project instructions
**goal**
build a modern customer support system (crm) with generative ai enhancements. the system handles ticket creation, assignment, and collaboration, then integrates ai to automate and scale support workflows.
**phases**
1. **week 1 mvp (by jan 21, 2025)**
- ✅ functional baseline crm
- ✅ roles: customer, worker, manager
- ✅ ticket creation & management with row-level security
- ✅ minimal ui for listing and updating tickets
- ✅ keep existing patterns; do not remove or break anything
2. **week 1 final (by jan 24, 2025)**
- polish the existing crm
- ✅ ensure stable team management, comment system, assignments
- ✅ internal comments for workers/managers
- ✅ fix major bugs (unknown username, visibility issues)
- ✅ template system for quick responses
- remaining features:
- ticket feedback/rating system
- ticket history view
- bulk operations for tickets
- deliver a 5-min walkthrough video
3. **week 2 mvp (by jan 27, 2025)**
- introduce basic ai features:
- auto-route tickets based on content
- auto-reply for common questions
- suggested responses for agents
- maintain user roles & rls
- any ai logic must be optional/toggleable
- integrate with knowledge base
- implement RAG system for context
4. **week 2 final (by jan 31, 2025)**
- refine ai features:
- knowledge-based suggestions
- smart escalation rules
- ticket summarization
- performance analytics
- ensure human-in-the-loop oversight
- implement learning system from human interventions
- deliver final demo showing ai-driven workflow
**important notes**
- some features may or may not be implemented yet. only implement or modify code if specifically asked.
- maintain supabase-based backend, rls, and edge functions.
- do not remove or rewrite working code unless necessary for new features.
---
## ui text
- lowercase except proper nouns
- concise and direct
- remove unnecessary words
- consistent terminology
- short, clear error messages (e.g., "invalid credentials")
### examples
- ✅ "sign in"
- ✅ "username"
- ✅ "invalid credentials"
- ✅ "need an account?"
---
## component naming
- react components: PascalCase (e.g., `TicketForm`)
- file names: kebab-case (e.g., `ticket-form.tsx`)
- css classes: kebab-case
---
## spacing
- minimal vertical spacing (`space-y-2`)
- forms max-width: 320px
- consistent padding (`pt-4`)
- compact header (`h-12`)
- small text (`text-sm`) for secondary info
---
## buttons
- default `size="sm"`
- keep text short
- `variant="ghost"` for secondary actions
- header buttons: `h-7`
---
## core rules
- **never remove working code**
- **never modify code beyond requested changes**
- **never "clean up" working code** unless explicitly asked
- preserve all security measures
- follow existing patterns (rls, migrations, edge functions)
- do not break role-based workflows
---
## code changes
- only do what is explicitly requested
- show enough context
- use correct file paths
- keep existing error handling
- maintain configs
- deploy after changes
---
## file structure
- preserve existing organization
- do not break imports or references
- follow naming conventions
---
## database
- keep working tables/schemas
- preserve triggers/functions
- keep rls policies
- verify dependencies before changes
---
## edge functions
- follow existing patterns
- parameterized queries
- keep cors configs
- deploy with project ref
- check dependencies
---
## do not
- ❌ remove working code
- ❌ change working patterns
- ❌ "clean up" existing code
- ❌ break dependencies
- ❌ modify security
---
## correct steps
- ✅ check dependencies first
- ✅ verify usage
- ✅ keep working functionality
- ✅ follow existing patterns
- ✅ test after changes
analytics
css
golang
html
javascript
less
plpgsql
react
+3 more
First Time Repository
TypeScript
Languages:
CSS: 3.2KB
HTML: 1.1KB
JavaScript: 2.9KB
PLpgSQL: 6.0KB
Shell: 4.4KB
TypeScript: 282.1KB
Created: 1/16/2025
Updated: 1/23/2025