Learn to code faster with AI-powered suggestions using GitHub Copilot in VS Code and Codespaces.
- About
- Workflows
- Technology Stack
- Step 1: Leverage Codespaces with VS Code for Copilot
- Step 2: JavaScript Skills
- Step 3: Copilot Hub
- Step 4: Copilot Comments
- Step 5: Review and Improve Suggestions
- Step 6: Testing & Validation
- Step 7: Completion
- Contributing
- License
This repository is a GitHub Skills course that teaches developers how to leverage GitHub Copilot for AI-powered code suggestions. GitHub Copilot helps you write code faster by offering autocomplete-style suggestions right in VS Code and Codespaces.
Key features include:
- Interactive Learning: Step-by-step course using GitHub Actions to track progress
- GitHub Codespaces Integration: Practice Copilot in a cloud-based development environment
- Hands-on Examples: Real coding exercises with JavaScript and development containers
- Automated Workflows: GitHub Actions workflows guide learners through each step
This repository includes five simple example workflows in .github/workflows that demonstrate different aspects of the learning experience:
- Auto Assign (
auto-assign.yml): Example workflow for repository automation - Copilot Extension Setup (
copilot-extension-setup.yml): Example workflow for extension configuration - JavaScript Skills (
javascript-skills.yml): Example workflow for JavaScript practice - Copilot Hub (
copilot-hub.yml): Example workflow for advanced Copilot features - Copilot Comments (
copilot-comments.yml): Example workflow for comment-based code generation
These workflows are provided as simple examples referenced in the README to demonstrate GitHub Actions integration.
This course uses the following technologies:
- HTML5: For web-based content and examples
- Primer CSS: GitHub's design system for consistent styling
- http-server (npm): Simple local development server for testing web content
- GitHub Actions: Workflow automation and course progression tracking
- GitHub Codespaces: Cloud-based development environment with pre-configured settings
- VS Code: Primary code editor with integrated Copilot support
Welcome to "Develop With AI Powered Code Suggestions Using GitHub Copilot and VS Code"! 👋
GitHub Copilot is an AI pair programmer that helps you write code faster and with less work. It draws context from comments and code to suggest individual lines and whole functions instantly. GitHub Copilot is powered by OpenAI Codex, a generative pretrained language model created by OpenAI.
Copilot works with many code editors including VS Code, Visual Studio, JetBrains IDE, and Neovim.
Additionally, GitHub Copilot is trained on all languages that appear in public repositories. For each language, the quality of suggestions you receive may depend on the volume and diversity of training data for that language.
Using Copilot inside a Codespace shows just how easy it is to get up and running with GitHub's suite of Collaborative Coding tools.
Note This skills exercise will focus on leveraging GitHub Codespace. It is recommended that you complete the GitHub skill, Codespaces, before moving forward with this exercise.
We recommend opening another browser tab to work through the following activities so you can keep these instructions open for reference.
Before you open up a codespace on a repository, you can create a development container and define specific extensions or configurations that will be used or installed in your codespace. Let's create this development container and add copilot to the list of extensions.
-
Navigating back to your Code tab of your repository, click the Add file drop-down button, and then click
Create new file. -
Type or paste the following in the empty text field prompt to name your file.
.devcontainer/devcontainer.json -
In the body of the new .devcontainer/devcontainer.json file, add the following content:
{ "name": "Codespace for Skills!", "customizations": { "vscode": { "extensions": [ "GitHub.copilot" ] } } } -
Select the option to Commit directly to the
mainbranch, and then click the Commit new file button. -
Navigate back to the home page of your repository by clicking the Code tab located at the top left of the screen.
-
Click the Code button located in the middle of the page.
-
Click the Codespaces tab on the box that pops up.
-
Click the Create codespace on main button.
Wait about 2 minutes for the codespace to spin itself up.
-
Verify your codespace is running. The browser should contain a VS Code web-based editor and a terminal should be present such as the below:
-
The
copilotextension should show up in the VS Code extension list. Click the extensions sidebar tab. You should see the following:
Wait about 60 seconds then refresh your repository landing page for the next step.
Objective: Create a JavaScript function in the src/ directory and demonstrate basic usage or unit testing.
-
In your Codespace, create a new directory called
srcif it doesn't exist. -
Create a new file
src/skills.jswith a simple JavaScript function (use Copilot to help you write it). -
Add example usage or a basic test to validate your function works.
-
Commit your changes to the repository.
Validation: Ensure your JavaScript file is created and the function can be executed or tested.
Objective: Explore GitHub Copilot's suggestion panel and accept at least one code suggestion.
-
Open the Copilot panel in VS Code (click the Copilot icon in the Activity Bar on the left sidebar).
-
Start typing a comment describing what you want to code (e.g.,
// function to calculate fibonacci sequence). -
Review the suggestions provided by Copilot.
-
Accept one of the suggestions by pressing
Tabor clicking on it. -
Test the generated code to ensure it works as expected.
Validation: Confirm that you've successfully accepted and tested a Copilot suggestion.
Objective: Use code comments to guide Copilot in generating function implementations.
-
Create a new file or open an existing one in your
src/directory. -
Write a detailed comment describing a function you want to create (e.g.,
// Create a function that validates email addresses using regex). -
Allow Copilot to suggest the implementation based on your comment.
-
Accept the completion and test the function.
-
Commit your changes.
Validation: Ensure the commented function was successfully completed by Copilot and works correctly.
Objective: Learn to evaluate and refactor code suggestions from Copilot for better quality.
-
Review the code that Copilot has generated in previous steps.
-
Identify areas where the code could be improved (e.g., error handling, edge cases, performance).
-
Refactor the code to make it more robust and maintainable.
-
Add additional tests or validation to ensure the improved code works correctly.
-
Commit your improvements.
Validation: Verify that your refactored code is cleaner, more efficient, and handles edge cases properly.
Objective: Run a local development server and verify your examples work as expected.
-
If you have HTML/CSS files, install and run
http-server:npm install -g http-server http-server
-
Open the local server URL in your browser and verify your examples render correctly.
-
Test all JavaScript functions you've created to ensure they work properly.
-
Fix any issues you discover during testing.
-
Commit your final tested code.
Validation: Confirm that all examples work correctly when tested locally.
Objective: Create a pull request with all your changes and confirm automated checks pass.
-
Ensure all your changes are committed to your branch.
-
Push your branch to GitHub.
-
Open a pull request from your branch to
main. -
Add a descriptive title and body to your PR explaining the changes you made.
-
Wait for any automated checks to run and ensure they pass.
-
Request a review if working in a team setting.
Validation: Confirm your PR is created, all checks pass, and the changes are ready for review.
Congratulations! You've completed the GitHub Copilot skills course! 🎉
Contributions are welcome! If you'd like to improve this course:
-
Fork the repository
-
Create a feature branch (
git checkout -b feature/improvement) -
Make your changes
-
Run any local checks to ensure your changes don't break existing functionality
-
Commit your changes (
git commit -m 'Add some improvement') -
Push to the branch (
git push origin feature/improvement) -
Open a Pull Request
Please ensure your contributions align with the course objectives and maintain the educational value for learners.
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 char23-web
Get help: Post in our discussion board • Review the GitHub status page
© 2025 char23-web • Code of Conduct • MIT License