
Data Export with Claude Code: Streaming CSV and Excel Without Memory Issues
"Download all users as CSV" sounds simple until you have 100,000 rows and the process runs out of memory. Claude Code generates streaming export implementations — cursor-based pagination, CSV injection prevention, and background job handling. CLAUDE.md for Data Export Standards ## Data Export Rules ### Volume thresholds - Under 10,000 rows: synchronous response OK - Over 100,000 rows: background job required (BullMQ) - Never load all rows into memory — use cursor-based streaming ### CSV specification - Encoding: UTF-8 with BOM (prevents Excel garbling) - Line endings: CRLF (Windows default) - Quoting: double-quote all fields - Headers: always include, localized labels OK - Dates: YYYY-MM-DD HH:mm:ss (explicit timezone) ### Security - CSV injection prevention: prefix =, +, -, @ values with single quote - Export endpoints require authentication - Download URLs expire in 15 minutes (signed URLs) ### Performance - Batch size: 1,000 rows per DB query - Large files: gzip before delivery - St
Continue reading on Dev.to
Opens in a new tab


