Back to list
Dev-Int

create-use-case

by Dev-Int

Tests for help and skill :wink:

0🍴 0📅 Jan 16, 2026

SKILL.md


name: create-use-case description: Create a new business use case (Request + UseCase + Test) following TDD workflow. Use when user asks to implement new business logic, domain operations, or create commands/queries. Always follow Red-Green-Refactor cycle.

Create Use Case

Generate Request, UseCase, and Test following TDD workflow.

IMPORTANT: Always uses tdd-workflow skill (MANDATORY)


When to Use

  • New business logic
  • Domain operations
  • Commands (Create, Update, Delete, Rename)
  • Queries (Find, List, Search)

Inputs/Outputs

InputExampleOutput
bcAdminBC/UseCases/Entity/ActionEntity/
entityArticleActionEntity.php (UseCase)
actionRenameActionEntityRequest.php (Request)
fields['name']ActionEntityTest.php (Test)

Process

Follow: .claude/skills/tdd-workflow/ (MANDATORY)

PhaseFileTemplate
REDTest.php.claude/templates/test-unit.php.tpl
GREENRequest.php + UseCase.php.claude/templates/request.php.tpl, use-case.php.tpl
REFACTOR-make cs-fixer && make stan && make ta
VALIDATE-make qa

Structures

Request (interface):

interface ActionEntityRequest {
    public function uuid(): ResourceId;
    public function field(): string;
}

UseCase (readonly, single execute()):

final readonly class ActionEntity {
    public function __construct(private EntityRepository $repo) {} // OR Finder
    public function execute(ActionEntityRequest $req): ActionEntityResponse {
        // Business logic
        return new ActionEntityResponse($entity);
    }
}

See: docs/QUICK_REF.md#usecase-pattern for complete structure

Note: Project uses Request-Response pattern. Symfony Maker bin/console make:use-case:create <bc> <name> generates all 3 files (Request, UseCase, Response).


Rules

Repository vs Finder:

  • Commands (CUD) → Repository
  • Queries (R) → Finder

See: docs/GLOSSARY.md#repository-vs-finder

Tests:

  • Use DataBuilder (NOT Foundry)
  • Mock: expects()->once()

Templates

  • test-unit.php.tpl
  • request.php.tpl
  • use-case.php.tpl

Location: .claude/templates/


References

  • TDD workflow: .claude/skills/tdd-workflow/
  • Quick pattern: docs/QUICK_REF.md#usecase-pattern
  • Architecture: docs/architecture.md#usecase

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon