use-case-tdd

Scaffold TypeScript use cases with TDD and tsyringe DI registration.

1|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/jrmatherly/shipit --skill use-case-tdd
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: use-case-tdd
Source: https://github.com/jrmatherly/shipit/tree/main/.claude/skills/use-case-tdd
Command: npx skills add https://github.com/jrmatherly/shipit --skill use-case-tdd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a clear, repeatable workflow to add application-layer operations while ensuring correctness through strict Test-Driven Development, removing uncertainty about test order, DI registration, and minimal implementation steps.

Core Features & Use Cases

  • TDD-first scaffolding: Create failing unit tests, implement the minimal use case, and refactor in a disciplined RED-GREEN-REFACTOR loop.
  • DI registration guidance: Add required tsyringe decorators and register the new use case in the project's dependency injection container.
  • Standardized conventions: Enforces file, class, and test naming conventions and verification steps like typechecking and linting for consistent developer workflows.
  • Use Case Example: Add a CreateFeature use case that validates input, guards against duplicates via repository ports, and is covered by unit tests.

Quick Start

Ask the assistant to "Scaffold a new TypeScript use case named CreateFeature with a failing unit test, minimal implementation using tsyringe DI decorators, and DI container registration".

Frequently Asked Questions about use-case-tdd

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

FAQPage Schema
How do I scaffold a TypeScript use case following TDD RED-GREEN-REFACTOR?

To scaffold a TypeScript use case with TDD, create a failing Vitest unit test first, implement a minimal use case class with tsyringe DI decorators, then refactor and verify with typechecking and linting.

How does dependency injection registration work for new application-layer use cases?

Dependency injection registration uses @injectable and @inject decorators on the use case class, followed by registering the class in the project's tsyringe DI container while depending only on port interfaces.

What is the best way to add business logic to a repository with unit testing in TypeScript?

The best way to add repository business logic is extracting it into an application-layer use case, writing a failing Vitest test for input validation and duplicate guards, then implementing the minimal class against port interfaces.

Can I use Vitest with tsyringe for unit testing application-layer use cases?

Yes, Vitest works with tsyringe for unit testing use cases. You write a failing Vitest test first, then implement the minimal TypeScript class with @injectable and @inject decorators to satisfy the RED-GREEN-REFACTOR cycle.

When do I need to use port interfaces in TypeScript use case development?

You need port interfaces in TypeScript use case development when structuring dependency injection so the use case depends only on abstractions for repository interactions, ensuring the class remains testable and decoupled.

Why does my TypeScript use case need both @injectable and @inject decorators?

Your TypeScript use case needs @injectable and @inject decorators to enable tsyringe dependency injection, allowing the DI container to resolve repository port interfaces automatically during use case instantiation and registration.