Claude Prompts
twenty prompt templates for Claude. fill in the brackets, paste, send.
Stop the Spiral
A debugging prompt that demands one concrete command to test your most likely cause, instead of a list of speculations.
I have [problem description].
Here's what I know:
- [fact 1]
- [fact 2]
- [fact 3]
Don't speculate or list possibilities. Give me ONE command to run that will confirm or rule out the most likely cause. I'll give you the output and we'll go from there.
Context Dump
Paste your environment once — OS, shell, tools, paths, constraints — and get answers that match your actual setup.
Here's my setup (reference only — don't repeat it back):
- OS: [e.g. Ubuntu 24.04 on WSL2]
- Shell: [e.g. zsh, configs at ~/tools/zsh/]
- Key tools: [e.g. Docker, nvm, uv]
- Relevant paths: [e.g. ~/scripts/, ~/docker/]
- Constraints: [e.g. slow internet, blocked CDNs]
Now: [your actual question]
Teach Me the Why
Get the explanation before the fix: a prompt for understanding the concept so you can solve the next one yourself.
[Describe what you're trying to do or what went wrong]
Explain what's happening and WHY before giving me the fix. I want to understand the underlying concept so I can solve similar problems myself. Use my actual setup/code in the examples, not generic ones.
Review My Work
Critical review of code, docs, or config — specific issues, why they matter, and the concrete fix. No compliments.
Review this [code/doc/config/script] critically.
[paste or attach your work]
Be specific and direct. For each issue:
1. What's wrong or could be better
2. Why it matters (security, performance, maintainability, etc.)
3. The concrete fix
Skip compliments. I want the issues I'm not seeing.
Build Step by Step
Build something complex in testable stages: minimal working version first, then the next piece only after you confirm.
I want to build [describe the end goal].
Don't give me the whole thing at once. Walk me through it in stages:
1. Start with the minimal working version
2. I'll test it, confirm it works
3. Then we add the next piece
Start with step 1 now.
Refactor This
Refactor working-but-ugly code for readability first, keeping behavior identical and flagging any interface change.
Here's my working code. It works, but it's ugly.
[paste your code]
Refactor it. Priorities in this order:
1. Readability — someone else should understand it in 30 seconds
2. Maintainability — easy to change later without breaking things
3. Performance — only if there's a real bottleneck, not micro-optimizations
Keep the same behavior. If you change any interface or signature, call it out explicitly so I don't miss it.
Write Tests
Real tests for a function or module: happy path, edge cases, failure modes — runnable now, no mocks unless necessary.
Write tests for this [function/module/component]:
[paste your code]
Stack: [e.g. Python + pytest, TypeScript + vitest, Go stdlib]
Cover:
- The happy path (expected inputs → expected outputs)
- Edge cases (empty input, nulls, boundaries, huge values)
- Failure modes (what should throw/error and what shouldn't)
No mocks unless absolutely necessary. If you mock something, explain why a real call won't work here. Give me tests I can run right now without setup.
Explain This Codebase
A teammate-style walkthrough of an unfamiliar codebase — the mental model, entry point, and gotchas, not line-by-line narration.
I just landed in an unfamiliar codebase. Here's what I'm looking at:
[paste code, file tree, or attach files]
Walk me through it like an experienced teammate onboarding me:
1. What does this thing do — one sentence, no jargon
2. The main entry point and how data flows through it
3. The key files/functions and what each one is responsible for
4. Any patterns, conventions, or "gotchas" a newcomer would trip on
Don't just narrate the code line by line. Give me the mental model so I can navigate it myself.
Pick the Right Approach
Tradeoffs for each option you’re weighing, when each is the right call, and an unhedged recommendation given your constraints.
I need to decide between approaches for [describe what you're building/solving].
Options I'm considering:
- [Option A]
- [Option B]
- [Option C, if any]
Constraints:
- [e.g. must run on low-memory VPS, team of 1, needs to ship this week]
For each option give me: the tradeoff in one line, when it's the right call, and when it'll bite me later. Then tell me which one YOU'D pick given my constraints and why. Don't hedge — commit to an answer.
Write the Docs
Documentation for a project, API, or tool written to save future-you a 2am debugging session — quickstart, params, pitfalls.
Write documentation for this [project/API/tool/function]:
[paste code or describe what it does]
Audience: [e.g. developers integrating the API, new team members, end users]
Include:
- What it does and why someone would use it (skip if obvious)
- Quickstart: the fastest path to "it works" with a real example
- All parameters/options with types and defaults
- Common pitfalls or things that aren't obvious from the signature
Write it like you're saving future-me from a 2am debugging session. No filler paragraphs.
Convert or Migrate
Port code between languages or frameworks idiomatically, preserving behavior and flagging every difference that matters.
Convert this from [source language/framework] to [target language/framework]:
[paste your code]
Rules:
- Use idiomatic patterns in the target — don't just transliterate syntax
- If something doesn't have a 1:1 equivalent, explain the difference and what you chose instead
- Preserve all behavior including error handling and edge cases
- Flag any dependency or runtime differences I need to handle (e.g. async model, type system, package manager)
Give me something I can drop in and run, not a starting point.
Automate This
Turn a repetitive manual task into a script — idempotent, logged, and failing loudly with a useful message.
I keep doing this manually and I want a script for it:
[describe the repetitive task step by step, exactly as you do it by hand]
Target: [e.g. bash script, Python CLI, Node script, Makefile]
Runs on: [e.g. Ubuntu server, macOS, CI pipeline]
Requirements:
- Should be safe to run multiple times (idempotent) — don't destroy things if I accidentally run it twice
- Log what it's doing so I can see progress
- Fail loudly with a useful error message, don't silently continue
Start with the simplest version that covers 90% of cases. I'll tell you where it needs to be smarter.
Security Check
A security audit of code, config, or infrastructure: severity-rated findings with the fix, no generic padding.
Audit this for security issues:
[paste code, config, Dockerfile, infra setup, etc.]
Context: [e.g. user-facing web app, internal API, runs as root, handles payments]
Check for:
- Injection vulnerabilities (SQL, command, path traversal)
- Auth/authz gaps (missing checks, privilege escalation)
- Secrets or credentials in code/config
- Overly permissive settings (CORS, file permissions, network exposure)
- Dependency risks
For each finding: severity (critical/high/medium/low), what an attacker could do with it, and the fix. Don't pad with generic advice — only flag things actually present in what I gave you.
Make It Faster
Speed up slow code with targeted fixes in order of impact — no guessing, and a measurement command first if needed.
This is too slow. Help me speed it up.
[paste code or describe the bottleneck]
What I'm seeing: [e.g. "takes 12s to load 500 rows", "API response time spiked to 3s", "build takes 4 minutes"]
Acceptable target: [e.g. "under 1s", "50% faster", "fast enough to not annoy users"]
Don't guess — point to the specific lines or patterns causing the issue and explain WHY they're slow. Then give me fixes in order of biggest impact first. If profiling or measuring would help, tell me the exact command to run before we start optimizing blind.
Design the API
A complete API design: endpoints, real JSON shapes, a consistent error format, and the scaling gotchas you’re missing.
I need to design an API for [describe the feature or system].
It should support these operations:
- [e.g. create/read/update/delete a resource]
- [e.g. search with filters]
- [e.g. bulk operations]
Consumers: [e.g. our React frontend, mobile app, third-party integrations]
Auth: [e.g. JWT, API key, session-based]
Give me:
1. The endpoint structure (routes, methods, status codes)
2. Request/response shapes for each endpoint — real JSON, not descriptions
3. Error format (consistent across all endpoints)
4. Anything I'm forgetting that will hurt me at scale (pagination, rate limiting, versioning, etc.)
Design it like it's going to be around for 3 years and other people will build on it.
Rubber Duck
Think a problem through out loud: questions you’re not asking yourself, assumptions to poke, before any solution.
I'm stuck and need to think this through out loud. Don't solve it yet — help me think.
Here's my situation:
[describe the problem, what you've tried, where you're stuck]
Ask me the questions I'm not asking myself. Poke holes in my assumptions. If I'm overcomplicating it, say so. If I'm missing something obvious, point at it.
Only after we've talked it through — then help me build the solution.
Project Scaffold
A new project from scratch — folder structure, ready-to-use configs, a hello world that proves the stack, zero boilerplate.
Set up a new project for me from scratch.
What I'm building: [describe the project]
Stack: [e.g. Next.js + TypeScript + Tailwind + Prisma + PostgreSQL]
Infra: [e.g. Docker, runs on a VPS, deployed via GitHub Actions]
Give me:
1. The folder structure with a one-line explanation for each directory
2. The config files I need (package.json, tsconfig, docker-compose, .env.example, etc.) — complete and ready to use
3. A minimal "hello world" that proves the stack is wired up correctly
4. The commands to go from zero to running locally
No boilerplate comments in the code. No TODO placeholders. Everything you give me should work when I paste it.
Write the Commit
A commit message or PR description that explains the why, stays under 72 characters per line, and respects the reviewer.
Write a commit message (or PR description) for this change:
[paste your diff, or describe what you changed and why]
Format: [e.g. conventional commits, plain English, our team uses "type: subject" style]
Rules:
- Subject line under 72 characters, imperative mood
- Body explains WHY, not WHAT (the diff already shows what)
- If it's a PR: include a summary, what to test, and anything the reviewer should pay extra attention to
- If it's a breaking change, say so clearly at the top
Write it like a teammate who respects the reviewer's time.
Deploy Checklist
A pre-deploy sanity check: what to verify before pushing, what could break, a rollback plan, and post-deploy verification.
I'm about to deploy this to [production/staging]. Sanity check me.
What's being deployed: [describe the change or paste the diff]
Stack: [e.g. Node API on Docker, PostgreSQL, nginx reverse proxy]
Current setup: [e.g. single VPS, no CI/CD yet, manual deploys via SSH]
Give me:
1. A pre-deploy checklist — things to verify BEFORE I push the button
2. Anything in my change that could break existing functionality or data
3. A rollback plan — exact steps to undo if it goes wrong
4. Post-deploy verification — how to confirm it's actually working in prod
Assume I'm deploying at midnight and nobody else is awake to help. Be paranoid.
Fix This Error
Decode a real error message in plain language, find the cause, give the exact fix — and ask, not guess, when unsure.
I'm getting this error and I can't figure it out:
```
[paste the full error message / stack trace — don't summarize it]
```
What I was doing when it happened: [e.g. running `npm build`, hitting the /api/users endpoint, starting the Docker container]
What I already tried: [list anything you've attempted, even if it didn't work]
What changed recently: [e.g. updated a package, changed a config, nothing — it just started]
Read the actual error message. Tell me what it means in plain language, what's causing it, and the exact fix. If you need more info to be sure, ask — don't guess.