This content is part of the GitHub Copilot Bootcamp.
In the ever-evolving world of technology, prompt engineering is becoming a key skill for developers leveraging artificial intelligence tools like GitHub Copilot. In this session, we’ll explore how GitHub Copilot can enhance productivity and efficiency in software development.
This article compiles complementary resources from the first session of the bootcamp. Before diving in, here’s a quick reminder of the resources available to all bootcamp participants:
- Register and receive recordings of the bootcamp classes
- GitHub Copilot Challenge: participate in the learning challenge and earn a digital badge
- FREE GitHub Copilot in Visual Studio Code
- Join the Azure AI Community on Discord
- Use the session discount coupon to get a GitHub certification
In this session, participants were introduced to GitHub Copilot and the fundamentals of prompt engineering to enhance coding productivity. The session covered three main learning objectives:
1. Understanding GitHub Copilot
GitHub Copilot is an AI-powered coding assistant designed to enhance software development by generating code suggestions, answering queries, and assisting in debugging. The session explored different ways to use Copilot effectively, including:
- Inline Autocomplete – Copilot provides real-time code suggestions based on the developer’s input.
- Copilot Chat – A conversational interface within VS Code that allows users to refine code, get explanations, and debug issues.
- Terminal Integration – Copilot can assist in running commands and automating workflows, reducing the need to manually look up documentation.
2. Principles of Responsible AI
The session emphasized the responsible use of AI in development, covering essential principles such as:
- Fairness and Inclusivity – Ensuring that AI-generated code does not introduce biases or exclude user groups.
- Privacy and Security – Avoiding the exposure of sensitive information in AI prompts.
- Accountability – Developers remain responsible for reviewing and validating AI-generated code before deployment.
3. Live Coding with GitHub Copilot – Tips and Best Practices
Loiane provided a hands-on demonstration of how to use GitHub Copilot effectively in different coding scenarios. Some key technical insights included:
Prompt Engineering for Better Code Suggestions
Loiane showcased progressive refinement when using Copilot for code generation. She started with a simple prompt for a function to validate US phone numbers and then improved the output by:
- Providing clear function names to guide Copilot’s suggestions.
- Adding inline comments to specify desired behavior.
- Including example inputs and expected outputs, which significantly improved Copilot's code accuracy.
Building a REST API with Copilot
Using Node.js and Express, Loiane demonstrated how Copilot can scaffold a REST API from scratch. Key takeaways included:
- Using Copilot Chat to generate project structure – Instead of manually setting up files, Copilot created the required directories and boilerplate code for an Express API.
- Refining API endpoints – Loiane used iterative prompting to ensure proper input validation, error handling, and structured responses.
- Debugging and troubleshooting – When an issue arose with parsing request data, she asked Copilot for alternative solutions, which helped correct the bug without unnecessary code modifications.
Automating Unit Test Creation
One of the most effective uses of Copilot highlighted in the session was unit test generation. Loiane demonstrated how to:
- Ask Copilot to suggest a testing framework (Jest) and install dependencies.
- Generate test cases for API endpoints.
- Run tests and analyze test coverage reports to ensure code quality.
4. Using Copilot for Code Optimization
Loiane also showed how Copilot can improve existing code by:
- Refactoring functions – Using Copilot Chat to rewrite logic for better readability and maintainability.
- Enhancing security – Adding input validation and error handling.
- Implementing UUIDs for task identifiers – A best practice for unique record identification in APIs.
Final Takeaways
The session reinforced best practices for leveraging Copilot effectively:
- Start simple and refine – Begin with a basic prompt and gradually add context.
- Use Copilot for repetitive tasks – Automate boilerplate code, unit tests, and documentation.
- Validate AI-generated code – Always review suggestions before integrating them into production.
Note: Each class of the GitHub Copilot Bootcamp includes a 64% discount code for a GitHub certification exam, valid for 4 days. Watch the class to learn about the policies and use the voucher within the deadline.
Updated Feb 14, 2025
Version 1.0cynthiazanoni
Microsoft
Joined November 06, 2019
Microsoft Developer Community Blog
Follow this blog board to get notified when there's new activity