Top 10 Developers prompts at a glance
20 Best AI Prompts for Developers: the top prompts and what you get from each
PromptWhat you get
Refactor Pasted Code for Readability Without Changing Its BehaviorReturns a cleaner version of your code plus a change log that explains each edit, why behavior is preserved, and which edge cases you should test.
Conventional Commit and PR Description from a Diff and TicketProduces a Conventional Commits message and a reviewer-ready PR description covering what changed, why, how to test it, and the risks, based on your diff and ticket.
Split a large pull request into reviewable commitsBreak down overwhelming pull requests into clean, sequential, logically isolated commits. Use it when code reviews stall due to sprawling diffs.
Resolve a Git Merge Conflict and Keep What Both Branches IntendedPaste your conflict markers and get a plain explanation of each side's change, a merged version that keeps both intents, and a test checklist.
Perform Static Call Graph Trace Before Modifying CodeGenerate a clear visual map of function calls and file dependencies to identify exactly where your changes will ripple before you type a single line of code.
Compare Three Feature Architectures Against Module BoundariesGet a scored trade-off matrix comparing three feature architectures by file touchpoints, coupling risks, and rollback cost before running Cursor Composer.
Explain Any Regex Token by Token with Matching and Failing ExamplesGet a token-by-token table explaining your regex, plus strings that match, nearly match and fail, and a clear catastrophic backtracking risk check with a safer rewrite.
Pre-Merge Code Review Checklist Skill (SKILL.md)A save-ready SKILL.md that has your coding agent review a branch before merge: correctness, security, tests and migrations, with findings ranked by severity and no style nitpicks.
Test-First Bug Fix Skill: Reproduce, Fix, Prove (SKILL.md)A SKILL.md that forces your coding agent to reproduce a bug with a failing test before changing code, apply the smallest fix, and prove it with the test suite.
Automated Dead Code Cleanup Plan for Codex RepositoriesGet a systematic plan to identify and safely remove unused exports and dead code from your codebase using characterization tests to prevent regressions.

Code review and debugging

8 prompts

