/laravel-ddd:decide-guard-vs-exceptionfrom laravel-ddd
When to return early vs throw. Control flow clarity.
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.
"Guards return. Exceptions signal failure."
Return early when:
Throw exception when:
Ask: "Can the caller proceed normally with a return value?"
| Scenario | Answer | Use |
|---|---|---|
| Empty input, nothing to do? | Ok | Return |
| Already processed? | Ok | Return |
| Rate limited, retry later? | Maybe | Return Result |
| Missing required data? | Not ok | Throw |
| Unauthorized access? | Not ok | Throw |
| Invalid state (bug)? | Not ok | Throw |
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
/craft-contextCrafting Context Objects. Parameter encapsulation for complex operations.Other plugins' skills for the same job