--- description: Defines the coding conventions and style guidelines to be followed throughout the project. globs: --- # Coding Conventions and Style Guide ## General Principles - **Consistency:** Maintain a consistent coding style across the entire project. - **Readability:** Write code that is easy to understand and maintain by others (and your future self). - **Simplicity:** Keep code as simple as possible while achieving the desired functionality. Avoid unnecessary complexity. ## Language Specific Conventions ### JavaScript (React Frontend) - **Airbnb JavaScript Style Guide:** (Largely followed - [https://github.com/airbnb/javascript](https://github.com/airbnb/javascript)) - **React Component Structure:** Functional components preferred. Use hooks for state and lifecycle management. - **Naming Conventions:** `camelCase` for variables and functions, `PascalCase` for React components. - **File Structure:** Organize components into logical directories based on features or UI sections. - **Comments:** Use comments to explain complex logic or non-obvious code sections. ### Python/Node.js (Backend - Adjust based on your choice) - **Node.js Standard Style:** (If using Node.js backend - [https://standardjs.com/](https://standardjs.com/)) - **Error Handling:** Use try-catch blocks (JavaScript) for robust error handling. - **Logging:** Use a logging library (e.g., `winston` or `pino` in Node.js) for structured logging. - **API Endpoint Design:** RESTful API principles. Clear and consistent endpoint naming. ## Tailwind CSS Styling - **Utility-First Approach:** Primarily use Tailwind utility classes for styling. - **Component-Specific Styles (when needed):** Create custom CSS classes or components for reusable styles beyond utility classes. - **Responsiveness:** Utilize Tailwind's responsive modifiers (`sm:`, `md:`, `lg:`, etc.) for responsive design. ## Git Conventions - **Branching Strategy:** Feature branches for new features, `main` branch for stable releases. - **Commit Messages:** Use clear and concise commit messages following conventional commits format (e.g., `feat: Add user authentication`, `fix: Resolve file upload bug`). - **Pull Requests:** Use pull requests for code reviews and merging changes into `main`.