Review a diff for real defects, read a stack trace back to its cause and fix the smallest thing that explains it.

  1. #1Coding

    Refactor Pasted Code for Readability Without Changing Its Behavior

    Returns a cleaner version of your code plus a change log that explains each edit, why behavior is preserved, and which edge cases you should test.

    Preview prompt
    Act as a senior software engineer doing a careful readability refactor. I will paste code right after this prompt. If I have not said the language, runtime version, or whether tests exist, ask me up to 3 short numbered questions in one message and wait for my answers.
    
    Your job: make the code easier to read and maintain while keeping observable behavior identical: same outputs, return values, side effects, raised errors and public names.
    
    Rules:
    1. Do not add features, fix bugs or change public function signatures. If you spot a bug, list it separately and leave it in place.
    2. Every change log entry names the function or line, what changed, why it reads better, and why behavior is unchanged.
    3. Mark any change that could alter results in edge cases (ordering, floating point, empty or null input, exceptions, mutation, performance) as VERIFY, with a concrete test input.
    4. Prefer small, standard moves: clearer local names, extracted helpers, early returns, named constants, removing dead code.
    5. Keep comments only where the reason is not obvious from the code.
    
    Output format:
    1. Refactored code in one complete code block
    2. Change log table: # | Location | Change | Reason | Behavior note
    3. VERIFY list: test input and expected result for each
    4. Possible bugs noticed (not fixed)
    
    End with one line stating your assumptions and what you could not confirm without running the code.
  2. #2Coding

    Split a large pull request into reviewable commits

    Break down overwhelming pull requests into clean, sequential, logically isolated commits. Use it when code reviews stall due to sprawling diffs.

    Preview prompt
    Act as a senior software architect specializing in git hygiene. Analyze the provided list of changed files, commits, or broad code diff to break it down into small, isolated, independently deployable units.
    - Group changes by clean boundaries: infrastructure/config, database migrations, backend logic, frontend UI, and tests.
    - Order the commits logically so dependencies are introduced before their consumers.
    - Ensure each suggested commit maintains a working, buildable state without broken dependencies.
    - Provide exact git commands where relevant to stage or branch the work safely.
    Output format:
    - Commit Strategy Overview: 1-2 sentences on the recommended sequencing.
    - Commit Breakdown: numbered list where each item contains Commit Title, Target Files/Changes, and Why It Stands Alone.
    - Suggested Branch Execution: step-by-step git branching commands to produce these commits cleanly.
    
    Here is the list of changes:
  3. #3Coding

    Resolve a Git Merge Conflict and Keep What Both Branches Intended

    Paste your conflict markers and get a plain explanation of each side's change, a merged version that keeps both intents, and a test checklist.

    Preview prompt
    Act as a senior software engineer who reviews merge conflicts for a team.
    
    I will paste one or more git conflict blocks right after this message. They will include the lines between the conflict markers and, when I can, a few lines of surrounding code and the two branch names. Resolve the conflict.
    
    Rules:
    1. Before proposing anything, describe what each side changed in plain words and quote the exact lines that differ.
    2. State the likely intent behind each change with a confidence level (high, medium, low). Do not guess silently.
    3. The merged version must keep both intents unless they truly contradict. If they do, say which one you kept and why.
    4. Return complete code with no conflict markers left, in the original language, indentation and naming style.
    5. If the snippet is too short to judge (missing imports, callers or tests), name the exact lines or files you need instead of guessing.
    
    Output format:
    1. Side A (ours / HEAD): what changed, likely intent, confidence
    2. Side B (theirs / incoming): what changed, likely intent, confidence
    3. Merged code: one code block
    4. Why this merge: 2-4 bullets
    5. Test before committing: numbered checklist of specific cases, commands or files to check
    
    End with one line naming any assumption you made or the main risk this merge carries.
  4. #4Coding

    Explain Any Regex Token by Token with Matching and Failing Examples

    Get a token-by-token table explaining your regex, plus strings that match, nearly match and fail, and a clear catastrophic backtracking risk check with a safer rewrite.

    Preview prompt
    You are a senior developer who reviews regular expressions in code reviews and explains them to teammates.
    
    I will paste a regex right after this message. If I don't say which regex flavor it is (JavaScript, Python, PCRE, Java, .NET, Go) or what it is meant to match, ask me those 2 questions in one numbered message and wait for my answers.
    
    Then explain the pattern. Rules:
    1. Split it into the smallest meaningful tokens, in order. Groups get one row for the whole group, then a row for each token inside it.
    2. Describe each token in plain English, with no regex jargon left unexplained.
    3. Give 3 strings that match, 3 that nearly match but fail, and 3 that clearly fail. For every near miss, name the exact token that rejects it.
    4. Check for catastrophic backtracking: nested quantifiers, overlapping alternatives, or optional separators inside repeated groups. Rate the risk Low, Medium or High and show a short input that triggers it.
    5. If the risk is Medium or High, or the pattern has a bug, give a corrected version and say what changed.
    
    Output format:
    - Purpose (one sentence)
    - Token table with columns: Token, Meaning, Example it matches
    - Matches, Near misses (with rejecting token), Fails
    - Backtracking risk (rating, trigger input, reason)
    - Suggested rewrite (if needed)
    
    End with one line on any flavor-specific behavior or assumptions you made.
  5. #5CodingClaude Code

    Test-First Bug Fix Skill: Reproduce, Fix, Prove (SKILL.md)

    A SKILL.md that forces your coding agent to reproduce a bug with a failing test before changing code, apply the smallest fix, and prove it with the test suite.

    Preview prompt
    ---
    name: test-first-bugfix
    description: Fixes bugs by first writing a failing test that reproduces them, then making the smallest change that passes. Use when the user reports a bug, a wrong result, a crash or a failing behaviour and asks for a fix.
    ---
    
    # Test-first bug fix
    
    ## Steps
    1. Restate the bug as: given this input or state, expected X, got Y. If you cannot, ask for the missing detail.
    2. Find the code path. Read it; do not edit yet.
    3. Write a test that reproduces the bug in the project's existing test framework and style. Run it and confirm it fails for the right reason (the bug, not a typo or missing import). Show the failure output.
    4. Find the root cause. Explain it in two or three sentences.
    5. Make the smallest change that fixes the cause. No refactors and no unrelated cleanups.
    6. Run the new test (it must pass), then the related test files, then the full suite if it is quick.
    7. Look for the same bug pattern elsewhere with a search, and list matches without fixing them.
    
    ## Output format
    - Bug statement
    - Failing test output (before)
    - Root cause
    - Diff of the fix
    - Test results (after)
    - Similar code found elsewhere
    
    ## Stop and ask
    - The bug cannot be reproduced in a test after two attempts. Report what you tried.
    - The fix needs a change to a public interface, a database migration or a new dependency.
    - Existing tests fail before your change; report them rather than fixing them silently.
    
    ## Risks
    Fixing the symptom. If the fix is a special case for the test input, keep looking for the cause.
  6. #6Coding

    Trace an execution path from entry to database

    Map out the complete end-to-end execution path of a single user request across layers in an unfamiliar codebase.

    Preview prompt
    Act as a senior software architect explaining an execution path through a legacy codebase.
    - Trace the flow of the requested user action sequentially from routing entry point down to data persistence.
    - List every method, class, or service boundary crossed, highlighting where data transforms or validations occur.
    - Call out side effects such as asynchronous events, cache writes, or external API calls.
    - Identify implicit assumptions, potential failure points, or hidden dependencies.
    Output format:
    1. Execution Chain (numbered step-by-step list showing file, method, and action)
    2. Data Mutations & Validations (bulleted summary of how the payload changes)
    3. External Side Effects & Persistence (database queries, message queues, network calls)
    4. Architectural Risk Flags (fragile coupling or undocumented assumptions)
    Here are the relevant source files and entry point:
  7. Audit a Pull Request Diff for Breaking API Changes

    Separates wire-breaking schema, status code, and migration changes from safe additions, returning a consumer impact table and deprecation plan.

    Preview prompt
    Act as a staff API platform engineer reviewing a pull request for backward compatibility. I will paste a git diff and any related schema or migration files right after this prompt. Audit the diff to separate wire-breaking changes from safe additive changes.
    
    Rules:
    1. Classify every API change as Wire-Breaking, Behavioral-Breaking, or Safe Additive, citing the exact file path and symbol name from the diff.
    2. Check for renamed or removed fields, tightened validation, changed HTTP status codes, altered default values, and database migrations that drop or lock columns before old code stops reading them.
    3. Never assume a change is safe because a test passed; flag missing contract tests or undocumented version bumps.
    4. For every breaking item, provide a zero-downtime alternative using expand-and-contract or versioned routing.
    
    Output format:
    - **Verdict:** Ship, Ship with Deprecation, or Block, with a two-sentence rationale.
    - **Consumer Impact Table:** Markdown table with columns: File and Symbol, Change Type, Severity, Affected Consumers, Required Fix.
    - **Safe Additive Changes:** Bullet list of non-breaking additions verified in the diff.
    - **Deprecation and Rollout Plan:** Numbered steps to deploy safely without breaking existing clients.
    
    End with one short section listing assumptions made and any missing context (such as unknown external consumers or missing schema files) needed to finalize the review.
  8. #8Coding

    Write a guided walkthrough for a complex pull request

    Structure complex multi-file pull requests into a clear, numbered narrative review order for your teammates.

    Preview prompt
    Act as a software engineer preparing a guided review walkthrough for a pull request.
    - Analyze the pasted git diff or changed files summary.
    - Group related file changes into logical review phases instead of alphabetical file order.
    - Provide a recommended reading sequence starting with core data structures or business logic.
    - Highlight breaking changes, subtle edge cases, or non-obvious design choices reviewers must inspect closely.
    Output format:
    1. PR Overview (2-3 sentences summarising the intent)
    2. Suggested Review Order (numbered phases with file lists and what to look for)
    3. Critical Decision Points (bullets explaining non-obvious trade-offs)
    4. Risk & Test Focus Areas (specific scenarios for the reviewer to verify)
    Here is the diff or list of changes:

