Decide Namespacing

When to place code in Support vs Domain. Namespace decisions.

attac-t 0ac2822 2 files · 3.9 KB Updated

File contents

Skill: Namespacing

"Support is a package. Domain is the business."

The Doctrine

App/     → Thin orchestration (controllers, commands)
Domain/  → Business logic (models, actions, DTOs)
Support/ → Package-ready utilities (NEVER imports Domain)

The Decision

Place in Support when:

  • Could be extracted as a Composer package
  • Has zero business entity awareness
  • Works with primitives or its own Value Objects

Place in Domain when:

  • References any Domain model or DTO
  • Contains business rules
  • Specific to this application's domain

The Heuristic

Ask: "If I copy this to another Laravel project, does it work without changes?"

  • Yes → Support
  • No → Domain

The Quick Test

Ask Yourself Answer Use
Uses Domain\* imports? Yes Domain
Could be a package? Yes Support
Contains business rules? Yes Domain
Just a utility? Yes Support

Real-World Examples

For concrete examples, see examples.md.

attac-t/the-foundry/tree/main/plugins/laravel-ddd/skills/decide-namespacing commit 0ac2822b17

Frequently asked questions

npx skillmds@latest add attac-t/decide-namespacing