Data exports sound simple but always have edge cases around large datasets, memory limits, and encoding. Let Claude write the streaming version from the start — before you discover the memory issue at 3am.
"Write a Laravel data export for the orders table:
- Export filtered results (date range, status, customer) as CSV and Excel
- Stream large exports using LazyCollection to avoid memory exhaustion
- Queue exports over 50k rows and email a download link when ready
- Include relationships: customer name, line items, shipping address
- Handle currency formatting, timezones, and UTF-8 encoding correctly
Add Pest tests that assert the correct headers and row count."
The streaming part is where most hand-written exports fall over. Claude uses LazyCollection with chunk() to keep memory flat regardless of result size:
return response()->streamDownload(function () use ($filters) {
$handle = fopen('php://output', 'w');
fputcsv($handle, ['ID', 'Customer', 'Total', 'Status', 'Date']);
Order::with(['customer', 'items'])
->filter($filters)
->lazy()
->each(fn ($order) => fputcsv($handle, $order->toCsvRow()));
fclose($handle);
}, 'orders-export.csv');
For the Excel variant, specify Maatwebsite Excel or PhpSpreadsheet — Claude generates the correct export class with proper column widths, date formatting, and a header row style.
Export features that crash on large datasets aren't features — let Claude write the streaming version first.
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.