Scaffold a new bounded context with hexagonal layers
When to use: You're starting a new feature and want the layering right from day one.
Prerequisites
- 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
Flow
-
Name the contextUse symfony-hexagonal-skill. Scaffold a 'Billing' bounded context with Invoice aggregate, issue/void commands, and a query for open invoices.✓ Copied→ src/Billing/Domain, Application, Infrastructure folders with proper separation
-
Wire the infrastructureAdd a Doctrine adapter for InvoiceRepository behind the domain port.✓ Copied→ 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.✓ Copied→ Controller calls bus, not repository directly
Outcome: A clean bounded context that won't turn into spaghetti in 6 months.
Pitfalls
- Domain depending on Doctrine annotations — Use XML / attribute mapping in Infrastructure, not on domain entities