Working with coding agents

5 prompts

Prompts and instruction files for Claude Code, Codex, Cursor and Copilot that keep the agent grounded in your repository.

  1. Perform Static Call Graph Trace Before Modifying Code

    Generate a clear visual map of function calls and file dependencies to identify exactly where your changes will ripple before you type a single line of code.

    Preview prompt
    You are a senior software architect. Before we modify any code in this repository, perform a static call-graph trace for the specific function or class I will identify. Follow these rules: 1. Trace the execution path across all affected files. 2. For every step, list the file path, the function name, and the specific variables being passed. 3. Visualize the flow using a text-based hierarchy. 4. Identify potential side effects or breaking changes in downstream dependencies. 5. Do not suggest code changes yet; only provide the structural analysis. Please start by asking me: 1. What is the entry point function or class method? 2. What is the specific goal of the modification you are planning? This analysis is not a substitute for running a debugger or unit tests; always verify changes in a local dev environment. Wait for my answers before proceeding.
  2. Compare Three Feature Architectures Against Module Boundaries

    Get a scored trade-off matrix comparing three feature architectures by file touchpoints, coupling risks, and rollback cost before running Cursor Composer.

    Preview prompt
    Act as a principal software architect reviewing a codebase before a multi-file implementation in Cursor Composer.
    
    I will paste my feature goal, relevant directory tree, and any existing module boundary rules right after this prompt. If the module boundaries or test coverage are unclear, ask up to three numbered questions first and wait for my answers.
    
    Otherwise, compare three distinct architecture options for building this feature against my existing boundaries. Follow these rules:
    - Option A must minimize file touchpoints, Option B must prioritize strict module isolation, and Option C must optimize for future extensibility.
    - Score each option from 1 to 5 on file touchpoints, coupling risk, testability, and rollback cost, where 5 is best.
    - Name exact file paths or directories from my tree for every touchpoint and boundary crossing.
    - Flag any circular dependency, shared mutable state, or schema lock-in risk before writing code.
    - Recommend one option and list the exact pre-flight checks to run before opening Cursor Composer.
    
    Output format:
    1. Summary Table: Markdown table with columns Option, File Touchpoints, Coupling Risk, Testability, Rollback Cost, and Total Score.
    2. Option Breakdowns: Three short sections covering exact files touched, boundary impact, and rollback steps.
    3. Recommended Plan: Chosen option, rationale in three bullets, and a numbered Cursor Composer execution order.
    
    End with one line stating your key assumptions and any missing codebase context that could change the recommendation.
  3. Pre-Merge Code Review Checklist Skill (SKILL.md)

    A save-ready SKILL.md that has your coding agent review a branch before merge: correctness, security, tests and migrations, with findings ranked by severity and no style nitpicks.

    Preview prompt
    ---
    name: pre-merge-review
    description: Reviews the current branch against its base before merge, ranking findings by severity. Use when the user asks for a review, asks whether a branch is ready to merge, or says "check my changes".
    ---
    
    # Pre-merge review
    
    ## Steps
    1. Find the base branch (main or master unless told otherwise) and run `git diff base...HEAD`. Read the full files around each change, not just the hunks.
    2. Run the project's test, typecheck and lint commands (look in package.json, Makefile, pyproject.toml or the CI config). Record pass or fail.
    3. Check, in this order:
       - Correctness: wrong conditions, off-by-one errors, unhandled null or empty values, broken error paths, race conditions.
       - Security: unvalidated input, injection, missing auth checks, secrets in code or logs, unsafe deserialisation.
       - Data: migrations that lock tables or lose data, missing backfills, irreversible changes.
       - Tests: changed behaviour without a test, tests that cannot fail.
       - Performance: queries in loops, unbounded lists, work on the hot path.
    4. For each finding, describe the concrete input or state that triggers the failure. Drop any finding you cannot make concrete.
    5. Skip formatting and naming issues that a linter or formatter already covers.
    
    ## Output format
    Verdict: ready, ready after fixes, or not ready.
    Table: Severity (blocking, should fix, nit), File:line, Problem, Failure scenario, Suggested fix.
    Then: check results, and questions for the author.
    
    ## Stop and ask
    - No base branch can be found.
    - Checks need credentials or services that are not available; report this instead of skipping silently.
    
    ## Risks
    False confidence from a clean review. State what was not checked, such as untested paths or missing integration tests.
  4. #12AI Coding AgentsClaude Code

    Verify the Coding Agent's 'Done' Claim Against the Diff and Test Output

    Checks each claim in a coding agent's final summary against the actual diff and test runs, marks it verified, unverified or contradicted with evidence, and lists unmentioned changes, skipped tests and stubs.

    Preview prompt
    You are a skeptical code reviewer. A coding agent says its task is done. Check every claim in its summary against what actually changed and ran.
    
    Agent's final summary: {paste the agent summary}
    
    If you have repository access (Claude Code, Codex, Cursor or Copilot agent), run git status and git diff against the base branch, and rerun the test command the agent says it ran. Otherwise use the diff and test output I paste after the summary. The summary itself is never evidence.
    
    Rules:
    - Split the summary into single claims. Mark each Verified, Unverified or Contradicted and cite the diff hunk (file and line) or log line.
    - "Tests pass" counts only if you see output for the full suite, not one file.
    - Look for what the summary leaves out: changed files it does not mention; skipped, deleted or weakened tests; to-do comments, stubs, hard-coded values or mocked-out logic; edits to config, CI, lockfiles or secrets.
    
    Output format:
    1. Table: claim | status | evidence
    2. Changes the summary does not mention
    3. Tests claimed vs actually run, with results
    4. Risks: stubs, to-do comments, config or secret edits
    5. Verdict: merge, fix or redo, with the exact instruction to give the agent next
    
    Say what you could not check.
  5. Create Selective Pre-Commit Hooks for Claude Code

    This prompt generates a bash script that triggers specific tests and typechecks only for packages modified in your current git branch.

    Preview prompt
    Act as a Senior DevOps Engineer. Write a bash script for a pre-commit hook that uses git diff to identify changed directories and runs specific validation commands only for those paths. Follow these rules: 1. Use git diff --name-only to detect modified files. 2. Map file paths to specific test commands like npm run test or tsc. 3. Exit with status 1 if any command fails. 4. Include a fallback to run a full suite if too many files change. Output format: Provide the bash script block followed by instructions on how to install it in the .git/hooks directory. This is for technical automation and does not replace manual code review. Ask these 3 questions first: 1. What is your primary programming language or build tool? 2. What are the specific test and lint commands for your project? 3. What is the maximum number of files that should trigger a full suite run instead of a selective one?

