Scaffold a new bounded context with hexagonal layers
使うタイミング: You're starting a new feature and want the layering right from day one.
前提条件
- Symfony 6.x+ project — composer create-project symfony/skeleton
- Skill installed — git clone https://github.com/aligundogdu/symfony-hexagonal-skill ~/.claude/skills/symfony-hexagonal-skill
フロー
-
Name the contextUse symfony-hexagonal-skill. Scaffold a 'Billing' bounded context with Invoice aggregate, issue/void commands, and a query for open invoices.✓ コピーしました→ src/Billing/Domain, Application, Infrastructure folders with proper separation
-
Wire the infrastructureAdd a Doctrine adapter for InvoiceRepository behind the domain port.✓ コピーしました→ Interface in Domain, implementation in Infrastructure, services.yaml binding
-
Expose via controllerAdd an HTTP adapter with a POST /invoices endpoint that dispatches the IssueInvoice command.✓ コピーしました→ Controller calls bus, not repository directly
結果: A clean bounded context that won't turn into spaghetti in 6 months.
注意点
- Domain depending on Doctrine annotations — Use XML / attribute mapping in Infrastructure, not on domain entities