Browse Developers Section 5: Refactoring

Extract Reusable Code

3 fill-in slots · from The AI Prompt Handbook for Developers

Your details

0/3 filled

Extract Reusable Code

I have duplicated/similar code I want to consolidate:

CODE INSTANCE 1:
[Paste first instance]

CODE INSTANCE 2:
[Paste second instance]

[Additional instances if any]

Please:
1. Identify what's common vs. what varies
2. Design a reusable abstraction
3. Show the extracted code/function/class
4. Show how each original instance would use it
5. Note any tradeoffs in the abstraction

Highlighted [slots] are still empty. Downloads are plain .txt — paste into any AI assistant.