/redaxo-core:redaxo-console-commandsfrom redaxo-core
Builds CLI/diagnostic/maintenance commands for REDAXO addons using Symfony Console (rex_console_command). Covers class location, naming, package.yml registration, and SymfonyStyle helpers.
Ships in redaxo-core. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
For any CLI / diagnostic / maintenance task in an addon, build a console command — not a standalone PHP bootstrap script. REDAXO uses Symfony Console under the hood; the bootstrap (autoloading, addon init, package order) only works correctly through bin/console.
// bin/_my_check.php — WRONG
require __DIR__ . '/../src/core/boot.php'; // missing path provider
$client = rex_elasticsearch_client::factory(); // wrong API
Standalone scripts like this either fail to boot, or end up using APIs that don't exist. Even if you get them working, they're invisible in bin/console list, can't run as cronjobs, and aren't reviewable as part of the addon.
src/addons/<addon>/lib/ (REDAXO's autoloader scans the whole folder); lib/command/<name>.php is a common conventionpackage.yml. A common convention is rex_<addon>_command_<name> with : becoming _ (e.g. command ndcg:detail → class rex_elasticsearchtools_command_ndcg_detail); the cronjob addon itself uses rex_command_cronjob_runrex_console_command (REDAXO's wrapper around Symfony\Component\Console\Command\Command)package.yml under console_commands: — without this REDAXO won't expose the command. Autoloading alone is not enough.<?php
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Usage:
* bin/console addon:topic:action --option=value
*/
final class rex_addon_command_topic_action extends rex_console_command
{
protected function configure(): void
{
$this
->setDescription('One-line description shown in `bin/console list`')
->addOption('alias', 'a', InputOption::VALUE_REQUIRED, 'Index alias', 'default_alias')
->addOption('query', null, InputOption::VALUE_REQUIRED, 'Search query', 'test');
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = $this->getStyle($input, $output); // SymfonyStyle helper
$io->title('My Command');
$alias = (string) $input->getOption('alias');
// SQL access works as usual
$sql = rex_sql::factory();
$rows = $sql->getArray(
'SELECT COUNT(*) AS c FROM ' . rex::getTable('table') . ' WHERE state = 7'
);
$io->table(['Header'], [['row1'], ['row2']]);
$io->success('Done');
return 0; // 0 = success, non-zero = failure
}
}
package.ymlconsole_commands:
addon:topic:action: rex_addon_command_topic_action
addon:topic:other: rex_addon_command_topic_other
The command name uses : as namespace separator. By convention, the class name uses _ instead.
$io)$this->getStyle($input, $output) returns a SymfonyStyle instance:
| Method | Use for |
|---|---|
$io->title($t) | Big heading |
$io->section($t) | Subheading |
$io->writeln($msg) | Plain output |
$io->note($msg) | Informational box |
$io->success($msg) | Green success box |
$io->error($msg) | Red error box |
$io->warning($msg) | Yellow warning box |
$io->table($headers, $rows) | Formatted table |
$io->progressStart($total) / progressAdvance() / progressFinish() | Progress bar |
$io->ask($q) / confirm($q) / choice($q, $opts) | Interactive prompts |
bin/console list | grep <addon>
If the command isn't there, the package.yml entry is missing or the addon isn't installed and active.
$items = MyTable::query()->where('status', 1)->find();
foreach ($items as $item) {
$io->writeln($item->getValue('name'));
}
In package.yml of the cronjob addon's host configuration (or via the cronjob backend UI), schedule a system command:
bin/console addon:topic:action --alias=production
console_commands: entry in package.yml – the file is autoloaded but never registered, so bin/console list doesn't show it.package.yml doesn't match the class declared in lib/ (typo, missing namespace) – rex_console_command_loader::get() fails on new $class() as soon as the command is loaded; bin/console list loads all commands, so it breaks too.execute() – Symfony Console treats anything other than 0 (or the Command::SUCCESS/FAILURE constants on newer versions) as a failure.echo instead of $output->writeln() / $io->writeln() – Symfony's --quiet flag has no effect.setDescription() – bin/console list shows no help text, future-you won't remember what it does.rex::getUser() – there's no logged-in user in CLI context. It returns null. For permission checks, gate on --user flags or environment.What SKILL.md sets; muted values are Claude Code's defaults
11 skills in this plugin
/redaxo-addon-developmentBuilding and maintaining custom REDAXO addons – package.yml, boot.php, install/update/uninstall, lang files, fragments, backend pages, the assets pipeline (and the reinstall-to-sync rule), cache-busting on asset URLs, vendor dependencies, and the common-pitfalls checklist. Use when the user creates a new addon, edits package.yml, sets up backend pages, ships frontend assets from an addon, integrates Composer dependencies, or asks how to package functionality as a reusable addon./redaxo-api-functionsBuilding HTTP/AJAX endpoints in REDAXO using rex_api_function – the lib/ class location, naming convention, $published flag for frontend access, JSON responses, CORS for cross-domain widgets, and the rex-api-call URL. Use when the user adds an AJAX/HTTP endpoint to a custom addon, builds a JSON API for a frontend widget, or asks how to expose data via /index.php?rex-api-call=. Distinct from the FriendsOfRedaxo/api addon (covered by the redaxo-api-addon plugin)./redaxo-architectureREDAXO project structure, request lifecycle, and core classes. Use when the user works on a REDAXO codebase, mentions REDAXO directory layout, asks about rex_addon/rex_config/rex_path/rex_url/rex_clang/rex_request, or when files under redaxo/src/, redaxo/data/, or redaxo/cache/ appear in the conversation.npx claudepluginhub friendsofredaxo/claude-marketplace --plugin redaxo-coreOther plugins' skills for the same job