queues-and-jobs
Skill4 starsChanged 5 months agoMITView on GitHub
Design and operate Laravel queues, jobs, workers, and Horizon with retry safety, idempotency, failure handling, tests, and production visibility.
In this repository75 other files it gives its agents.
- AGENTS.mdAGENTS.md
- templates/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- actions-and-servicesSkill
- ai-sdkSkill
- api-resources-and-paginationSkill
- api-surface-evolutionSkill
- architectureSkill
- blade-components-and-layoutsSkill
- brainstormingSkill
- code-review-requestsSkill
- complexity-guardrailsSkill
- config-env-storageSkill
- constants-and-configurationSkill
- controller-cleanupSkill
- controller-testsSkill
- custom-helpersSkill
- daily-workflowSkill
- database-transactionsSkill
- data-chunking-large-datasetsSkill
- debugging-promptsSkill
- dependencies-trim-packagesSkill
- documentation-best-practicesSkill
- e2e-playwrightSkill
- effective-contextSkill
- eloquent-patternsSkill
- eloquent-relationshipsSkill
- exception-handling-and-loggingSkill
- executing-plansSkill
- extract-laravel-standardsSkill
- filesystem-uploadsSkill
- form-requestsSkill
- horizon-metrics-and-dashboardsSkill
- http-client-resilienceSkill
- integrate-whatsapp-baileys-laravelSkill
- interfaces-and-diSkill
- internationalization-and-translationSkill
- iterating-on-codeSkill
- laravel-11-12-app-guidelinesSkill
- laravel-database-optimizationSkill
- laravel-prompting-patternsSkill
- laravel-specialistSkill
- least-codeSkill
- livewire-developmentSkill
- memory-managementSkill
- migrations-and-factoriesSkill
- module-per-menuSkill
- nova-resource-patternsSkill
- performance-cachingSkill
- performance-eager-loadingSkill
- performance-select-columnsSkill
- php-attributesSkill
- policies-and-authorizationSkill
- ports-and-adaptersSkill
- prompt-structureSkill
- quality-checksSkill
- rate-limitingSkill
- request-forgery-protectionSkill
- responsive-ui-testingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Use queues for work that can happen outside the request cycle: notifications, imports, exports, media processing, integration callbacks, …
- Distinctive: line 29
after-commit dispatch when jobs depend on committed records.
- Distinctive: line 67
Do not force Horizon on every project.
- Distinctive: line 78
When Horizon is installed:
- Distinctive: line 81
keep worker timeout below the queue driver's retry-after window.
- Distinctive: line 100
Keep scheduled commands testable independently from cron.
- Very specific: line 104
Use Queue::fake() or Bus::fake() to assert dispatching.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Queues And Jobs
Use queues for work that can happen outside the request cycle: notifications, imports, exports, media processing, integration callbacks, long-running calculations, and retryable external operations.
This is the canonical queue skill. It consolidates the former queues-and-horizon topic while keeping horizon-metrics-and-dashboards for focused observability work.
Detect The Queue Stack
Confirm the queue connection, worker manager, Horizon installation, failed-job storage, deployment process, and local runner before changing configuration or issuing operational commands. Do not assume Horizon is installed merely because Redis is used.
Job Design
Queued jobs should be safe to retry.
Prefer:
- passing IDs or small scalar payloads;
- reloading models in
handle(); - explicit
tries, backoff, timeout, and failure behavior when the job is important; - idempotency keys or state checks for external side effects;
- after-commit dispatch when jobs depend on committed records.
final class ProcessRecord implements ShouldQueue
{
public function __construct(public int $recordId)
{
}
public function handle(): void
{
$record = Record::query()->findOrFail($this->recordId);
if ($record->processed_at !== null) {
return;
}
// Perform idempotent work.
}
}Dispatching
Dispatch after commit when a queued job needs database writes to be visible.
ProcessRecord::dispatch($record->id)->afterCommit();Failure Handling
Separate transient failures from permanent failures. Retry network and temporary provider issues; fail fast for invalid state or bad input.
Log failures with redacted context. Do not log secrets, tokens, signatures, full payloads, or unnecessary personal data.
Horizon And Workers
Do not force Horizon on every project. Use Horizon or equivalent visibility when queue volume, failed jobs, throughput, or production support justifies it.
Worker configuration should account for:
- queue priorities;
- memory limits;
- timeouts;
- retry/backoff;
- graceful restarts;
- failed job storage.
When Horizon is installed:
- align supervisors with real queue names and priorities;
- keep worker timeout below the queue driver's retry-after window;
- balance processes based on workload behavior rather than one global queue;
- tag jobs with low-cardinality identifiers that help operators diagnose failures;
- protect the dashboard with production authorization;
- terminate or restart workers through the deployment lifecycle so new code is loaded safely.
Without Horizon, apply the same timeout, memory, retry, graceful-restart, and failed-job expectations to the selected process manager.
Scheduling
Scheduled tasks should use overlap protection for long-running or non-reentrant work.
Schedule::command('records:process')
->everyFiveMinutes()
->withoutOverlapping()
->onOneServer();Keep scheduled commands testable independently from cron.
Testing
Use Queue::fake() or Bus::fake() to assert dispatching. Test job behavior directly when the job contains meaningful logic.
Also verify retry/idempotency behavior, failure callbacks, batch or chain behavior when used, and after-commit dispatch for jobs that depend on newly written data. For operational changes, inspect the effective worker/Horizon configuration and perform a safe local smoke test when the required services are available.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

