Claude Code prompts for code quality and tech debt

Tests, refactors, type safety, dependency upgrades and dead code removal. The classic overnight job: long, careful, and easy to review in the morning as a pull request.

Show:

20 prompts

  1. Raise test coverage on critical paths

    Find the code paths that handle money, auth, data writes and the main user flow. Measure current test coverage for them. Write meaningful tests (behaviour, edge cases, failures, not just lines) until each critical module is well covered. Run the full suite, fix flaky tests you find, and report coverage before and after.

    Repo
  2. End-to-end tests for the main flows

    Write Playwright end-to-end tests for our 5 most important user flows (sign-up, core action, upgrade, settings, and one more you think matters). Use stable selectors, seed data, and run them headless. Add a script and CI step to run them. Report anything that failed as a bug list.

    Repo Browser
  3. Dead code removal

    Find unused files, exports, components, routes, dependencies, feature flags that are always on, and commented-out code. Verify each is truly unused (search for dynamic references too). Remove them in small commits, run the build and tests after each, and list what was removed.

    Repo
  4. Dependency upgrades

    List outdated dependencies with their current and latest versions and changelogs for breaking changes. Upgrade the safe ones (patch and minor) first, run the build and tests, then tackle major upgrades one at a time with the migration steps from their docs. Stop and report any that need a decision.

    Repo Web
  5. Strict TypeScript

    Turn on stricter TypeScript settings one at a time (strict, noUncheckedIndexedAccess, noImplicitOverride). Fix the resulting errors properly rather than with any or ts-ignore. Commit after each setting with the build passing. Report anything you had to leave and why.

    Repo
  6. Refactor the worst file

    Find the file with the most complexity, length and churn in git history. Refactor it into smaller, well-named units without changing behaviour. Add tests first that pin current behaviour, then refactor, then run them again. Explain the new structure in the PR description.

    Repo
  7. Fix every lint warning

    Run the linter and type checker. Fix every warning and error properly, grouping fixes by rule in separate commits. Where a rule is wrong for this codebase, propose disabling it with a reason instead of sprinkling ignores.

    Repo
  8. Error handling review

    Find every try/catch, promise without a catch, empty catch block, and API call without error handling. Make errors surface properly: log with context, show users a useful message, and never swallow failures silently. Add tests for the main failure paths.

    Repo
  9. TODO and FIXME sweep

    Find every TODO, FIXME, HACK and XXX comment. For each, decide: fix it now if it is small and safe, turn it into a GitHub issue description if it is real work, or delete it if it is stale. Do the small fixes, and save the issue drafts to docs/todo-issues.md.

    Repo
  10. Database query review

    Find every database query in the codebase. Look for N+1 queries, missing indexes on filtered or joined columns, unbounded selects, queries in loops and missing pagination. Fix what is safe, write migrations for new indexes (do not run them on production), and report the rest.

    Repo
  11. API contract tests

    Document every API endpoint with its inputs, outputs and errors (OpenAPI if possible). Add request validation where it is missing and contract tests that check each endpoint's response shape. Generate typed clients if the stack supports it.

    Repo
  12. Consistent naming and structure

    Review the folder structure and naming conventions. Find inconsistencies (mixed casing, duplicate helpers, components in the wrong place, utils grab-bags). Propose a clean structure, then make the moves in small commits with imports updated and the build passing.

    Repo
  13. Remove duplicated logic

    Find duplicated or near-duplicated code (copy-pasted functions, components with small differences, repeated validation). Consolidate them into shared, tested helpers where it makes the code simpler, not more abstract. List each consolidation.

    Repo
  14. Make the build faster

    Measure build, test and dev-server start times. Find what is slow (huge dependencies, unnecessary transpilation, missing caching, slow tests) and fix it. Report the before and after timings.

    Repo
  15. CI pipeline setup

    Set up or improve CI for this repo: install with caching, lint, type check, unit tests, build, and end-to-end tests on pull requests, with clear job names. Keep it fast. Add a status badge to the README.

    Repo
  16. Write a CLAUDE.md

    Write or improve the CLAUDE.md for this repo: how to install, run, test and build; the architecture in a few paragraphs; conventions and gotchas; where key things live; and what not to touch. Keep it short and accurate, verified by actually running the commands.

    Repo
  17. Fix flaky tests

    Run the test suite 10 times and record which tests fail intermittently. For each flaky test, find the root cause (timing, shared state, order dependence, network, randomness) and fix it properly rather than adding retries. Report each cause and fix.

    Repo
  18. Migrate off a deprecated API

    Search the codebase for deprecated APIs, libraries and patterns (check deprecation warnings in build output and library changelogs). Pick the most important one and migrate every usage, with tests passing. List the remaining deprecations.

    Repo Web
  19. Logging and observability

    Review logging across the app. Add structured logs with request IDs at key points (requests, background jobs, external calls, errors), remove noisy or sensitive logs, and make sure errors are reported to the error tracker if one is configured. Document how to debug a failed request.

    Repo
  20. Fix open GitHub issues

    List open bug issues for this repo. Pick the 5 that look smallest and clearest. For each, reproduce it, write a failing test, fix it, and prepare a commit message that references the issue. Stop and summarise any that turned out to be bigger than expected.

    Repo

