Summary and Schedule
This is a Byte-Sized RSE lesson on AI-assisted Coding with Microsoft Visual Studio Code and Github Copilot, part of the Byte-Sized RSE Series.
An intermediate-level practical course on integrating Artificial Intelligence (AI) tools into research software development. Building on foundational knowledge of large language models (LLMs) and AI coding assistants, this course focuses on using these tools effectively within integrated development environments (IDEs). Researchers will develop practical skills to enhance productivity, improve code quality, and apply AI responsibly in real-world research projects.
Learning Objectives
At the end of this lesson, learners should be able to:
- Describe how GitHub Copilot integrates with Microsoft Visual Studio Code and explain the different modes and models available.
- Configure Copilot to protect privacy and intellectual property.
- Use Copilot to explore and understand an existing codebase.
- Construct effective prompts and manage context to improve AI-generated responses.
- Use inline suggestions, plan mode, and agent mode to make targeted and larger-scale code changes.
- Evaluate AI-generated suggestions critically, checking correctness, scope and maintainability.
- Apply a responsible and incremental approach to AI-assisted development, matching the level of review to the level of autonomy.
| Setup Instructions | Download files required for the lesson | |
| Duration: 00h 00m | 1. Introduction to AI-assisted Coding |
How can an AI coding assistant help development within an IDE? What are the mechanisms by which IDE AI assistants provide help? What risks arise when AI coding tools and autonomous agents are given increasing levels of autonomy? How can I use AI coding assistants responsibly? What are the main modes of AI-assisted software development, and how do they differ? What are the limitations of a free Copilot account? What is GitHub Copilot? Which AI models are available within Copilot? |
| Duration: 00h 15m | 2. Example Code |
What example code will we use for the lesson? How do we set up the Python package prerequisites to run the code? |
| Duration: 00h 25m | 3. Getting Started with GitHub Copilot |
How should I configure AI coding assistants to protect privacy and
intellectual property? How can AI help me understand an unfamiliar codebase? Which AI assistant mode should I use for a particular task? How can I use AI to investigate software architecture, dependencies, and implementation details? How can I customise AI coding assistants to follow project conventions and standards? |
| Duration: 00h 35m | 4. Refactoring Code with GitHub Copilot |
What are the different ways to use Copilot to refactor code? What is the difference between inline suggestions, plan mode, and agent mode? Why is it important to review and critically evaluate AI-generated code suggestions? How can plan mode help structure a refactoring task before making any changes? What risks should you consider when delegating larger-scale code changes to an AI agent? |
| Duration: 00h 45m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Setup
Skill prerequisites for the practical activity:
- Basic knowledge of programming in Python (using variables, lists, conditional statements, functions and importing external libraries)
- Experience using Python virtual environments (creating virtual environments, activating/using them, and installing packages within them)
- You have previously written Python scripts to accomplish tasks in your domain of work
- Some basic experience of using Visual Studio Code (opening workspaces, editing and running code)
- Ability to navigate filesystem and run commands from within a shell
Software prerequisites:
- Shell with Git version control tool
- Python version 3.8 or above
- Visual Studio Code (ideally the latest version)
- Visual Studio Code GitHub Copilot extension (ideally the latest version)
Shell with Git
On macOS and Linux, some version of a shell (e.g. bash)
with Git will be available by default and no installation is needed.
If you do not have a bash shell installed on your system and require assistance with the installation, you can take a look at the instructions provided by Software Carpentry for installing shell and Git. You’ll also need a GitHub.com account.
Python
Python version 3.8 or above is required. Type python -v
at your shell prompt and press enter to see what version of Python is
installed on your system. If you do not have Python installed on your
system and require assistance with the installation, you can take a look
at the
instructions provided by Software Carpentry for installing Python in
preparation for undertaking their Python lesson.
Pip
Pip Python package should come together with your Python
distribution. Try typing pip at the command line and you
should see some usage instructions for the command appear if it is
installed.
VS Code
The hands-on part of this topic will be conducted using Visual Studio Code (VS Code), a widely used IDE. Please [download the appropriate version of Visual Studio Code][vs-code] for your operating system (Windows, macOS, or Linux) and system architecture (e.g., 64-bit, ARM). If you already have VSCode, ensure it’s updated to the latest version.
You’ll also need to install the GitHub Copilot extension by following the GitHub Copilot VS Code installation instructions. You’ll need a GitHub.com account to be able to use the extension. You only need to complete steps 1 and 2 at the top of the page. If you already have this extension installed, ensure it’s updated to the latest version.