Prompt library
Coding & Dev Textapp/auto-code

Refactor with invariants

Improve maintainability while explicitly preserving behavior and public contracts.

Copy-ready prompt
Refactor [CODE OR MODULE] for clarity and testability. Before editing, state the behavioral invariants and public contracts that must remain unchanged. Reduce nesting and duplication only where it makes the control flow clearer. Keep the diff scoped, preserve compatibility, and add characterization tests for any behavior that is not already covered. Return the patch plan, implementation, and verification results.

Related prompts

Textapp/auto-code
Fix failing CI

Turn a failing check into a reproducible, tested repair instead of a speculative patch.

#agent#ci#debugging#regression