$ recombobulate _
home / tips / let-claude-write-your-symfony-console-commands
0

Let Claude Write Your Symfony Console Commands

bagwaa @bagwaa · Mar 26, 2026 · Workflows
let-claude-write-your-symfony-console-commands

Symfony Console commands follow a specific pattern — #[AsCommand], configure(), execute(), argument definitions, styled output. Claude knows the entire API and can scaffold a production-ready command from a description.

Create a Symfony Console command that:
- Is named app:sync-products
- Accepts an optional --dry-run flag
- Fetches products from an external HTTP API
- Upserts them into a Doctrine repository
- Shows a ProgressBar and a summary Table at the end
- Logs errors without halting the entire run

Claude will generate a fully wired command class using #[AsCommand], Symfony's ProgressBar, Table, and SymfonyStyle output helpers, and a clean separation between fetching, processing, and persisting. It handles constructor injection for services like HttpClientInterface and LoggerInterface correctly.

#[AsCommand(name: 'app:sync-products', description: 'Sync products from the external API')]
class SyncProductsCommand extends Command
{
    public function __construct(
        private readonly HttpClientInterface $http,
        private readonly ProductRepository $products,
        private readonly LoggerInterface $logger,
    ) {
        parent::__construct();
    }
    // ...
}

Follow up with "add a --batch-size option" or "write a PHPUnit test that mocks the HTTP client" to flesh out the command further.

Symfony commands have a lot of boilerplate — Claude handles all of it so you can focus on the actual logic.

~/recombobulate $ tip --comments --count=0

Log in to leave a comment.

~/recombobulate $ tip --related --limit=3
0
Scan Pending Changes for Security Issues with /security-review

The /security-review command scans your uncommitted changes for injection vectors, auth gaps, hardcoded secrets, and other common vulnerabilities.

bagwaa @bagwaa · 1 hour ago
0
Run Setup Scripts on Every Session with the SessionStart Hook

The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.

bagwaa @bagwaa · 1 hour ago
0
Write Property-Based Tests with fast-check and Claude

Ask Claude to write property-based tests for your functions using fast-check — it identifies the mathematical invariants in your code and generates tests that cover inputs you'd never enumerate by hand.

bagwaa @bagwaa · 2 hours ago