resources/boost/skills/enums/SKILL.md
PHP backed string enums used instead of constants or magic strings. Enums include `label()` and `color()` helper methods and are cast on Eloquent models.
npx skillsauth add codebar-ag/coding-guidelines enumsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
app/Enums/.label(): string and color(): string helper methods on every enumcolor() for UI color tokens (for example Tailwind tokens like gray, green, red) unless the consuming UI explicitly requires a different formatapp/Enums/casts() methods$table->string('status')->default('draft')Status::Draft not 'draft'match expressions in label() and color() — never if/else chainsPascalCase for enum classes and PascalCase for cases (Status::Draft)enum Status: string
{
case Draft = 'draft';
case Active = 'active';
case Archived = 'archived';
public function label(): string
{
return match ($this) {
self::Draft => 'Draft',
self::Active => 'Active',
self::Archived => 'Archived',
};
}
public function color(): string
{
return match ($this) {
self::Draft => 'gray',
self::Active => 'green',
self::Archived => 'red',
};
}
}
// Model cast
protected function casts(): array
{
return [
'status' => Status::class,
];
}
// Usage
if ($invoice->status === Status::Draft) { ... }
echo $invoice->status->label(); // 'Draft'
'draft' instead of Status::Draftcasts() methodmatch expressions in label() or color()Models/SKILL.md — for how enums are cast in Eloquent modelstesting
Translation and localization conventions for Laravel. Use when adding user-facing strings, creating translation files, or working with lang/ directory.
tools
Reusable behaviour shared across multiple unrelated classes. Traits provide shared Eloquent scopes, accessors, lifecycle hooks, and small stateless helper methods.
development
Tailwind CSS v4 styling conventions. Use when working with CSS, Tailwind utilities, or customizing the theme in Laravel projects.
development
Orchestration classes that coordinate multiple Actions, external APIs, or domain operations into a cohesive workflow. Services own transaction boundaries and third-party API integrations.