usecase

Creates transactional application use cases for TypeScript and Go backends with outbox event persistence.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill usecase-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: usecase
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/usecase
Command: npx skills add https://github.com/gabriellst/codm --skill usecase-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Implementing command-side business operations consistently across a polyglot DDD codebase is error-prone: developers forget transaction boundaries, publish events outside the atomic write, or place format validation in the wrong layer. This Skill encodes the exact patterns for building use cases that orchestrate entities, repositories, and domain events inside a UnitOfWork transaction. ## Core Features & Use Cases - Language dispatch hub: Routes to TypeScript or Go playbooks based on file extension, with per-language registries of patterns and bad practices. - Transactional outbox pattern: Enforces saving domain events via the domain event repository inside the same transaction as entity writes, with external I/O kept outside the transaction. - Saga orchestration: Documents parent-child use case composition where the parent passes its transaction to children for atomic multi-step operations. - Use Case: Implementing a CompleteOnboarding operation that creates a doctor, clinic, and unit atomically, rolling back all writes if any step fails. ## Quick Start Ask the agent to create a use case named CreateProduct in the product context following the usecase skill for the TypeScript backend.

Frequently Asked Questions about usecase

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

FAQPage Schema
How do I create a transactional use case in TypeScript with Zod schemas?

Define exported InputSchema and OutputSchema with z.object, extend the Handler base class, and wrap all database operations in this.withTransaction inside the handle method. Pass the transaction to every repository call and persist domain events via domainEventRepository.save in the same transaction.

How do I implement a Go use case with UnitOfWork and fx?

Define a struct implementing types.Handler with Name and Execute methods, inject dependencies through a constructor, and wrap all database mutations in uow.Execute. Register the handler with fx.Provide in module.go and persist domain events inside the transaction closure.

Where should format validation live in a use case?

In TypeScript, format validation belongs only in controllers; use case schemas carry shape without refinements. In Go, validate tags are required on both the controller request struct and the use case Input struct because Go use cases are also invoked from non-HTTP paths like webhook handlers and workers.

Why should domain events not be published directly from a use case?

Direct publishing breaks atomicity: if the transaction rolls back, a published event cannot be undone. Instead, save events to the domain event repository inside the same transaction, and let the outbox dispatcher deliver them asynchronously after commit.

When should I not use a command use case?

Do not use it for read queries serving the UI, which belong in query use cases with direct ORM access, or for reacting to events, which belongs in event handlers. Single-entity business rules belong in entity methods rather than use case orchestration.