Start here. This is the direct spoken answer to practice first.
Why this question matters
This question tests maturity. Rewrites are tempting, but most teams need engineers who can improve software while the product keeps moving.
I worked in an area where the API controller had validation, authorization, data access, and response shaping all mixed together. Instead of proposing a rewrite, I chose one active feature and improved the path I was touching. I extracted request validation, moved business checks into a service, added focused tests around the behavior, and left the rest of the module working as before. The feature shipped, and the code path became easier to change next time.