/laravel-ddd:decide-compositionfrom laravel-ddd
When to use Trait+Interface vs Abstract Class. The art of mixing behaviors.
Ships in laravel-ddd. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
"Favor composition over inheritance."
Use Trait + Interface when:
Use Abstract Class when:
Ask: "Does this class have this behavior, or is it this thing?"
| Ask Yourself | Answer | Use |
|---|---|---|
| Does every subclass need this? | Yes | Abstract |
| Can multiple unrelated classes need this? | Yes | Trait |
| Is there a clear IS-A relationship? | Yes | Abstract |
| Is this a capability/feature? | Yes | Trait |
For concrete examples from Laravel, Spatie, and production code, see examples.md.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub attac-t/the-foundry --plugin laravel-ddd47 skills in this plugin
Other plugins' skills for the same job
/craft-contextCrafting Context Objects. Parameter encapsulation for complex operations.