Skip to content

Instantly share code, notes, and snippets.

@rokon12
Last active March 25, 2026 18:02
Show Gist options
  • Select an option

  • Save rokon12/8f70e22a965a60c9aa6dd3719de40664 to your computer and use it in GitHub Desktop.

Select an option

Save rokon12/8f70e22a965a60c9aa6dd3719de40664 to your computer and use it in GitHub Desktop.

Project Instructions

Architecture

  • Layered: Controller → Service → Repository
  • DTOs are Java records. Never expose JPA entities in API responses.
  • Constructor injection only. No field injection.

Code Style

  • No catch-all catch (Exception e). Handle specific exceptions.
  • Validate inputs at the controller layer using Jakarta Validation.
  • Use Optional return types from repositories. No returning null.

Testing

  • Every non-trivial service method gets a unit test.
  • Use @WebMvcTest for controller tests, not @SpringBootTest.
  • Test names follow: should_expectedBehavior_when_condition

Security

  • No secrets, credentials, or customer data in prompts or instruction files.
  • Sanitize all model output before rendering or storing.
  • Treat model-generated SQL or config as untrusted input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment