Use Cases & Orchestration
SkillDev toolsOrchestrate services and repositories through use cases to implement application-level workflows and business scenarios.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Use Cases & Orchestration skill
What this skill tells your AI
The instructions your AI receives, as published by cliqrelay/cliqrelay in .agents/skills/backend/use-cases-and-orchestration/SKILL.md and read by ahel’s review.
When to use this skill
- Implement workflows that span multiple services
- Define reusable operations that handlers invoke
- Keep handlers thin by moving logic into use cases if multiple services are needed/used
- Encapsulate business logic and orchestration in a single place
- Coordinate complex operations that require multiple steps and services
Key principles
- Service orchestration: Use cases call multiple services
- Business-focused: Methods represent user actions, not HTTP operations
- Dependency injection: Services passed at construction
- Pure domain: No HTTP, no routing, just business logic delegated to services. Usecases simply orchestrate services and handle validation, errors, and return domain models
- Testable: Can be tested independently by mocking services as services are interfaces
Pattern
Use cases orchestrate services:
- Implement as structs with service dependencies
- Single public Execute or action method e.g.
RegisterUseCasewithExecute(ctx context.Context, reqCtx *models.RequestContext) (res *someStructType, error). Therescan be a domain model that returns the data from each service's method output, but should not be an HTTP response. The handler can convert it to an HTTP response if needed. - Handle validation such as checking request parameters passed down from the handler.
- Coordinate multiple services sequentially
- Handle errors and return domain models
Example
See examples/todo_usecases.go for:
- CreateTodoUseCase orchestrating TodoService
- MarkTodoCompleteUseCase patterns
- Request/response types and error handling
Common mistakes
- Use cases returning HTTP status codes
- Validation in handlers instead of use cases
- Use cases calling other use cases
- Creating new services instead of injecting
- Use cases with no clear purpose
References
- internal/usecases/ - Core use cases
- plugins/email-password/usecases/ - Plugin use case examples
- plugins/email-password/types/ - Request/response types
Signals
- GitHub stars
- 40
- Forks
- 1
- Last commit
- Sep 2026
Advanced
- Catalog kind
- skill
- Gateway key
use-cases-and-orchestration- Source
- github.com/cliqrelay/cliqrelay