MemberPress AI Academy memberpress.ai

Prompts

Refactor with Rationale

A refactor brief that asks for the change, the reason, and the boundary — so the resulting diff fits the seam you actually wanted to widen.

By Seth Shoultes

Refactor a function and explain why each change improves it. Great for code review.

Prompt

Refactor the function below for {{GOAL}} (e.g. readability, performance, testability).

<code language="{{LANGUAGE}}">
{{CODE}}
</code>

Return:
1. The refactored code in a single fenced block
2. A bulleted list of changes, each as: "Before → After: <one-line rationale>"

Do not change behavior. Preserve the function's public signature unless I say otherwise.

Variables

When to Use