Which task suits Copilot best in a legacy module?
Why A is the answer
Writing tests that capture current behavior before you change it
Tests give you a safety net, and Copilot generates them quickly. Review them against what the code should do.
In detail
- Tests that capture current behavior protect a later change.
- Capture current behavior even if it looks odd.
Use case
An illustrative scenario, not a real incident.
Before refactoring an old billing module, a team has Copilot write tests that capture what it does now. The refactor then has a safety net.
See it in different ways
flowchart LR A["Ask Copilot for unit tests"] --> B["Review the tests"] B --> C["Ask for code that passes them"] C --> D["Run the tests"]
stateDiagram-v2 [*] --> Suggested Suggested --> Reviewed: check correctness, security and fit Reviewed --> Accepted: passes review Reviewed --> Rejected: fails review Accepted --> [*] Rejected --> [*]
flowchart LR S0["Write characterization tests"] --> S1["Refactor"] --> S2["Run tests"] --> S3["Review"]
Key point: Protect behavior before you change it.
Why the other options are wrong
- B. Deleting all of the old code and asking for a complete replacement
- A full replacement loses known behavior.
- C. Skipping the review of its output, because the module is rarely used
- Rarely used code still needs review.
- D. Merging a large refactor with no tests to protect its behavior
- With no tests, you cannot see what the refactor broke.

