Skip to content
PromptPressPromptPress
  • Home
  • News
    • Hero – No Sidebar
    • Hero – Right Sidebar
    • Hero – Left Sidebar
    • Classic – Right Sidebar
    • Classic – No Sidebar
    • Classic – Left Sidebar
    • Gallery Post
    • Audio Post
    • Video Post
  • Pages
    • About Us
    • Contact Us
    • Our Team
    • FAQs
    • Prompt Library
    • Full With
    • Error 404
  • Contact Us
  • Prompt Library
  • Download
Prompts

Refactor without changing behavior

A step-by-step refactor as a diff, with a one-line reason per change and the tests that prove nothing broke.

Prompt

80 words, 3 variables

Refactor the code below. Main goal: {{goal}} How far to go: {{scope}} Constraints: {{constraints}} The behavior must stay exactly the same: same inputs, same outputs, same side effects, same errors. 1. List the problems you see, in priority order, one line each. 2. Show the refactor as a unified diff. 3. Explain each change in one sentence. 4. List the tests that should pass before and after to prove nothing changed, and any edge case where behavior could accidentally differ.

Fill & copy

Also includes: Code quality checklist (Checklist)


	

Properties

Output
Code
Status
Untested
Visibility
Public
Tools
ChatGPT Claude Cursor GitHub Copilot
Project
Dev Toolkit
Use case
Refactoring
Language
TypeScript
Stack
Node.js 20, TypeScript 5
Expected output
diff
Updated
June 22, 2026

Related prompts

  • Plan a feature: technical spec and task list Code
  • Write unit tests for existing code Code
  • Code review: bugs, security and performance Code

PromptPress is a WordPress theme that comes with an AI prompt library plugin. Save your best prompts with blanks, let anyone fill them in and copy a ready prompt for ChatGPT, Claude or Midjourney. Private, team or public.

News

  • Coding with AI 3
  • Image Prompts 3
  • News & Updates 1
  • Prompt Engineering 3
  • Team Workflows 2
  • Writing & Marketing 2

Prompts

  • Brand Visuals (9 prompts)
  • Content Engine (5 prompts)
  • Dev Toolkit (4 prompts)
  • Launch Kit (5 prompts)
  • Research & Insights (1 prompts)
  • Sales & Outreach (3 prompts)

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
© 2026 PromptPress • PromptPress™ Theme
↑Scroll to top