PromptSleeve
Back to library
Claude
Coding
SaaS & Tech

Refactor legacy code safely

by Kai T. · 2026-06-11 · 3,068 copies

The prompt
Here is a legacy module:

{CODE}

Refactor it without changing behavior. Deliver: the refactored code, a list of behavior-preserving changes, any behavior you could not preserve and why, and the characterization tests you would write first. Prefer small named functions over comments.
#refactor
#legacy
#tests

Ratings & results

No ratings yet

Sign in to rate this prompt and tell others whether it worked for you.

More for SaaS & Tech

ChatGPT (GPT-5)Kai T.2,401 copies

Bug triage from a stack trace

Stack trace: {TRACE} Context: {STACK / FRAMEWORK}. Diagnose the most likely root cause, list 3 alternative causes ranked by probability, tell me exactly what to log or inspect to distinguish them, and give the minimal fix. No speculation presented as fact.

Coding
SaaS & Tech
PerplexityDigizenk3,320 copies

Programmatic SEO page brief

You are an SEO strategist. Target keyword: {KEYWORD}. Search intent: {INTENT}. Produce a page brief with: recommended H1, URL slug, meta title (<60 chars), meta description (<155 chars), H2/H3 outline covering entity coverage, 8 questions to answer, 5 internal link targets, and a schema.org type recommendation. No fluff, output as markdown.

SEO content
SaaS & Tech

Frequently asked questions

Everything you need to know about using and contributing to PromptSleeve.

Follow