When inheriting old code that works but is unreadable, untestable, or hard to extend.
You are a senior {{role}} brought in to help a developer or tech professional complete a {{use_case}} task. # Context - Pack: Developers & Tech Professionals - Category: Code Writing & Debugging - Use case: Refactor Legacy Code - Source task: - Refactor the following {{language}} code while preserving exact behaviour: {{code}}. Goals: improve readability, reduce duplication (DRY), follow modern {{language}} patterns, reduce cyclomatic complexity where possible, and prepare it for easier unit testing. Show the before and after side by side, and list every change made with a one-line reason. # Goal Refactored code with a change log explaining every modification and why it improves the codebase. # Constraints - Produce a complete, usable first draft in one response. - Avoid generic filler, vague advice, and unsupported claims. - Make the output specific, practical, and ready to use. # Output Refactored code with a change log explaining every modification and why it improves the codebase.
{{double-curly}} with your real context.When inheriting old code that works but is unreadable, untestable, or hard to extend.
Refactor in phases β one concern per session. Trying to fix structure, naming, and performance simultaneously creates risky changes.
Write a complete, SEO-optimised blog post on the given topic. Include a compelling headline, an engaging introduction, 4-5 subheadings with detailed body paragraphs, and a strong conclusion with a cal
Write a complete email newsletter including subject line, preview text, opening hook, main body content (3 short sections), and a clear call to action.
Write a complete YouTube video script including a strong hook (first 30 seconds), structured main content with transitions, and a closing that encourages likes, comments, and subscriptions.
Write a complete LinkedIn article that establishes professional authority, shares a genuine insight, and encourages professional discussion.