Rules
Rules
GENERAL:
1. Code Quality
Always write clean, simple, and maintainable code.
Follow best practices for readability and modularity.
Use async/await to handle asynchronous operations cleanly.
Ensure code is easily extendable and follows DRY (Don't Repeat Yourself)
principles.
2. Security
Always validate and sanitize user input (e.g., zod or express-validator).
Use parameterized queries to prevent SQL Injection.
Hash passwords using bcrypt and securely store credentials.
Prevent XSS (Cross-Site Scripting) and CSRF (Cross-Site Request Forgery) attacks.
3. Prisma Best Practices
Use Prisma Migrations (npx prisma migrate dev) to track schema changes.
Optimize database queries (use select, include, and take where applicable).
Avoid N+1 query problems by using include for relations.
Gracefully handle database connections (use prisma.$disconnect() on app exit).
Always return clean JSON responses when handling API requests.
4. PWA Design Patterns
Service Workers for offline functionality.
Manifest File for app-like behavior.
Push Notifications & Background Sync where applicable.
Ensure fast and optimized performance for smooth UX.
5. Focus on Input Scope
NEVER refactor unrelated code unless explicitly requested.
ONLY modify what is directly tied to the input question.
6. Performance Optimization
Optimize for speed and scalability, especially for high concurrency.
Cache frequently used queries (e.g., Redis for performance boost).
7. Profile.jsx Rules
Used only to display user info, change theme, and log out.
Not responsible for fetching or modifying data elsewhere.
Main user fetch happens in App.js (client folder) for updated user state.
---------------------------------