--- description: Code quality standards and clean code principles globs: ["**/*.java", "**/*.py", "**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx", "**/*.yml", "**/*.yaml", "**/*.xml", "**/*.json", "**/*.properties"] alwaysApply: true --- # Code Quality Standards When working with code files, follow these standards: ## Clean Code Documentation Apply the principles detailed in the comprehensive clean code guides: - **Project Overview**: @CLEAN_CODE.md - **API Gateway**: @services/api-gateway/CLEAN_CODE.md - **Service Adapters**: @services/service-adapters/CLEAN_CODE.md - **API Docs**: @services/api-docs/CLEAN_CODE.md - **Frontend**: @frontend/CLEAN_CODE.md ## Clean Code Principles Follow SOLID principles as detailed in @CLEAN_CODE.md: - **Single Responsibility Principle (SRP)**: Each class/component has one clear purpose - **Open/Closed Principle (OCP)**: Open for extension, closed for modification - **Dependency Inversion Principle (DIP)**: Depend on abstractions, not concretions - **Interface Segregation Principle (ISP)**: Small, focused interfaces ## Naming Conventions - **Java**: PascalCase classes, camelCase methods, UPPER_SNAKE_CASE constants - **Python**: PascalCase classes, snake_case functions, UPPER_SNAKE_CASE constants - **JavaScript/TypeScript**: PascalCase classes, camelCase functions, UPPER_SNAKE_CASE constants ## Function Design - Maximum 20-30 lines per function - Single level of abstraction - Clear, descriptive names - Single responsibility ## Error Handling - Consistent error responses - Proper exception handling - User-friendly error messages - Logging for debugging ## Code Review Checklist - [ ] All new code follows naming conventions - [ ] Error handling is implemented - [ ] Input validation is present - [ ] Documentation is updated - [ ] Tests are written and passing - [ ] Clean code principles are followed ## Testing Requirements - **Unit Tests**: Test business logic, error conditions, edge cases - **Integration Tests**: Test API endpoints, service interactions - **End-to-End Tests**: Test critical user flows, service integration ## Performance Guidelines - Database optimization with appropriate indexes - Implement caching strategies - Proper resource management - Efficient algorithms