/laravel-playbook:craft-apifrom laravel-playbook
Crafting API surfaces. Entry points, fluent builders, progressive disclosure.
Ships in laravel-playbook. 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.
"The best API is the one developers already know how to use before reading the docs."
One Obvious Entry Point: Every package has one clear "start here." Never two equally-valid paths to the same thing.
| Style | Example | When |
|---|---|---|
| Trait method | $model->addMedia($file) | Package augments a model |
| Static factory | QueryBuilder::for(User::class) | Package is standalone |
::make() schema builder | TextInput::make('name') | Declarative UI/component system (Filament) |
| Manager / driver | Notification::driver('slack') | Multi-implementation service |
| Helper function | activity()->log('...') | Universal utility, used everywhere |
| Constructor | new UserData(name: 'John') | Value objects, DTOs |
Fluent Builders: Configuration methods return $this. Terminal methods return the result. Configuration accumulates, execution happens once. The terminal method name makes the action explicit.
Terminal Method Pattern: Configure, then execute. The builder is inert until the terminal method fires. Never mix configuration with execution.
Progressive Disclosure: Four layers. Each additive.
Named Constructors: Static factory methods for value objects and declarations. Every common case gets its own factory. AllowedFilter::exact(), ::partial(), ::scope(), ::callback().
Conditionable and Tappable Traits: Add Conditionable to builders for fluent conditional logic (when(), unless()) without breaking method chains. Add Tappable for inspection/side-effects mid-chain.
Method Naming: Consistent verb prefixes across the entire package.
| Prefix | Contract | Example |
|---|---|---|
has | Returns bool | hasRole(), hasMedia() |
get | Returns the value | getMedia(), getTranslation() |
set | Assigns the value | setTranslation(), setLocale() |
add | Appends | addMedia(), addLogChange() |
find | Looks up by identifier | findByName(), findById() |
sync | Replaces all | syncRoles(), syncPermissions() |
clear | Removes all | clearMediaCollection() |
using / with | Fluent configuration | usingName(), withProperties() |
scope | Query scope | scopeRole(), scopePermission() |
Break these conventions and developers lose trust in the API.
Type-Rich Signatures: Accept everything reasonable. Return types on everything. Union types are a feature, not a smell.
IDE Coverage: Comprehensive @throws on every method that can throw. Full @template and @mixin coverage. Generics on builders, @mixin annotations on proxied classes. The IDE experience is mandatory.
| Don't | Do | Why |
|---|---|---|
| Two equally-valid entry points | One obvious path | Ambiguity erodes confidence |
| Builder methods that execute | Separate configuration from execution | Side effects in configuration are invisible bugs |
Return void from fluent methods | Return $this or static | Breaks method chaining |
| Missing return type annotations | Explicit types on every method | IDE and static analysis depend on it |
| Inconsistent verb prefixes | Follow the naming table above | Predictability is the API contract |
Accept only string when BackedEnum makes sense | Union types: string or BackedEnum | Meet developers where they are |
| Manual conditional logic in chains | Use Conditionable trait | when() and unless() are cleaner |
See also: craft-trait (trait-based entry points), decide-facade (choosing the right entry point pattern).
See examples.md.
What SKILL.md sets; muted values are Claude Code's defaults
29 skills in this plugin
Other plugins' skills for the same job
/craft-deprecationCrafting deprecations. Sunset gracefully, remove confidently.npx claudepluginhub attac-t/the-foundry --plugin laravel-playbook