- Speak in a clear, concise, and easy-to-understand manner. Use English.
- Follow coding conventions and best practices for Java development.
- Write clean, efficient, and well-documented code.
- Adhere to Java best practices and utilize Java 17+ features effectively.
- Follow the SOLID principles and maintain high cohesion and low coupling in design.
- After your changes, run
./gradlew buildto validate your code. If there are any errors, fix them before committing.
- Use Gradle as the primary build system.
- Automate builds, tests, and deployments using GitHub Actions.
- Ensure CI/CD pipelines are optimized for speed and reliability.
- Code style should be rely on checkstyle.xml file that is located in
config/checkstyle/checkstyle.xmlif it exists. - Use the
./gradlew checkstyleMainand./gradlew checkstyleTestcommand to check code formatting and style. - Use camelCase for variables and methods, PascalCase for classes, and ALL_CAPS for constants.
- Avoid static imports except for constants.
- Don't add comment lines to generated code.
- Rely on Spring Boot starters for core dependencies.
- Lock versions for critical dependencies to ensure stability.
- Structure the application using controllers, services, repositories, and configurations.
- Leverage Spring Boot's auto-configuration features effectively.
- Use Spring Data JPA for ORM and database access.
- Write unit tests with JUnit 5, ensuring at least 80% code coverage.
- Use MockMvc for testing controllers and Mockito for mocking dependencies.
- Write meaningful test names describing expected behavior.
- Optimize database queries with proper indexing and pagination.
- Implement caching using Spring Cache abstraction for repetitive operations.
- Avoid N+1 query issues by configuring fetch strategies in JPA.
- Enforce authentication and authorization using Spring Security.
- Always hash passwords using BCrypt or similar algorithms.
- Enable CSRF protection and enforce HTTPS in production environments.
- Use SLF4J with Logback for structured logging.
- Set appropriate log levels (ERROR, WARN, INFO) for clarity.
- Monitor and expose metrics using Spring Boot Actuator.
- Use Springdoc OpenAPI to generate interactive API documentation.
- Run
checkstyleMainfor main source files. - Run
checkstyleTestfor test files.
- Run all checks (
checkstyleMain,checkstyleTest,test,lint) before commit. - Ensure the repository is in a clean state before executing checks.