Task scheduling

From jpcaparas/superpowers-laravel · View interactive version

Task scheduling is an AI agent skill from the GitHub repository jpcaparas/superpowers-laravel. Schedule tasks with safety; use withoutOverlapping, onOneServer, and visibility settings for reliable cron execution

How to use this skill

Skill file

Task Scheduling

Run scheduled tasks predictably across environments.

Commands

// app/Console/Kernel.php
protected function schedule(Schedule $schedule): void
{
    $schedule->command('reports:daily')
        ->dailyAt('01:00')
        ->withoutOverlapping()
        ->onOneServer()
        ->runInBackground()
        ->evenInMaintenanceMode();
}

# Run the scheduler from cron
* * * * * cd /var/www/app && php artisan schedule:run >> /dev/null 2>&1

Patterns

Laravel 13+

# Group lifecycle callbacks
Schedule::group([
    Command::command('reports:generate'),
    Command::command('emails:send'),
])->before(fn () => /* setup */)->after(fn () => /* teardown */);

# Release overlap locks on SIGTERM/SIGINT for fast redeploys
$schedule->command('reports:generate')->withoutOverlapping(releaseOnSignal: true);

# Inspect what runs per environment
sail artisan schedule:list --environment=production   # or: php artisan schedule:list --environment=production
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.