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.
Log in to leave a comment.
Set up Claude Code as an automated reviewer in your CI pipeline — on every pull request, it reads the diff, checks for bugs, security issues, missing tests, and convention violations, then posts its findings as a PR comment. Your human reviewers get a head start because the obvious issues are already flagged before they look.
Before deploying, tell Claude to read your project — migrations, environment variables, queue workers, scheduled tasks, caching, third-party integrations — and generate a deployment checklist that's specific to your app. Not a generic "did you run migrations?" list, but one that knows YOUR infrastructure and catches the things YOUR deploy can break.
Instead of writing a README from memory or copying a template, tell Claude to read your project and generate one that's actually accurate — real setup instructions from your config, real architecture from your directory structure, real API examples from your routes, and real prerequisites from your dependency files.