"Refactor this Express.js app from callbacks to async/await, handling all error cases"
Claude restructured the entire app across 4 files, correctly converting 12 callback patterns to async/await. It added proper try/catch blocks, created a centralized error handler middleware, and preserved all existing behavior including edge cases around database connection timeouts. Zero hallucinated methods.
GPT-4o converted the main route handlers correctly but missed 2 callback patterns in the middleware chain. It introduced a non-existent Express method `res.sendError()` and didn't handle the database connection timeout edge case. Required a follow-up prompt to fix.
Why Tie wins: Claude handled the full multi-file refactor without hallucinating any APIs and caught edge cases GPT-4o missed.
"Write a Python script that processes a 500MB CSV, deduplicates by email, and outputs a cleaned file with progress reporting"
Claude used pandas with chunked reading (chunksize=50000) to handle memory efficiently. It tracked seen emails with a set, added a tqdm progress bar, and included proper error handling for malformed rows. The script ran correctly on first attempt.
GPT-4o also used pandas chunked reading with a similar approach. It added a clean progress bar using tqdm and handled the deduplication correctly. Slightly more concise code. Also ran correctly on first attempt.
Why Tie wins: Both produced working solutions, but GPT-4o's was more concise and ran marginally faster. A tie on correctness, slight edge to GPT-4o on code economy.
"Debug this React component that causes an infinite re-render loop (provided 200-line component with useEffect dependency issue)"
Claude identified the root cause in 3 seconds: a missing useMemo wrapper around an object literal passed as a useEffect dependency. It explained the JavaScript reference equality issue, showed the fix, and warned about a secondary issue where the same pattern appeared in a sibling component.
GPT-4o correctly identified the useEffect dependency issue and provided the useMemo fix. It didn't catch the same pattern in the sibling component. Explanation was clear but less thorough on the underlying JavaScript mechanics.
Why Tie wins: Claude caught the secondary bug and provided a deeper explanation of why object reference equality causes the issue.
"Create a TypeScript generic type that extracts all nested keys from a deeply nested object type, with dot-notation paths"
Claude produced a correct recursive conditional type using template literal types and mapped types. Handled arrays, optional properties, and circular references with a depth limiter. Included 5 test cases demonstrating edge cases.
GPT-4o produced a working recursive type that handled basic cases. Struggled with arrays inside nested objects — the type incorrectly expanded array indices as keys. Missing depth limiter meant it could cause TypeScript compiler hangs on circular types.
Why Tie wins: Claude's type was production-ready with proper edge case handling. GPT-4o's had a subtle array handling bug and no circular reference protection.
"Write a SQL query to find the top 10 customers by lifetime value, excluding refunded orders, with a 90-day rolling window"
Claude wrote a correct CTE-based query using window functions with ROWS BETWEEN for the rolling window. Properly excluded refunds by joining against refund records rather than filtering by status, which is more reliable.
GPT-4o also produced a correct query using CTEs and window functions. Used a slightly different approach with a subquery for refund exclusion. Both queries would return identical results.
Why Tie wins: Effectively a tie. Both produced correct, well-structured SQL. GPT-4o's subquery approach was marginally more readable for junior developers.
Compare Claude Opus 4.6 and GPT-4o for coding with your own prompts — free.
Try NailedIt.ai →