Refactor to Match a Pattern

Point at a file you already like and have the agent bring another one in line with it.

Intermediate1 min read

Customize

Fill these in and the prompt below updates as you type. Anything you leave blank stays as a placeholder.

Your prompt

2 placeholders left
Refactor {{target_file}} to follow the pattern in {{reference_file}}.

Keep behavior identical, run the existing tests after each change, and do not add new dependencies.

Similar prompts

Map the Blast Radius of a Change

Find every caller a signature change would break, and the safe order to migrate them.

Modernize an API Call Incrementally

Migrate off a deprecated dependency one file at a time, stopping the moment tests fail.

Add Diagnostics Before Guessing

Instrument first, theorize second — logging with a stated plan for capturing the failure.

Add Types Incrementally

Type one file with runtime behavior frozen, and make the type-checker output the proof.