PromptBase
PromptBase SelectGet Select
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-sonnet)
Token size
815
Example input
[REFACTOR_BRIEF]: We have a Django app with two ways of doing email: a legacy send_email() function that uses SMTP directly, and a newer EmailService class that uses SendGrid. About 60% of call sites use the legacy function. We want to standardize on EmailService and remove send_email(). Tests exist but coverage is uneven.
Example output
**Goal** All email sending in the codebase goes through EmailService. The legacy send_email() function is removed. **Non-goals** - Adding new email features. - Improving EmailService's API surface (separate change if needed). - Touching the templating layer used by either path. **Plan** 1. **Inventory all current send_email() callers** (small) - Run a grep across the codebase, list every call site. - What proves it's done: a checked-in document or comment with the list, count by module. - State after: code unchanged. Deployable. 2. **Audit EmailService for feature parity** (small) - For each parameter send_email() accepts, confirm EmailService supports it. - What proves it's done: a parity table written down; any gaps flagged as blockers. - State after: code unchanged. Deployable. 3. **Add coverage for send_email() behavior** (medium) - For every distinct usage pattern found in step 1, write a behavioral test that hits the existing function. We need this so we can verify the migrated version produces the same output. - What proves it's done: tests added, all pass against current code. - State after: tests added but no behavior change. Deployable. 4. **Migrate the first 3-5 call sites as a pilot** (medium) - Pick low-risk, low-traffic call sites first (admin tools, dev-only scripts). - For each, replace send_email() with EmailService and re-run the relevant test from step 3. - What proves it's done: those call sites use EmailService, tests still pass, manual smoke test of one shows correct output in the SendGrid dashboard. - State after: legacy function still exists for the remaining 95%+. Deployable. 5. **Migrate the remaining call sites in batches by area** (large) - Group call sites by module. Migrate one module at a time. Run the relevant tests after each module. - What proves it's done: zero send_email() calls left, all tests pass. - State after: legacy function exists but is unused. Deployable. 6. **Remove the legacy function** (small) - Delete the function and its imports. - What proves it's done: grep -r 'send_email' src/ returns nothing in code, only in CHANGELOG or comments. - State after: refactor complete. Deployable. **Rollback strategy** - Steps 1-3 are non-destructive; nothing to roll back. - Step 4 and 5: each batch is a separate commit. If a problem shows up, revert that batch only. The legacy function still exists, so reverting works without a full re-deploy. - Step 6: rollback is reverting the deletion. The function is in version control; recovering it is cheap. If a hidden caller is found post-deploy, the fix is a fast-revert. **What we learn at each milestone** - After step 1: how big is this really. - After step 2: are there hidden blockers in EmailService that we discovered. - After step 3: how reliable our test coverage actually is. - After step 4: whether the migration pattern works smoothly or breaks on edge cases the parity audit missed. - After step 5: whether there are dormant code paths the grep didn't catch.
Claude

Refactoring Planner

Add to Cart
PromptBase Select
Get this prompt + 9 more with Select$14 your first month, then $19/mo$14 first month, then $19/mo
View Select
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-SONNET
Tested icon
Guide icon
4 examples icon
Free credits icon
Plans a refactor before any code gets touched — a sequenced set of small, reversible steps with rollback points, not a code change. Each step names what proves it's done, whether the codebase stays deployable, and an honest effort estimate. Flags a real rollback for anything risky, caps plans at 8 steps (splitting bigger scope instead), and pushes back when "cleaner code" is the only stated payoff. One of 40 in the Pemway Power User Pack.
...more
Added over 1 month ago
Report
Browse Marketplace