agentleFS
wachterjohanneswachterjohannes/symfony-skills/skills/make-command/SKILL.md

make-command

Skill4 starsChanged 2 months agoMITView on GitHub

Use when creating a console command in a Symfony project.

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Write output through SymfonyStyle ($io->success(), $io->error(), $io->table()) rather than echo, so the command behaves under --quiet and …

    line 37
  2. Very specific:

    Keep the logic in a service and let __invoke() orchestrate.

    line 39

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Console command

symfony console make:command app:send-reminders --argument recipient:string --option dry-run:bool

Install the bundle first if it is missing: symfony composer require --dev symfony/maker-bundle.

Declare every argument and option on the command line. --argument name[?][:type] and --option name[:type] repeat once per parameter. A ? marks an argument optional. Types are string, bool, int, float, array, or the name of a backed enum. The default type is string for arguments and bool for options. If you pass neither flag, a non-interactive run generates sample parameters ($arg, $enable) that you would have to delete, so declare the real ones up front.

What you get, and what to keep

Since maker-bundle 1.68 the command is invokable. The generated class carries #[AsCommand] and a single __invoke() method. Its parameters are the command's interface: a SymfonyStyle instance, then one parameter per argument and option, each declared with an #[Argument] or #[Option] attribute. There is no base class, no configure(), no execute(). Do not add them back.

What remains yours:

  • Inject dependencies through the constructor.
  • Return Command::SUCCESS or Command::FAILURE. Never a bare integer, never nothing.
  • Write output through SymfonyStyle ($io->success(), $io->error(), $io->table()) rather than echo, so the command behaves under --quiet and in a pipe.
  • Keep the logic in a service and let __invoke() orchestrate. A command is an entry point, the same as a controller.

A command run from cron that must not overlap takes symfony/lock: inject LockFactory, or use LockableTrait when the command only locks itself. A flag file or a database column checked at start is not a lock.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.