Back to Library
code testing unit-tests legacy-code refactoring
The Legacy Test Bootstrap
P
PromptAura Team Oct 8, 2026
0 Likes
prompt-content.md
#SITUATION
I inherited a module with zero tests. I want to change it, but without tests I have no way to know what breaks. Full coverage is not the goal — I need a safety net around the behavior that matters, fast.
#PURPOSE
Generate a runnable starter test suite for the module below, prioritized by risk: the tests that catch the most likely regressions come first, so I can stop at any point and still have gained something.
#EXPECTED OUTPUT
## 1. Behavior Inventory
List the observable behaviors of the module (what it does, not how). 5-12 items. Mark each: CRITICAL (breaks users if wrong) / IMPORTANT (breaks features) / MINOR.
## 2. Test Suite
A complete test file, runnable as-is:
- Test framework: {{framework}} (e.g., pytest, Vitest, Jest, JUnit, Go testing)
- Ordered by the priority above, highest first
- Each test named for the behavior it pins ('returns empty list when input empty', not 'test_3')
- Arrange-Act-Assert structure, one behavior per test
- Explicit mocks/stubs for external calls (network, DB, clock, filesystem) — no live calls
- Edge cases: empty input, boundary values, error paths where the module defines them
## 3. Untestable Boundary
Anything in the module that cannot be unit tested as written (hidden state, direct I/O, global mutation). For each: what it is, and the smallest refactor that would make it testable. Do not perform the refactor — just specify it.
## 4. First Refactor Target
Given these tests exist, the one safe refactor I should do first and why.
#CONTEXT
- Language and version: {{language}}
- Test framework and runner command: {{framework}}
- Why I am touching this module: {{change_planned}}
#STYLE
Ship-shape code, no pseudocode, no TODO comments left in the suite. Comments only where a test exists to pin down surprising behavior.
#MODULE
```{{language}}
{{paste_module_code}}
``` Actions
Opening in Studio allows you to fill variables, use AI optimization, and save to your personal library.