develop-usecase

Implements one Go usecase unit through a TDD cycle of failing test, implementation, and refactoring.

Updated Sep 14, 2026
One-click install
npx skills add https://github.com/nakamori-naoya/go-convention-plugins --skill develop-usecase-nakamori-naoya
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: develop-usecase
Source: https://github.com/nakamori-naoya/go-convention-plugins/tree/main/plugins/go-convention/skills/develop-usecase
Command: npx skills add https://github.com/nakamori-naoya/go-convention-plugins --skill develop-usecase-nakamori-naoya

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It coordinates the full TDD cycle for a single Go usecase (one command or one query) so the test is written and verified red before implementation turns it green, without mixing test and implementation conventions into one step. ## Core Features & Use Cases - Orchestrated TDD cycle: Runs fix-unit, write-failing-test, run-red, implement, run-green, refactor, align-errors, and report steps in declared order via playbook.yml. - Convention delegation: Delegates test shape to the usecase test convention, implementation form to the usecase implementation convention, language style to the Go coding convention, and error wrapping to the error convention without redefining them. - Stop and resume conditions: Classifies red-test failure reasons, halts on out-of-scope failures (missing Docker, red lower layers, missing rdbtest helpers), and resumes from the first incomplete step. - Use Case: Given a domain-rule document describing a business event like confirming a reservation, produce a usecase whose test exercises the five wiring concerns (input resolution, collaboration, source selection, transaction boundary, persistence) against a real database before the Execute method is implemented. ## Quick Start Implement this reservation-confirmation usecase with TDD, writing the failing test first and then making it green.

Frequently Asked Questions about develop-usecase

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

FAQPage Schema
How do I implement a Go usecase with TDD?▼

Fix one usecase unit (command or query), write a failing test covering the five wiring concerns, verify it fails for the right reason, implement the minimal Execute logic, verify green across the package, then refactor without touching tests. The playbook.yml defines this step order.

What test setup does Go usecase testing require?▼

Usecase tests require Go 1.27, pgx/v5, dockertest, testify, and a running Docker daemon, plus rdbtest persistence test helpers with Seed and Read functions and a fixed IDGenerator implementation. Without Docker, tests fail rather than skip.

What counts as a valid red test in this TDD workflow?▼

A valid red means the target test function fails because the usecase type, Execute method, or Input/Output do not exist yet, or because returned values or DB state do not match expectations. Missing Docker, red lower-layer tests, or unrelated failures do not qualify.

When should error wrapping be aligned during usecase development?▼

Error alignment runs only when the unit added or changed layer-boundary wrapping or usecase-specific errors. It enforces a single %w wrap at the layer boundary and errors.Is-compatible forms, then confirms tests stay green.

What is out of scope for a usecase TDD unit?▼

Domain aggregates and value objects, SQL and repositories, RPC handlers, and document authoring are out of scope and returned to their own entry points. One cycle completes exactly one usecase; additional usecases start as new units after the current one is green.