From superpowers-sage
Creates and runs custom artisan-style CLI commands for WordPress using Acorn. Useful for scheduled imports, maintenance scripts, and automation tasks within Sage themes.
How this skill is triggered — by the user, by Claude, or both
Slash command
/superpowers-sage:acorn-commandsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Acorn commands are artisan-style CLI commands running inside WordPress context with full access to the Laravel container (services, Eloquent, config) **and** all WordPress functions (`get_posts()`, `wp_insert_post()`, etc.).
Acorn commands are artisan-style CLI commands running inside WordPress context with full access to the Laravel container (services, Eloquent, config) and all WordPress functions (get_posts(), wp_insert_post(), etc.).
wp post, wp user, wp option — use wp-cli-ops insteadacorn-routes for request-based flowsacorn-queues (Laravel queues) for durable processinglando wp shell or lando wp eval is faster for explorationConsoleServiceProvider registered (default in Acorn skeleton)lando start) — commands execute inside the containerlando acorn make:command ImportProducts
# Generates app/Console/Commands/ImportProducts.php
Scripts: scripts/create-command.sh
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class ImportProducts extends Command
{
protected $signature = 'import:products
{source : The data source (csv or api)}
{--dry-run : Preview changes without writing}
{--limit=100 : Max records to process}
{--tag=* : Tags to assign (repeatable)}';
protected $description = 'Import products from CSV or external API';
public function handle(): int
{
$source = $this->argument('source');
$this->info("Importing from {$source}");
if ($this->option('dry-run')) { $this->warn('Dry-run mode — no writes.'); }
return self::SUCCESS; // 0 = success, 1 = failure
}
}
{format} Required {--with-meta} Boolean flag
{format=csv} Default value {--chunk=500} Option with default
{format?} Nullable {--F|format=csv} Shortcut
{ids*} Array
$this->info('Done.'); $this->warn('Caution.'); $this->error('Failed!');
$this->table(['ID', 'Title'], $rows);
$this->withProgressBar($items, fn ($item) => process($item));
if (! $this->confirm('Continue?')) { return self::FAILURE; }
Inject services into handle() — the container resolves them automatically:
public function handle(ProductImporter $importer): int
{
$results = $importer->run(source: $this->argument('source'), limit: (int) $this->option('limit'));
$this->info("Imported {$results->created} / skipped {$results->skipped}");
return self::SUCCESS;
}
$this->call('cache:clear'); // With output
$this->callSilent('view:clear'); // Silent
$this->call('import:products', ['source' => 'csv', '--dry-run' => true]); // With args
Commands in app/Console/Commands/ are auto-discovered. For commands elsewhere, register in a ServiceProvider's boot(): $this->commands([ImportProducts::class]).
See references/scheduling.md for scheduling setup and lando acorn schedule:run.
See references/practical-examples.md for import/maintenance/cache-warmup patterns.
See references/troubleshooting.md for command not found, DI failures, schedule issues.
lando acorn list and confirm your custom command appears with the correct signature and description.lando acorn <command-name> and verify it completes without errors, returning exit code 0 (self::SUCCESS).--help to confirm the signature matches expectations, then run with sample inputs.lando acorn list)app/Console/Commands/ directory (the auto-discovery path), or the namespace does not match the file location.app/Console/Commands/YourCommand.php with namespace App\Console\Commands. If the command lives elsewhere, register it explicitly in a service provider's boot() method: $this->commands([YourCommand::class]).handle() method type-hints a service that is not bound in the container, or the service's own dependencies cannot be resolved.register() method. Check that all constructor parameters of the injected service are also resolvable. Use lando acorn tinker and app()->make(YourService::class) to test resolution in isolation.sage:roots-sage-lando for correct binding patterns and singleton registration.sage:acorn-queues for job dispatching patterns.npx claudepluginhub hekivo/superpowers-sageSets up and modifies Roots Sage + Acorn WordPress themes in Lando environments: ACF blocks, Blade components, Vite/Tailwind frontend, service providers, and CPTs.
Develops WordPress themes using Sage framework: create from scratch, set up Blade templates/components, configure Vite/Bud builds, handle template hierarchy, integrate ACF fields, manage assets.
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.