From symfony
Genere une commande console Symfony avec arguments, options et interaction
How this skill is triggered — by the user, by Claude, or both
Slash command
/symfony:consolesonnetThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Genere une commande console Symfony complete avec arguments, options, interaction utilisateur et bonnes pratiques.
Genere une commande console Symfony complete avec arguments, options, interaction utilisateur et bonnes pratiques.
src/Command/{CommandName}.phpIMPORTANT : Execute ce workflow etape par etape :
Question: "Quel est le nom de la commande ? (ex: app:import-users)"
Header: "Commande"
app:import-users -> ImportUsersCommand:, prefixer par app:Question: "Quelle est la description de la commande ?"
Header: "Description"
Question: "Quels arguments et options ? Format: arg:username:required,opt:verbose:v:bool,opt:format:f:string=json (laisser vide si aucun)"
Header: "Parametres"
arg:name:required|optional - Argument positionnelopt:name:shortcut:type=default - Option avec shortcut et valeur par defautQuestion: "Quelles options activer ?"
Header: "Options"
Options:
- "ProgressBar" : "Barre de progression pour les traitements longs"
- "Table output" : "Affichage tabulaire des resultats"
- "Lock" : "Empecher l'execution simultanee (LockableTrait)"
- "Schedulable" : "Attribut AsScheduledTask pour l'execution planifiee"
composer.json avec Readautoload.psr-4App par defautsrc/Command/{CommandName}.php avec Write<?php
declare(strict_types=1);
namespace {namespace}\Command;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
#[AsCommand(
name: '{commandName}',
description: '{description}',
)]
final class {CommandName} extends Command
{
public function __construct(
// Injecter les services necessaires
) {
parent::__construct();
}
protected function configure(): void
{
$this
// ->addArgument('name', InputArgument::REQUIRED, 'Description')
// ->addOption('format', 'f', InputOption::VALUE_REQUIRED, 'Output format', 'json')
;
}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$io = new SymfonyStyle($input, $output);
// Logique de la commande
$io->success('Commande executee avec succes.');
return Command::SUCCESS;
}
}
Regles de generation :
final#[AsCommand] avec name et descriptionparent::__construct() appele dans le constructeurSymfonyStyle pour les I/O$io->createProgressBar($count) dans execute()$io->table($headers, $rows) dans execute()use LockableTrait; et verifier $this->lock() au debut de execute()#[AsScheduledTask('* * * * *')] apres #[AsCommand]Command::SUCCESS, Command::FAILURE ou Command::INVALIDAffiche :
Commande {commandName} generee avec succes
Fichiers crees :
- src/Command/{CommandName}.php
Utilisation :
php bin/console {commandName}
php bin/console {commandName} --help
Prochaines etapes :
- Implementer la logique dans execute()
- Injecter les services necessaires dans le constructeur
- Ajouter des tests : tests/Command/{CommandName}Test.php
final, attribut #[AsCommand]#[AsCommand] (Symfony 6.1+) plutot que $defaultNameSymfonyStyle a OutputInterface directementInputArgument::REQUIRED ou OPTIONAL explicitementInputOption::VALUE_NONEnpx claudepluginhub atournayre/claude-personas --plugin symfonyReference for all 38 Symfony components covering APIs, configuration, best practices, and common pitfalls for PHP 8.3+ and Symfony 7.x.
Provides a structured daily workflow for Symfony projects: refine architecture, plan safe changes, execute with checkpoints, and summarize tradeoffs. Good for medium/complex Symfony changes.
Provides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.