Refactors, tests and docs

7 prompts

Change structure without changing behaviour, cover it with tests and leave documentation the next person can use.

  1. Conventional Commit and PR Description from a Diff and Ticket

    Produces a Conventional Commits message and a reviewer-ready PR description covering what changed, why, how to test it, and the risks, based on your diff and ticket.

    Preview prompt
    You are a senior engineer writing a pull request for a reviewer who has not seen this code. Here is the diff: {paste your diff here} Here is the ticket or context: {paste ticket or context here} If the base branch, the test setup, or the ticket intent is missing and it would change the answer, ask me one or two short questions first. Rules: describe only what the diff actually changes, and list anything the ticket asks for that the diff does not do. Keep facts and assumptions separate. Write test steps as runnable commands or numbered manual steps, each with an expected result. Tie every risk to a file or behavior in the diff (migrations, API contract, performance, config, rollback) and write 'none found' instead of inventing one. Output exactly this: 1) Commit message in Conventional Commits format: type(scope): subject under 72 characters, a body wrapped at 72 characters that explains why, and a footer with BREAKING CHANGE or issue references if relevant. 2) PR description with these sections: Summary, Why, What changed (bullets by file or area), How to test, Risks and rollback, Assumptions and open questions. 3) A short checklist of missing tests or follow-ups a reviewer should expect.
  2. Automated Dead Code Cleanup Plan for Codex Repositories

    Get a systematic plan to identify and safely remove unused exports and dead code from your codebase using characterization tests to prevent regressions.

    Preview prompt
    You are a Senior Software Engineer specializing in codebase maintenance and refactoring. Your task is to design a safe, automated cleanup plan for removing unused exports and dead code from a repository. Follow these rules: 1. Create an audit table mapping every exported symbol to its usage count across the directory. 2. Mandate the creation of a characterization test covering the current behavior of any module before modifications occur. 3. Define a three-phase removal process: Audit, Test, and Prune. 4. Prioritize internal-only utilities before public-facing APIs. 5. Include a specific step for verifying side effects in modules with no direct references. Output format: 1. Executive Summary of the cleanup strategy. 2. Audit Table: Symbol Name, File Path, Usage Count, Status. 3. Characterization Test Checklist. 4. Phased Execution Roadmap. This is not legal or professional advice; consult with your lead architect before executing destructive deletions in production codebases. Ask me these 3 questions first: 1. What is the primary programming language of the codebase? 2. Are there any known reflection-based calls or dynamic imports that static analysis might miss? 3. Do you currently have a CI pipeline that runs integration tests?
  3. Sync Test Factories and Fixtures with Database Migrations

    This prompt updates your test factories, JSON fixtures, and contract tests to match new database schema changes, ensuring your test suite remains consistent with production code.

    Preview prompt
    Act as a Senior Backend Engineer. Your task is to update the test suite to reflect recent database schema changes. Please ask the following 3 questions first and wait for my response: 1. Paste the SQL migration file content. 2. List the file paths of the factories, JSON fixtures, and contract test files that need updating. 3. Describe the specific changes in the migration, such as added columns, renamed fields, or dropped constraints. Once I provide these, perform the following: 1. Update the factory definitions to include the new fields with appropriate default values. 2. Add or update the mock JSON fixtures to match the new schema structure. 3. Update the contract tests to validate the new fields or handle removed ones. 4. Write only the modified code blocks with the file path header above each block. Output format: For each file, provide a header with the file path followed by a code block containing the updated logic. Ensure all changes maintain existing data types and relationships. This is not professional software engineering advice; verify all changes in a staging environment before deployment.
  4. #17Coding

    Port a Function or Module to Another Language With Tests Proving Same Behavior

    Lists the source code's behaviors and edge cases, writes tests in the target language first, ports the code idiomatically, and gives a table of library mappings and semantics that differ.

    Preview prompt
    You are a senior engineer fluent in both languages. Port this code to the target language and show that it behaves the same.
    
    Source code: {paste the source code}
    Target language, version and allowed libraries: {target language version and libraries}
    
    Steps:
    1. List the observable behaviors of the source, including edge cases: empty and null input, integer overflow and division, floating point, string encoding and Unicode, sort stability, time zones, errors, async and concurrency.
    2. Write tests in the target language from those behaviors first. Mark any expected value you worked out by reasoning rather than by running the source.
    3. Port idiomatically for the target language, not line by line, and map each library call to its equivalent.
    4. Point out any behavior you could not match exactly and how callers would notice.
    
    Rules: no dependencies beyond the ones I allowed; keep public names and signatures unless target conventions require a change, and say so.
    
    Output format:
    1. Behavior list
    2. Tests in one code block
    3. Ported code in one code block
    4. Table: source construct | target equivalent | semantic difference
    5. Mismatches and risks
    
    If you cannot run code, tell me which tests to run first.
  5. Cursor Characterization-Test-First Refactor of a Legacy Module

    Has Cursor lock in current behavior with characterization tests before restructuring a legacy module in small steps, so you can decide whether the refactor preserved behavior and is safe to merge.

    Preview prompt
    Role: You are a refactoring specialist working in Cursor Agent mode on the module {module_path} in {repo_name}.
    
    Context: The module is hard to change safely. The decision to support is whether the refactor preserved behavior and is ready to merge. Use @Files for {module_path} and its tests, @Codebase to find all consumers, and the terminal for real test output. Do not claim behavior is preserved without passing tests.
    
    Task: Add characterization tests that capture current behavior, then refactor toward {refactor_goal} in small, verified steps.
    
    Inputs:
    - Module path: {module_path}
    - Refactor goal (for example split responsibilities, remove duplication, add types): {refactor_goal}
    - Public API that must not change: {public_api}
    - Test command: {test_command}
    - Lint or type-check command: {lint_command}
    - Constraints (no new dependencies, style rules, max diff size): {constraints}
    If an input is missing, list it under Missing information and state assumptions separately.
    
    Workflow:
    1. Read the module and list its responsibilities, side effects, and external dependencies.
    2. Use @Codebase to list consumers and the existing tests that cover the module.
    3. Identify coverage gaps. Write characterization tests that assert current behavior, including known quirks, and mark suspected bugs with a comment instead of fixing them.
    4. Run {test_command}. All new tests must pass against the unchanged code.
    5. Plan 3-6 refactor steps, each independently committable and no larger than one concern.
    6. Execute one step at a time. After each step run {test_command} and {lint_command}, and stop if anything fails.
    7. Review the final diff against {public_api} to confirm no signature or behavior changes.
    
    Constraints:
    - Do not change behavior and structure in the same step.
    - Do not edit consumers unless a step requires it, and list any such edits.
    - Follow existing style and rules in .cursor/rules.
    - Ask before deleting files or exports.
    
    Output format:
    1. Assumptions and Missing information
    2. Module analysis table: Responsibility | Side effects | Dependencies
    3. Test gap table: Behavior | Covered before | Test added
    4. Refactor steps table: Step | Change | Verification result
    5. Final diff summary: File | Change | Reason
    6. Suspected bugs found but not fixed
    7. Risks and next actions
    
    Acceptance criteria:
    - Characterization tests pass before and after the refactor without being weakened.
    - Public API in {public_api} is unchanged.
    - Each step passes tests and lint independently.
    - Suspected bugs are listed, not silently fixed.
    
    Quality checks:
    - Do tests cover error paths, boundary values, and side effects?
    - Is each step small enough to review in a few minutes?
    - Are all consumers confirmed unaffected via search or tests?
    - Is anything unverified clearly labeled?
  6. #19Coding

    Document module behavior from its test suite

    Extract clear business rules, accepted inputs, and edge cases for undocumented modules solely from their test suites.

    Preview prompt
    Act as a software engineer reverse-engineering an undocumented module from its unit and integration tests.
    - Analyze the pasted test code to extract explicit behaviors, edge cases, and constraints.
    - Ignore test-only harness details like mock setups or spy assertions unless they reveal a dependency interface.
    - Translate test assertions into plain-language business rules and functional specifications.
    - Flag undocumented assumptions or gaps where tests fail to assert expected edge cases.
    Output format:
    1. Module Purpose (1-2 sentences on what problem this module solves)
    2. Expected Inputs & Preconditions (bulleted list)
    3. Verified Business Rules & Invariants (numbered list of proven behaviors)
    4. Error Handling & Edge Cases (how failures are handled)
    5. Untested Blind Spots (missing tests or unverified boundaries)
    Here is the test suite code:
  7. #20Coding

    Plan an incremental refactor for legacy code

    Break down monolith or fragile legacy modules into safe, testable milestones using branch-by-abstraction patterns.

    Preview prompt
    Act as a software modernization architect. Review the provided fragile code module and devise a phased, non-breaking refactoring roadmap using the branch-by-abstraction pattern.
    
    Rules:
    - Maintain full backward compatibility for current callers during all intermediate releases.
    - Isolate side effects, tight database coupling, and global state first.
    - Provide specific characterization tests to lock down current behavior before changes start.
    - Break execution into 3-4 distinct pull requests that can be merged independently to production without risk.
    
    Output format:
    - Current Architecture Weaknesses (anti-patterns and regression hotspots)
    - Characterization Test Strategy (exact inputs and state to assert)
    - Phased Refactoring Roadmap (PR 1 through PR 4 with objectives, design pattern used, and rollback plan)
    - Verification Checklist
    
    Here is the module to refactor:

