usecase-expert

Design UseCase interfaces and CQRS Service implementations for Java/Spring Port-In layers.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/ryu-qqq/AuthHub --skill usecase-expert
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: usecase-expert
Source: https://github.com/ryu-qqq/AuthHub/tree/main/.claude/skills/usecase-expert
Command: npx skills add https://github.com/ryu-qqq/AuthHub --skill usecase-expert

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill guides the design and implementation of the Application Layer's UseCase interfaces (Port-In) and Service implementations. It ensures a clean separation of concerns, adheres to CQRS principles, and manages transaction boundaries properly, leading to highly maintainable and testable business logic.

Core Features & Use Cases

  • UseCase Interface Definition: Creates clear, single-responsibility UseCase interfaces (e.g., PlaceOrderUseCase, GetOrderUseCase) as inbound ports, defining the application's capabilities.
  • CQRS Service Implementation: Generates distinct Command Services (for state changes) and Query Services (for data retrieval), adhering to the "execute()" single-method pattern for consistency.
  • DTO Management: Defines Command, Query, and Response DTOs as immutable records, ensuring data integrity and clear communication between layers.
  • Transaction Boundary Delegation: Enforces that @Transactional annotations are managed by Facade/Manager components, not directly within Services, for better control and testability.
  • Use Case: When developing a new business capability, use this skill to define the UseCase interface, implement its service, and create the necessary DTOs. This ensures it aligns with the hexagonal architecture and CQRS, accelerating development and reducing architectural debt.

Quick Start

Create a 'Place Order' UseCase, including its interface, command DTO, response DTO, and service implementation.

Frequently Asked Questions about usecase-expert

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

FAQPage Schema
How do I design UseCase interfaces for a hexagonal architecture?▼

UseCase interfaces define your application's Port-In layer as single-method contracts (e.g., execute()). Design them as clean inbound ports for each business capability—command UseCases for state changes, query UseCases for data retrieval—following CQRS principles to separate read and write operations.

What's the best way to structure DTOs and responses in a CQRS application?▼

Define immutable Command, Query, and Response DTOs as records to ensure data integrity and clear layer boundaries. Keep them focused on their use case; Command DTOs carry input, Query DTOs specify retrieval criteria, and Response DTOs return results, maintaining strict separation between layers.

Where should @Transactional annotations go in a Service-based architecture?▼

@Transactional boundaries belong in Facade or Manager components, not directly in Services. This delegation keeps Services testable and transactional control centralized, allowing Facades to orchestrate Services, factories, and assemblers while managing transaction scope.

How do I implement the single-use-case execute pattern?▼

Each UseCase interface defines one execute() method accepting a single DTO (Command or Query) and returning a Response. This enforces single responsibility and consistency across your application layer, making services predictable and composable.

What components work together in the application layer for CQRS?▼

UseCase interfaces, Service implementations, CommandFactory, Assembler, and Facade/Manager components coordinate in the Port-In layer. Factories create commands, Assemblers map between DTOs and domain objects, Services execute logic, and Facades manage transactions and dependencies.

Can I use this pattern with Java and Spring applications?▼

Yes, this skill targets Java/Spring CQRS architectures specifically. It leverages Spring's @Transactional, component composition, and dependency injection to implement clean UseCase interfaces and Service layers aligned with hexagonal architecture principles.