This _is_ something that you can do with AI, but it's something that a search engine is better suited to because the search engine provides context that helps you do the evaluation, and it doesn't smash up results in weird and unpredictable ways.
Y'all think that AI is "thinking" because it's right sometimes, but it ain't thinking.
If I search for "refactor <something> to <something else>" and I get good results, that doesn't make the search engine capable of abstract thought.