About laravel-jobs
laravel-jobs is a skill for Laravel developers that describes background job and event-listener patterns. It emphasizes keeping jobs as thin delegation layers, with domain logic in actions.
Key features
- 01Delegate jobs to actions
- 02Configure queues, retries, and timeouts
- 03Define unique jobs and job middleware
- 04Structure event listeners
- 05Choose between jobs and synchronous actions
Use cases
- 01Move background processing into delegated actions
- 02Set retry and timeout behavior for queued jobs
- 03Prevent duplicate execution with unique jobs
- 04Choose a job or synchronous action for a task
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ leeovery/ agentic-skills --skill laravel-jobsAfter installing, type/laravel-jobsin Claude Code to confirm it loaded.
Bundled filesreferences/jobs-listeners.md
Details
From the project READMELaravel Jobs
Background jobs and event listeners: thin delegation layers to actions.
Core Concept
jobs-listeners.md - Job patterns:
- Jobs as thin delegation layers
- Queue configuration
- Retry logic and timeouts
- Unique jobs
- Job middleware
- Event listeners
- When to use jobs vs sync actions
Pattern
final class ProcessOrderJob implements ShouldQueue
{
use Dispatchable, Queueable;
public function __construct(
public readonly int $orderId,
) {}
public function handle(ProcessOrderAction $action): void
{
$order = Order::findOrFail($this->orderId);
$action($order);
}
public function middleware(): array
{
return [new WithoutOverlapping($this->orderId)];
}
}
// Listener
final class SendOrderConfirmationListener
{
public function handle(OrderPlaced $event): void
{
SendOrderConfirmationJob::dispatch($event->order->id);
}
}
Jobs delegate to actions. Keep domain logic in actions, not jobs.
Comments
Markdown supported