GitHub Copilot for repetitive work ⛏️

November 27, 2024

  • AI

  • Tools

  • Refactoring

Photo of workers working hard

Usually I don’t need to do this kind of work, but when a migration of frontend library came in, a lot of stuff needed to be changed and there were no ready-made scripts. GitHub Copilot did the job for the boring part.

Software used in this blog post:

  • Visual Studio Code
  • GitHub Copilot extension
  • GitHub Copilot Chat extension

Describe your expectations

What's the base unit for the action? In the below example it’s FormControl component which needs to be replaced. Also its properties and children need to be changed. Describe everything that needs to be done with the base unit, use short and clear sentences.

Described expectations

Test the action on a single selection, then adjust the guide for Copilot or move over to the next step.

Single selection action result

Select the scope

It wouldn’t make sense if we select each occurrence of the base unit and trigger the action. Tell the Copilot what’s the scope. In our example it’s a file which has many occurrences of FormControl. Right-click in the editor and add the file to chat.

Sending a file to chat

Loop over the instruction

Adjust the guide to make it a loop. Boring work has become fun now!

Described expected mass action

See also 🔗 How contextual understanding can help you? Codeium, real world examples


Adam Kaczmar

About the author

Adam Kaczmar, Web Developer

I've been a professional full-stack web developer since 2015. My experience comes mainly from e-commerce and consists of:

  • developing highly customized e-commerce software,
  • automating catalog and order integrations with external warehouse services,
  • creating tailor-made user-friendly administration tools for client teams,
  • creating front-end React / Next.js applications along with headless Magento, Laravel and Sanity back-ends.

Besides my programming job, I'm a husband, a father of two lovely daughters and I train boxing every Monday afternoon. Movie genere of my choice is western.

Want to talk? 🙂 Reach me on LinkedIn

...or explore all blog posts ➡️