The test-write-fix loop is where most developers lose hours. Claude Code closes that loop. Today: write tests for untested code, debug errors by pasting them directly into the terminal, and use Claude Code as your first-pass security reviewer.
The simplest test generation command you'll ever use:
claude "write tests for src/utils/pricing.ts"
Claude Code will:
Be more specific when you have specific requirements:
# Target coverage
claude "write tests for src/utils/pricing.ts.
Focus especially on: negative quantities, zero price,
discount codes that have expired, and concurrent
requests hitting rate limits"
# Integration tests
claude "write integration tests for the POST /api/orders
endpoint. Mock the payment processor but use a real
in-memory database. Test success, insufficient funds,
and invalid cart states"
# Test an untested module
claude "src/auth/rbac.ts has zero test coverage.
Write comprehensive tests. The permission system has
3 levels: admin, editor, viewer. Test all boundary
conditions."
The fastest debugging workflow with Claude Code: copy the full error output, paste it in, let Claude Code find and fix it.
claude "I'm getting this error:
TypeError: Cannot read properties of undefined
(reading 'userId')
at validateRequest (src/middleware/auth.ts:23:15)
at Layer.handle [as handle_request]
at next (/node_modules/express/lib/router/layer.js:95:5)
at Route.dispatch
The error happens when hitting POST /api/orders.
Fix it."
Claude Code will read src/middleware/auth.ts at line 23, understand the call stack, trace the issue back to its source, and propose a fix. It'll also check if the same bug exists elsewhere.
# TypeScript type errors
claude "npx tsc --noEmit is throwing 12 errors.
Fix all of them: [paste tsc output]"
# Failed build
claude "npm run build is failing:
[paste build output]
Fix the build without changing any functionality"
# Test failures after refactor
claude "after the refactor, 6 tests are failing:
[paste test output]
Fix the tests. Do not change the implementation
unless the implementation is actually wrong."
Before merging a PR, run a Claude Code security review. This doesn't replace a human security audit, but it catches the obvious things that shouldn't get through.
# Review a specific file
claude "review src/api/users.ts for security
vulnerabilities. Look for: SQL injection, unvalidated
input, missing auth checks, exposed sensitive data
in responses, and rate limiting issues"
# Review a git diff (new code from a PR)
git diff main..feature-branch | claude "review this
diff for security issues. Focus on authentication
bypass, injection vulnerabilities, and any data
that should be sanitized before use"
# Review API endpoints
claude "review all POST endpoints in src/routes/
for missing input validation. List any endpoint
that accepts user input without validating it"
claude "review src/api/checkout.ts as if you're a
senior engineer doing a thorough PR review.
Look for:
1. Security vulnerabilities
2. Race conditions or concurrency issues
3. Error cases that aren't handled
4. Performance problems (N+1 queries, etc.)
5. Places where the code doesn't match what the
comments say it does
6. Anything that would fail under high load
Be specific. Quote the problematic lines."
Take a real script or module from your project that you know has issues — or pick one that's untested. You're going to let Claude Code find and fix everything.
claude "write tests for [filename]". Note which functions it can't easily test — those are architectural insights."these tests are failing — fix the implementation". Review every change before accepting.Find a module in your codebase with zero or near-zero test coverage. Give it to Claude Code: write tests, run them, fix any issues found, and end with the module fully covered. Time how long this takes vs. how long it would have taken you manually. That time delta is what Claude Code is worth to your workflow.