resources/boost/skills/helpers/SKILL.md
Stateless utility classes providing shared formatting, conversion, or calculation logic needed across multiple parts of the application.
npx skillsauth add codebar-ag/coding-guidelines helpersInstall 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.
nesbot/carbon for date parsing).app/Helpers/*Helper.php.null, invalid format, boundary values).app/Helpers/PascalCase with a Helper suffix → StringHelper, MoneyHelper, DateHelperApp\Helpers\Formatting\, App\Helpers\Conversion\)static when output depends only on input arguments.namespace App\Helpers;
use Carbon\Carbon;
class DateHelper
{
public static function format(mixed $date, string $format = 'd M Y'): ?string
{
if (is_null($date)) {
return null;
}
return Carbon::parse($date)->format($format);
}
}
namespace App\Helpers;
class MoneyHelper
{
public static function format(int $amountInCents, string $currency = 'CHF'): string
{
return number_format($amountInCents / 100, 2) . ' ' . $currency;
}
}
// Usage in a Resource
'created_at' => DateHelper::format($this->created_at),
'amount' => MoneyHelper::format($this->amount_in_cents),
// Instance helper for injectable collaborators or config
namespace App\Helpers\Formatting;
class LocalizedMoneyFormatter
{
public function __construct(
private readonly string $defaultCurrency = 'CHF',
) {}
public function format(int $amountInCents, ?string $currency = null): string
{
$resolvedCurrency = $currency ?? $this->defaultCurrency;
return number_format($amountInCents / 100, 2) . ' ' . $resolvedCurrency;
}
}
use App\Helpers\DateHelper;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;
class DateHelperTest extends TestCase
{
#[Test]
public function it_formats_dates_and_handles_null(): void
{
$this->assertSame('21 Jan 2026', DateHelper::format('2026-01-21', 'd M Y'));
$this->assertNull(DateHelper::format(null));
}
}
AppHelper or Utils class — keep helpers domain-specificActions/SKILL.md — for business logicResources/SKILL.md — helpers are commonly used for formatting in API resources// BEFORE (anti-pattern): null silently becomes "now", masking missing data bugs
public static function format(?string $date, string $format = 'd M Y'): string
{
return Carbon::parse($date)->format($format);
}
// AFTER: explicit null contract preserves correctness at call sites
public static function format(?string $date, string $format = 'd M Y'): ?string
{
if ($date === null) {
return null;
}
return Carbon::parse($date)->format($format);
}
testing
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.