About this list

The chat prompts suit ChatGPT, Claude or Gemini when you paste code yourself. The agent prompts are written for Claude Code, Codex, Cursor and GitHub Copilot: they tell the agent to read the repository first, never invent flags or config keys, run the checks the project already has and leave committing and pushing to you.

The list mixes the jobs that fill a normal week rather than one tool's features, so a review prompt for Cursor can sit next to a debugging prompt for ChatGPT. Prompts built only for planning, testing or AGENTS.md files have their own lists, and those go deeper on each job.

Which AI coding tool should a developer use?

It depends on where the work happens. A chat assistant is quick for explaining code or drafting a function you paste back. An agent such as Claude Code, Codex, Cursor or Copilot can read the repository, run tests and edit files, which suits reviews, refactors and multi-file fixes. Each prompt lists the tools it was written for.

Will a coding agent change my code without asking?

The agent prompts here ask it to inspect the repository and explain a plan before editing, to run the existing tests and to stop short of committing, pushing or deploying. Agents still make mistakes, so review every diff, keep work on a branch and turn on the approval settings your tool offers.

Can I paste private code into these prompts?

Only if your company allows it. Check your employer's policy and the data settings of the tool you use before pasting source code, secrets or customer data. Strip API keys and personal data first, and prefer an agent that runs against your local repository over pasting large files into a public chat.

More lists and categories

All categories