How to run these while you sleep

  1. Open your project and start a fresh branch or git worktree, so the whole night is one diff you can review or delete.
  2. Add your product context above and keep overnight mode on. Claude will log its assumptions instead of waiting for answers.
  3. Paste one prompt into Claude Code, or save a few to a queue/ folder and loop over them headless.
  4. In the morning, read the files it wrote and the diff. Merge what is good and send what needs sending yourself.

Want it off your laptop? Claude Code on the web runs each session in a cloud sandbox, so you can start a few before bed and close the lid.

Queue a night of prompts

git switch -c overnight/$(date +%F)
mkdir -p logs
for f in queue/*.md; do
  claude -p "$(cat "$f")" \
    --permission-mode acceptEdits \
    --allowedTools "WebSearch" "WebFetch" "Bash(npm run *)" \
    > "logs/$(basename "$f" .md).log"
done

Only allow the tools a task needs. Browser prompts also need a browser MCP server such as Playwright; find one in the MCP directory.

More spare compute prompts

Link magnets20

Free tools, calculators, templates and data pages that rank for long-tail searches and earn links on their own. Run these overnight and wake up to shippable pages.

SEO & content20

Keyword research, content briefs, technical SEO audits and article drafts you can leave running overnight. Each prompt saves its output to a file so nothing gets lost.

Backlinks & PR20

Find link opportunities, draft pitches and build lists of podcasts, newsletters and journalists. These prompts do the slow research so you only do the sending.

Directories & launches15

Get listed everywhere your buyers look: startup directories, app stores, marketplaces, launch sites and review platforms. Claude prepares every listing so submitting takes minutes.

Finding customers20

Lead lists, buying signals and the places your next customers are already asking for help. Claude does the digging; you decide who to contact.

Outreach & sales15

Cold emails, follow-ups, sales pages and objection handling written from what your product actually does. Claude drafts; you review and send.

Social content20

A month of posts, threads, carousels and replies drafted from your product, changelog and lessons learned. Wake up to a content queue instead of a blank page.

Video & visuals15

Demo videos, short-form scripts, animated explainers and screenshots generated with code. Use Remotion, Playwright and ffmpeg to render while you sleep.

Simulated user research20

Synthetic personas, simulated usability tests and interview prep built from your real product. Use them to find obvious problems before you spend time with real users, not instead of them.

Competitor research20

Teardowns, pricing tracking, feature matrices and screenshots of competitor user flows. Leave a browser running overnight and come back to a full picture of the market.

Landing pages & conversion20

Rewrite copy, audit the sign-up funnel, design A/B tests and build new landing pages. These prompts work directly in your codebase so the output is ready to review as a pull request.

Email & lifecycle15

Welcome sequences, onboarding emails, newsletters and re-engagement campaigns written from your actual product, plus the templates to send them.

Product & UX20

Polish passes, onboarding fixes, feature specs and prototypes. Good for overnight runs because each one ends in a branch or a document you can review over coffee.

Security & performance20

Security reviews, secrets scans, load tests, bundle diets and backup checks. The work everyone puts off, done while your machine would otherwise sit idle.

Docs, support & ops20

Documentation, help centre articles, support macros, metrics, finance tidy-ups and the admin that piles up. Hand it to Claude when you have compute to spare.

Make Claude better at these jobs with skills, MCP servers and mods, or turn a prompt you run often into a skill with the skill generator.