# How to refactor code with GitHub Copilot

DevFeed: [How to refactor code with GitHub Copilot](<https://devfeed.tech/articles/how-to-refactor-code-with-github-copilot-67565.md>)

Original publisher: [Read original article](<https://github.blog/ai-and-ml/github-copilot/how-to-refactor-code-with-github-copilot/>)

Author: Anthony Grutta

Published: 2025-02-11T17:00:05Z

Content type: tutorial

Language: en

Sources: [GitHub Blog](<https://devfeed.tech/sources/github-engineering.md>)

Topics: [Spec Driven Development](<https://devfeed.tech/topics/spec-driven-development.md>), [Code Modularity](<https://devfeed.tech/topics/code-modularity.md>), [GitHub](<https://devfeed.tech/topics/github.md>), [Visual Studio Code](<https://devfeed.tech/topics/visual-studio-code.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>)

Tags: [ai-ml](<https://devfeed.tech/tags/ai-ml.md>), [code](<https://devfeed.tech/tags/code.md>), [github-copilot](<https://devfeed.tech/tags/github-copilot.md>), [github-copilot-chat](<https://devfeed.tech/tags/github-copilot-chat.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [refactor](<https://devfeed.tech/tags/refactor.md>), [refactoring-code](<https://devfeed.tech/tags/refactoring-code.md>)

## AI overview

The tutorial shows how to use GitHub Copilot Chat to understand and refactor code, then walks through restructuring a multi-file GitHub migration tool into reusable modules and classes. It recommends planning the changes, giving Copilot specific context and prompts, reviewing its suggestions, and testing the resulting code.

## Source excerpt

Discover how to use GitHub Copilot to refactor your code and see samples of it in action.