Edge-Case Test Suite for One Function in Your Existing Test Framework
Writes tests for a single function that cover normal inputs, boundaries, bad input and error paths, in the test framework your project already uses.
Prompts that put tests at the centre of Claude Code's work: edge-case suites for one function, a failing test before every bug fix, and characterization tests that pin behaviour before a refactor.
12 prompts · Updated
| Prompt | What you get | Use |
|---|---|---|
| Edge-Case Test Suite for One Function in Your Existing Test Framework | Writes tests for a single function that cover normal inputs, boundaries, bad input and error paths, in the test framework your project already uses. | 1 blank |
| Root-Cause Bug Fix With a Failing Test and a Minimal Patch | Get a reproduced bug, a regression test that fails before the fix and passes after it, the smallest patch and a log of the commands Claude Code actually ran. | 2 blanks |
| Paste a Bug Report, Get a Test-First Fix in Any AI Chat | Get a failing test that reproduces your pasted bug, the root cause, the smallest fix as a diff and its risks, in any chat assistant with no repository access needed. | 1 blank |
| Characterization Tests Before a Refactor | Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely. | 1 blank |
| 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. | 1 blank |
| Safe Refactor With Characterization Tests and Small Commits | Get a refactor split into small commits, each with its test result, after characterization tests pin what the code does today, plus a list of suspected bugs left unfixed. | 2 blanks |
| Coding Agent Task Brief with Guardrails, Test Plan, and Rollback Steps | Creates a scoped brief for an AI coding agent that limits file changes, defines tests, and includes a rollback plan and review checklist. | 8 blanks |
| Typed Phase Handoff Contracts and Validator for Multi-Agent Pipelines | Has Claude Code define schema-based handoff contracts between agent phases, generate a validator, and add contract tests. Supports the decision of which phase boundaries need strict contracts versus lightweight checks. | 7 blanks |
| Claude Code Feature Implementation Plan and Build from a Ticket with Repo Convention Discovery | Has Claude Code investigate how similar features are built in the repository, produce an implementation plan with acceptance tests, then implement it in verified increments. Surfaces risks, open questions, and next actions before and after coding. | 8 blanks |
| 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. | 2 blanks |
Writes tests for a single function that cover normal inputs, boundaries, bad input and error paths, in the test framework your project already uses.
Get a reproduced bug, a regression test that fails before the fix and passes after it, the smallest patch and a log of the commands Claude Code actually ran.
Get a failing test that reproduces your pasted bug, the root cause, the smallest fix as a diff and its risks, in any chat assistant with no repository access needed.
Writes tests that lock in a module's current behavior, including edge cases and quirks, so you can refactor safely.
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.
Get a refactor split into small commits, each with its test result, after characterization tests pin what the code does today, plus a list of suspected bugs left unfixed.
Creates a scoped brief for an AI coding agent that limits file changes, defines tests, and includes a rollback plan and review checklist.
Has Claude Code define schema-based handoff contracts between agent phases, generate a validator, and add contract tests. Supports the decision of which phase boundaries need strict contracts versus lightweight checks.
Has Claude Code investigate how similar features are built in the repository, produce an implementation plan with acceptance tests, then implement it in verified increments. Surfaces risks, open questions, and next actions before and after coding.
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.
Produces a PostToolUse hook entry for settings.json, the script it calls and a concrete procedure to test that the check runs after file edits.
Finds the most likely cause of an error from the message and the relevant code, ranks other possible causes, and gives the smallest fix plus a way to prove it worked.
FAQ
Each prompt tells the agent to prove its work with command output rather than describe it. The bug fix prompts reproduce the bug first, make the smallest change and show the test going from red to green. The refactor prompts lock in current behaviour, then change the code in small commits you can revert.
Others check the agent itself, comparing its summary with the real diff and test run, or add a hook that runs your tests after every edit. All of them run in Claude Code, and many also list Cursor, Codex or Copilot. Fill in the blanks, such as the repository path or the test command, before you paste.
The prompts ask it to find the framework and the test command the project already uses, and to follow the style of the tests that are there. If your repository has more than one, name the one you want in the blank for the test command, so the agent doesn't add a new tool.
A test that fails for the reported reason proves the agent has found the real bug. When the same test passes after the fix, you have evidence instead of a claim, and the test stays in the suite so the bug can't return unnoticed. The prompts ask for both runs in the output.
They record what code does today, including odd behaviour, before anyone changes it. They are not a statement that the behaviour is right. During a refactor they act as a safety net: if one starts failing, the refactor changed something a caller may rely on, and you decide whether that change was intended.