Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
schedule-artisan-task
schedule-artisan-task
alizharb/agent-skills
claude-code
scheduler
artisan
cron
queues
logging
concurrency

Use when scheduling daily jobs, cleanups, statistics generation, or configuring Laravel scheduler options.

Install
php artisan boost:add-skill alizharb/agent-skills

Save this content to: .claude/skills/schedule-artisan-task/SKILL.md

# Schedule Artisan Task

## When To Use

Use this skill when introducing cron-like tasks, scheduling cleanups, syncing data on intervals, or testing scheduler rules.

## Workflow

1. **Locate schedule entrypoint**: Open `routes/console.php`.
2. **Define task schedule**: Use `Schedule::command()` or `Schedule::job()`.
3. **Prevent concurrency**: Chain safety methods (`withoutOverlapping()`, `onOneServer()`).
4. **Log output**: Enforce logging of failures using `onFailure()`.

## Examples

### Good Example

```php
// routes/console.php
use Illuminate\Support\Facades\Schedule;
use App\Jobs\SyncInventoryWithExternalApi;

Schedule::job(new SyncInventoryWithExternalApi)
    ->hourly()
    ->onOneServer()
    ->withoutOverlapping()
    ->onFailure(function (Throwable $e) {
        Log::error('Inventory sync failed: ' . $e->getMessage());
    });
```

### Bad Example

```php
// ❌ Inline heavy database loop, no overlapping prevention, no multi-server safety
Schedule::call(function () {
    foreach (User::all() as $user) {
        $user->calculateStats(); // Blocks the scheduler, overlaps if execution takes > 1 min, duplicates on multi-server!
    }
})->everyMinute();
```
---

Schedule Artisan Task

When To Use

Use this skill when introducing cron-like tasks, scheduling cleanups, syncing data on intervals, or testing scheduler rules.

Workflow

  1. Locate schedule entrypoint: Open routes/console.php.
  2. Define task schedule: Use Schedule::command() or Schedule::job().
  3. Prevent concurrency: Chain safety methods (withoutOverlapping(), onOneServer()).
  4. Log output: Enforce logging of failures using onFailure().

Examples

Good Example

// routes/console.php
use Illuminate\Support\Facades\Schedule;
use App\Jobs\SyncInventoryWithExternalApi;

Schedule::job(new SyncInventoryWithExternalApi)
    ->hourly()
    ->onOneServer()
    ->withoutOverlapping()
    ->onFailure(function (Throwable $e) {
        Log::error('Inventory sync failed: ' . $e->getMessage());
    });

Bad Example

// ❌ Inline heavy database loop, no overlapping prevention, no multi-server safety
Schedule::call(function () {
    foreach (User::all() as $user) {
        $user->calculateStats(); // Blocks the scheduler, overlaps if execution takes > 1 min, duplicates on multi-server!
    }
})->everyMinute();

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib