Explain the Big O time and space complexity of this code step by step, as if teaching a junior developer. Point out the most expensive part and how input size affects it. Code: [paste code]
ChatGPT · Coding & Development
Code generation, debugging and documentation
83 prompts
Write a script in [language] that generates [number] realistic fake records for [entity, e.g. customers with orders] matching this schema: [schema]. Use a faker library, keep relationships consistent, and output as [SQL/JSON/CSV].
Generate realistic test data
Creates realistic fake data for development and tests.
Explain this stack trace in plain English. Identify where the error actually originates in my code (not library code), the likely cause, and how to fix it. Ask for the relevant code if needed. Stack trace: [paste]
Set up a monorepo for [apps and packages, e.g. web app, API and shared UI library] using [tool, e.g. pnpm workspaces / Turborepo / Nx]. Show the folder structure, config files, shared TypeScript config, build and test scripts, and CI caching.
Set up error monitoring for a [stack] app in production. Explain what to capture (errors, context, releases), how to avoid logging sensitive data, alerting rules, and show the integration code for [tool or a generic logger].
Error monitoring setup
Catches and reports production errors before users complain.
Implement simple feature flags in [stack] without a paid service. Support on/off, percentage rollout and per-user overrides, store flags in [storage], and show how to use a flag in code and remove it cleanly later.
Add a background job queue to my [framework] app for tasks like [tasks]. Recommend a queue library, show job definitions, retries with backoff, failure handling, scheduling, and how to run workers in production.
Background job queue
Moves slow tasks like emails and reports out of web requests.
Add internationalisation to my [framework] app for [languages]. Show the library setup, translation file structure, how to handle plurals, dates and currencies, language switching, SEO for localised pages, and right-to-left support if needed.
This code is too clever and hard to read. Rewrite it for clarity: descriptive names, small functions, comments only where needed, and the same behaviour. Explain what the original was doing. Code: [paste code]
Write a Playwright script in [language] that [task, e.g. logs into a test site, fills a form and downloads a report]. Use robust selectors, waits instead of sleeps, screenshots on failure, and credentials from environment variables.
Create a backup and restore plan for a [database] used by [app]. Include backup frequency, retention, off-site storage, encryption, an automated backup script, a restore test procedure, and monitoring for failed backups.
Write a React custom hook called [useSomething] that [purpose, e.g. fetches data with caching / debounces input / tracks window size]. Use TypeScript, handle cleanup and errors, and include usage examples and tests.