Spring Project Memory: Developing with AI (Assistant-Agnostic)
This file provides a high-level project summary, conventions, and links to reusable skills and best practices for use with any AI coding assistant (Claude, Copilot, etc.).
Project Overview
- Purpose: [Short description of the project]
- Tech Stack: Spring Boot, Java 17+, [other tech]
- Architecture: Layered (Controller, Service, Repository, etc.)
- AI Assistant Usage: This project is designed to work with any AI coding assistant. Use the skills and best practices below to guide code generation and reviews.
Layered Architecture
- Controller: Handles HTTP requests, input validation, delegates to services.
- Service: Contains business logic, coordinates between controllers and repositories.
- Repository: Data access, CRUD, custom queries.
- Model/Entity: Domain objects/entities.
- DTO: API input/output, decouples internal models from external representations.
- Configuration: App setup, property binding.
- Exception Handling: Centralized error handling.
Project Conventions (Apply by Default)
- Injection: Constructor injection only.
- Validation:
@Validon request DTOs, constraint annotations on fields. - DTOs: Never expose entities in REST responses.
- Transactions:
@Transactionalon write operations in services. - Errors: Global
@RestControllerAdvicewith typed error responses. - Testing: Use slice tests first (
@WebMvcTest,@DataJpaTest). - API Design: RESTful endpoints under
/api/v1, useResponseEntitywhen needed.
Reusable Skills
Best Practices
IDE-Specific Rules
- Copilot:
snippets/copilot-instructions.md - Claude:
snippets/CLAUDE.md - Cursor:
snippets/cursorrules.md
Example: How to Use with AI
When using an AI assistant, always specify the layer (e.g., “Generate a Service for user management”), reference the relevant skill file, and follow the best practices linked above.
For more details, see the skills and best practices files linked above.