一键导入
backend-architecture-spring-boot
DDD, hexagonal style, and naming conventions for Spring Boot
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
DDD, hexagonal style, and naming conventions for Spring Boot
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | backend-architecture-spring-boot |
| description | DDD, hexagonal style, and naming conventions for Spring Boot |
@RequiredArgsConstructor. Field @Autowired obscures dependencies from the AI's static analysis.domain/ layer completely free of Spring/JPA annotations to ensure pure, testable Java logic.Initialize any Spring Boot backend from scratch with these architectural rules:
domain package containing entities, value objects, and repository ports (interfaces). The domain must not have adapter or framework dependencies.@RequiredArgsConstructor on classes needing dependencies. Banned: Field @Autowired.@Mapper(componentModel = "spring"). Banned: reflection-based mapping or manually writing setter chains.@RestControllerAdvice class capturing all domain-specific exceptions and mapping them to standardized HTTP responses { error, message, status, timestamp }.resources/db/migration. Banned: relying on JPA hibernate.ddl-auto=update in production.src/main/java/com/company/project/
├── adapter/ # Inbound & outbound adapters
│ ├── inbound/
│ │ ├── controller/ # REST controllers
│ │ └── dto/ # Request/response DTOs
│ └── outbound/
│ ├── repository/ # JPA / data repositories
│ └── mapper/ # MapStruct mappers
├── domain/
│ ├── entity/ # Domain entities (@Entity)
│ ├── service/ # Business logic
│ ├── exception/ # Domain exceptions
│ └── port/ # Repository interfaces (ports)
└── common/
├── config/ # @Configuration classes
├── exception/ # Global exception handler
└── util/ # Utility classes
src/main/resources/
├── application.yml # Default config
├── application-dev.yml # Dev profile
└── application-prod.yml # Production profile
| Artifact | Convention | Example |
|---|---|---|
| Packages | lowercase.reverse.domain | com.company.project.domain.service |
| Classes | PascalCase | UserServiceImpl |
| Methods | camelCase | findByEmail |
| REST endpoints | plural nouns, kebab-case | /api/users/{id} |
| Tables | snake_case plural | user_roles |
| Columns | snake_case | created_at |
Structure the application so that the domain is the innermost, most stable layer.
@Entity where unavoidable).UserRepository interface in domain/port/ is implemented by JpaUserRepository in adapter/outbound/repository/.@Mapper interfaces; never hand-write set calls.@Mapping annotations for field name differences.Always inject dependencies via the constructor (Lombok @RequiredArgsConstructor or explicit constructor). Never use @Autowired on fields — it makes testing and immutability harder.
Create a single @RestControllerAdvice class that catches all exceptions.
UserNotFoundException) to specific HTTP status codes.{ error, message, status, timestamp }).ERROR level for 5xx; WARN for 4xx.| Layer | Test Type | Framework | File Naming |
|---|---|---|---|
| Domain service | Unit | JUnit 5 + Mockito | UserServiceTest.java |
| Controller | Slice test | @WebMvcTest | UserControllerTest.java |
| Repository | Slice test | @DataJpaTest | UserRepositoryTest.java |
| Full integration | Integration | @SpringBootTest | UserIntegrationTest.java |
@WebMvcTest and @DataJpaTest for focused tests — they bootstrap only the relevant context.Mockito for mocking; never use PowerMock.Testcontainers for database-dependent integration tests.Syncs Telegram supergroup topics into local task files and GitHub issues, using embedded Python scripts for deterministic JSON state management. Preserves raw bilingual messages verbatim, injects refactored prompts, and correlates codebase context.
100% Jetpack Compose, MVI (UDF), Hilt, and SQLDelight for token-efficient, zero-hallucination Android development.
NestJS, Prisma ORM, Vertical Slice Architecture, and Strict TypeScript for zero-hallucination backend development.
Expo Managed Workflow, Expo Router, NativeWind, and Strict TypeScript for zero-hallucination cross-platform apps.
Automatically generates decentralized task files based on manager instructions.
Idiomatic Go, Clean Architecture, and Gin routing best practices