resources/boost/skills/jobs/SKILL.md
Queueable units of work for background processing. Jobs handle queue configuration and failure handling — they delegate business logic to Actions or Services.
npx skillsauth add codebar-ag/coding-guidelines jobsInstall 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.
$tries, $backoff, $timeout, or queue selection.QUEUE_CONNECTION in .env).php artisan queue:work).app/Jobs/.ProcessInvoicePayment, SendWeeklyReport, ImportProductCsv.ShouldQueue for asynchronous jobs.Dispatchable, InteractsWithQueue, Queueable, SerializesModels.$queue, $tries, $backoff, $timeout).WithoutOverlapping, RateLimited, tenant/context middleware).handle() thin and delegate to an Action or Service.failed(Throwable $exception) for permanent failure handling.namespace App\Jobs;
use App\Actions\ProcessInvoicePayment;
use App\Models\Invoice;
use Illuminate\Support\Facades\Log;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Throwable;
class ProcessInvoicePaymentJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public int $tries = 3;
public int $backoff = 60;
public int $timeout = 120;
public string $queue = 'invoices';
public function __construct(
private readonly Invoice $invoice,
) {}
public function handle(ProcessInvoicePayment $action): void
{
$action->execute($this->invoice);
}
public function failed(Throwable $exception): void
{
Log::error('Invoice payment job failed permanently.', [
'invoice_id' => $this->invoice->id,
'message' => $exception->getMessage(),
]);
}
}
// Dispatch from a controller
class InvoicePaymentController extends Controller
{
public function __invoke(Invoice $invoice): JsonResponse
{
ProcessInvoicePaymentJob::dispatch($invoice);
return new JsonResponse(['status' => 'queued'], 202);
}
}
// Dispatch from a listener
class QueueInvoicePayment
{
public function handle(InvoiceApproved $event): void
{
ProcessInvoicePaymentJob::dispatch($event->invoice)
->delay(now()->addMinutes(5));
}
}
// Synchronous dispatch for tests or strict inline flow
ProcessInvoicePaymentJob::dispatchSync($invoice);
// Backoff strategy examples
public int|array $backoff = 60; // fixed: retry every 60s
// public array $backoff = [10, 30, 90, 300]; // exponential-ish progression
// Job middleware example
public function middleware(): array
{
return [
new WithoutOverlapping("invoice:{$this->invoice->id}"),
];
}
// Chaining and batching examples
Bus::chain([
new PrepareInvoiceDataJob($invoiceId),
new ProcessInvoicePaymentJob($invoiceId),
])->dispatch();
Bus::batch([
new ImportLineItemJob($rowA),
new ImportLineItemJob($rowB),
])->dispatch();
handle() delegates business logic to an Action/Service.$tries, $backoff, $timeout, $queue) are explicit.failed() captures actionable context (IDs, error message, alert/log).handle() method instead of delegating to an Action or Service$tries, $backoff, or $timeout and relying on global queue defaultsfailed() method for jobs that process critical dataActions/SKILL.md — for the business logic jobs delegate toServices/SKILL.md — for complex orchestration delegated from jobstesting
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.