backend-conventions

Defines DDD hexagonal architecture workflows and layered JUnit5 testing conventions for Spring Boot backends.

Updated Aug 10, 2026
One-click install
npx skills add https://github.com/LeeHyunWoo02/ProvinceHow --skill backend-conventions-leehyunwoo02
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-conventions
Source: https://github.com/LeeHyunWoo02/ProvinceHow/tree/main/.claude/skills/backend-conventions
Command: npx skills add https://github.com/LeeHyunWoo02/ProvinceHow --skill backend-conventions-leehyunwoo02

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When adding features to a DDD hexagonal Spring Boot codebase, developers often misplace business logic in services or controllers, creating anemic domain models and untestable code. This Skill provides the exact workflow, placement rules, and testing strategy for building domain models, policies, use cases, and controllers in the smash (ProvinceHow) backend. ## Core Features & Use Cases - Inside-Out Feature Workflow: Guides building features from domain model to policy, port, use case, adapter, and controller, with tests passing at each stage. - Logic Placement Rules: Provides decision tables for where code belongs (domain model, enum method, Policy, application service, infrastructure, presentation) and refactoring signals for anemic models. - Layered Test Strategy: Defines a test pyramid using pure JUnit for domain logic, Mockito port mocking for use cases, @WebMvcTest slices for controllers, and Testcontainers-based integration tests. - Use Case: When adding a new scoring feature like job-fit scoring, follow the four-way decomposition pattern (enum normalization, Policy formula, repository port, cache port) and write pure JUnit tests for the policy before touching Spring. ## Quick Start Use the backend-conventions skill to implement a new domain feature with its policy, use case, controller, and tests following the DDD layered structure.

Frequently Asked Questions about backend-conventions

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a new feature in a DDD hexagonal Spring Boot project?

Build inside-out: start with the domain model and value objects, add domain policies as pure functions, define out-port interfaces, then write the application service, infrastructure adapters, and finally the controller. Each layer's tests should pass before moving outward.

Where should business logic go in a hexagonal architecture?

Logic using only an object's own data goes in the aggregate or value object; type-based branching goes in enum methods; rules spanning multiple aggregates go in a domain Policy class; orchestration of repositories, caches, and APIs belongs in the application service layer.

How do I test application services without Spring or a database?

Mock the out-port interfaces with Mockito using @ExtendWith(MockitoExtension.class) and @InjectMocks, or use in-memory fake port implementations. Since services depend only on port interfaces, no RedisTemplate or JPA stubbing is needed.

Should I create UseCase interfaces for application services?

No. In this codebase the application Service class itself is the public entry point, and controllers or other contexts inject it directly. Only out-ports in domain/port remain interfaces, since dependency inversion is their purpose.

Why do integration tests fail at context loading after adding a config property?

New ${...} placeholders must also be added to src/test/resources/application.properties, which fills all placeholders without profiles. Integration tests use Testcontainers MySQL via IntegrationTestSupport, so a Docker daemon must be running.