global-conventions

Defines naming, exception, DTO, and logging conventions for a DDD hexagonal Spring Boot codebase.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When multiple developers or AI agents write code for a DDD hexagonal Spring Boot project, inconsistent package naming, class suffixes, exception handling, and DTO usage quickly erode the architecture. This Skill provides a single authoritative rulebook so every new class, exception, DTO, and log statement follows the same global conventions. ## Core Features & Use Cases - Package and Class Naming Catalog: Enforces lowercase package structure (SDD.smash.domain.<context>.<layer>) and a complete suffix catalog (...Policy, ...JpaEntity, ...RedisAdapter, ...QueryService, etc.) per layer. - Exception Design Rules: Standardizes DomainException + ErrorCode with HTTP status mapping isolated in ErrorCodeHttpMapper, keeping the domain free of framework dependencies. - DTO Three-Way Separation: Mandates distinct domain models, application DTOs, and presentation DTOs, with records as the default and primitive types confined to the presentation boundary. - Logging Standards: Defines per-layer logging policy (no logging in domain), @Slf4j usage, placeholder formatting, and secret-masking rules. - Use Case: When adding a new ErrorCode, creating a use-case service, or naming a JPA adapter in the smash/ProvinceHow backend, consult this Skill to pick the correct package, suffix, and validation pattern. ## Quick Start Ask the AI to create a new domain service or exception for the smash backend following the global-conventions rules.

Frequently Asked Questions about global-conventions

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

FAQPage Schema
How do I name classes in a DDD hexagonal Spring Boot project?

Use the layer-specific suffix catalog: domain services end in Policy or Calculator, JPA mapping classes end in JpaEntity, port implementations end in RepositoryAdapter or RedisAdapter, and use cases end in Service or QueryService. Packages are all lowercase under SDD.smash.domain.<context>.<layer>.

How should exceptions be designed in a hexagonal architecture?

Throw DomainException carrying an ErrorCode enum for all domain rule violations. Keep HttpStatus out of ErrorCode since it is a domain concept; map codes to HTTP statuses only in a web-layer ErrorCodeHttpMapper, and let a global @RestControllerAdvice handle responses.

Should domain models be serialized directly as JSON API responses?

No. Keep three separate types: domain models in domain/model, use-case DTOs in application/dto, and HTTP contracts in presentation/dto. Controllers accept primitives, promote them to value objects immediately, and return ResponseEntity of presentation DTOs only.

Where should validation logic live in a DDD codebase?

Put format validation inside value object constructors, such as checking SigunguCode length in its compact constructor. Existence checks belong to repository port queries, and presentation layers rely on Bean Validation annotations rather than manual checks.

Can the domain layer use logging or utility classes?

No. The domain layer must not contain log statements; rule violations are expressed as exceptions. It also must not import global/util technical helpers, since domain calculations belong in domain/service Policy classes like RentStatCalculator.

When should application.port.out be used instead of domain.port?

Only as an exception when the port signature requires application DTO types. The default location for out-ports such as Repository, Provider, Cache, and Query interfaces is domain.port, keeping the domain as the dependency center.