diff --git a/071-GitHubCopilot/.wordlist.txt b/071-GitHubCopilot/.wordlist.txt index a37d8033d2..fb286cd7e2 100644 --- a/071-GitHubCopilot/.wordlist.txt +++ b/071-GitHubCopilot/.wordlist.txt @@ -2,3 +2,4 @@ zenquotes OWASP codebase npx +xUnit \ No newline at end of file diff --git a/071-GitHubCopilot/Coach/README.md b/071-GitHubCopilot/Coach/README.md index 70a76123d0..95a7360815 100644 --- a/071-GitHubCopilot/Coach/README.md +++ b/071-GitHubCopilot/Coach/README.md @@ -15,12 +15,14 @@ Welcome to the coach's guide for the GitHub Copilot What The Hack. Here you will - Challenge 02: **[Best Practices When Using Copilot](./Solution-02.md)** - Discover GitHub Copilot's best practices. - Challenge 03: **[Extending GitHub Copilot with Model Context Protocol](./Solution-03.md)** - - Learn to extend GitHub Copilot with MCP, custom agents, and chat modes. -- Challenge 04: **[Leveraging GitHub Copilot in Your Dev Workflow](./Solution-04.md)** + - Learn how to extend Copilot with external tools and data sources via MCP. +- Challenge 04: **[Customizing GitHub Copilot in Your IDE](./Solution-04.md)** + - Personalize Copilot with custom agent instructions and chat modes. +- Challenge 05: **[Leveraging GitHub Copilot in Your Dev Workflow](./Solution-05.md)** - Learn to leverage Copilot beyond just writing code. -- Challenge 05: **[Leveraging Copilot for Test Case and Documentation](./Solution-05.md)** +- Challenge 06: **[Leveraging Copilot for Test Case and Documentation](./Solution-06.md)** - Generate test cases and documentation with the help of GitHub Copilot. -- Challenge 06: **[Debugging and Code Optimization with Copilot](./Solution-06.md)** +- Challenge 07: **[Debugging and Code Optimization with Copilot](./Solution-07.md)** - Use GitHub Copilot for debugging and optimizing your code effectively. ## Coach Prerequisites @@ -38,15 +40,16 @@ Always refer students to the [What The Hack website](https://aka.ms/wth) for the ## Suggested Hack Agenda -This hack is intended to be completed in 1 day in 3 hours. +This hack is intended to be completed in 1 day in 4.5 hours. - Sample Day 1 - - Challenge 1 (30 mins) - - Challenge 2 (30 mins) + - Challenge 1 (45 mins) + - Challenge 2 (45 mins) - Challenge 3 (45 mins) - Challenge 4 (45 mins) - - Challenge 5 (45 mins) - - Challenge 6 (30 mins) + - Challenge 5 (30 mins) + - Challenge 6 (45 mins) + - Challenge 7 (30 mins) ## Repository Contents diff --git a/071-GitHubCopilot/Coach/Solution-03.md b/071-GitHubCopilot/Coach/Solution-03.md index 1bbdcc68ed..c81ae357af 100644 --- a/071-GitHubCopilot/Coach/Solution-03.md +++ b/071-GitHubCopilot/Coach/Solution-03.md @@ -4,7 +4,7 @@ ## Notes & Guidance -This challenge introduces students to the Model Context Protocol (MCP), custom agent instructions, and chat modes - powerful ways to extend and customize GitHub Copilot beyond its default capabilities. This is a more advanced topic that builds on their foundational Copilot knowledge. +This challenge introduces students to the Model Context Protocol (MCP), a powerful way to extend GitHub Copilot beyond its default capabilities by connecting it to external data sources and tools. ### Key Concepts to Explain Before the Challenge @@ -13,37 +13,39 @@ This challenge introduces students to the Model Context Protocol (MCP), custom a - Think of it as a way to give Copilot access to information beyond the code in the workspace - MCP servers act as bridges between Copilot and external context sources (APIs, databases, documentation, etc.) - This is particularly valuable for providing domain-specific knowledge or organization-specific context +- Unlike IDE-level customization (covered in Challenge 04), MCP is about accessing external resources -**Custom Agent Instructions:** -- These are user-defined instructions that modify how GitHub Copilot behaves -- Can be used to enforce coding standards, specify preferred frameworks, or provide project context -- Persists across chat sessions within a workspace -- Located in `.github/copilot-instructions.md` or configured in VS Code settings - -**Chat Modes:** -- **Workspace Mode (@workspace)**: Copilot has context of the entire workspace -- **Editor Mode**: Focused on the currently open file -- **Agent Mode**: Specialized agents for specific tasks (e.g., @terminal, @vscode) -- Each mode has different strengths for different scenarios +**Authentication Best Practices:** +- **OAuth is recommended** for GitHub MCP server - provides secure, seamless authentication +- OAuth allows users to authorize without exposing long-lived tokens +- Personal Access Tokens (PATs) are an alternative but require manual token management and rotation +- Students should configure GitHub MCP using OAuth for better security and user experience ### Setting Up MCP Servers Students will need to configure an MCP server. Here are recommended starting points: **Easy MCP Servers to Start With:** -1. **Filesystem Server**: Provides file system access beyond the workspace -2. **Fetch Server**: Allows Copilot to fetch content from URLs -3. **SQLite Server**: Connects to local SQLite databases +1. **GitHub MCP Server**: Provides access to GitHub repositories, issues, PRs (recommended for this challenge) +2. **Filesystem Server**: Provides file system access beyond the workspace +3. **Fetch Server**: Allows Copilot to fetch content from URLs +4. **SQLite Server**: Connects to local SQLite databases **Configuration Location:** - VS Code: Settings → Extensions → GitHub Copilot → Model Context Protocol - Or manually edit `settings.json` with MCP server configurations -**Example MCP Server Configuration (settings.json):** +**Example MCP Server Configuration with OAuth (Recommended):** ```json { "github.copilot.chat.mcp.enabled": true, "github.copilot.chat.mcp.servers": { + "github": { + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-github"] + // OAuth authentication will be handled automatically via VS Code + // No need to manually provide tokens + }, "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/directory"] @@ -56,53 +58,30 @@ Students will need to configure an MCP server. Here are recommended starting poi } ``` -### Custom Agent Instructions - -Guide students to create `.github/copilot-instructions.md` in their project root: - -**Example Instructions:** -```markdown -# Project Instructions for GitHub Copilot - -This is a Whack-a-Mole game project built with HTML, CSS, and JavaScript. - -## Coding Standards -- Use ES6+ JavaScript syntax -- Follow camelCase naming conventions -- Add JSDoc comments for all functions -- Prefer const over let, avoid var - -## Project Context -- Game state is managed in gameState object -- All timing functions use milliseconds -- DOM manipulation should be vanilla JS (no jQuery) - -## Preferences -- When suggesting code, include error handling -- Prioritize readability over brevity -- Add accessibility attributes to HTML elements +**Alternative: Personal Access Token (Not Recommended):** +If OAuth is not available, students can use a PAT, but this requires manual token management: +```json +{ + "github.copilot.chat.mcp.servers": { + "github": { + "command": "npx", + "args": ["-y", "@modelcontextprotocol/server-github"], + "env": { + "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxx" + } + } + } +} ``` -### Chat Mode Demonstrations +### GitHub Repository Setup -**Recommended: Demonstrate all chat modes at the end** - Some students may not be aware of all the different chat modes available. Going through each mode helps ensure everyone understands when to use each one. In addition if you have experience with another MCP server like Azure MCP, feel free to demo. +For this challenge, students should: +- Create a GitHub repository for their Whack-a-Mole project (or use existing) +- Add at least 5 sample issues with different labels (e.g., "bug," "enhancement," "documentation," "question," "good first issue") +- Optionally add pull requests, project boards, or milestones to practice more MCP queries -Help students understand when to use each mode: - -**@workspace Mode:** -- Use when the question relates to multiple files or the overall project structure -- Example: "How is the game state managed across different files?" -- Copilot will analyze all files in the workspace for context - -**Editor Mode (default):** -- Use for file-specific questions or when adding code to the current file -- More focused and faster responses -- Example: "Add a function to increase difficulty" - -**Agent Modes:** -- **@terminal**: For shell commands and terminal operations -- **@vscode**: For VS Code settings and configuration questions -- These are specialized for specific tools +This setup provides realistic data for students to query via MCP. ### Common Blockers and Solutions @@ -112,16 +91,19 @@ Help students understand when to use each mode: - Verify the MCP feature is enabled in Copilot settings - Look at VS Code's Output panel → GitHub Copilot Chat for error messages -**Blocker 2: Custom Instructions Not Taking Effect** -- Instructions must be in `.github/copilot-instructions.md` -- Restart VS Code or reload the window after creating the file -- Instructions work best when specific and actionable -- Test by asking Copilot about the project context +**Blocker 2: OAuth Authentication Issues** +- GitHub MCP server should use OAuth authentication (recommended approach) +- When first using GitHub MCP, VS Code will prompt to authorize via OAuth +- If OAuth prompt doesn't appear, check that GitHub Copilot extension is up to date +- If students must use PAT (not recommended), ensure token has scopes: `repo`, `read:org`, `read:user` +- Generate PAT at: https://github.com/settings/tokens (only if OAuth fails) +- **Emphasize OAuth is the preferred and more secure approach** **Blocker 3: Understanding Which Chat Mode to Use** -- If stuck, students can just ask Copilot! "Should I use @workspace for this question?" -- Generally: specific file questions → editor mode, multi-file questions → @workspace -- Remind students they can experiment - switching modes is quick +- MCP works with Copilot Chat - students can ask questions in natural language +- Example queries: "List all open issues in my repo," "What are the recent PRs?" +- Can use @workspace for multi-file context or editor mode for focused queries +- Remind students to experiment - MCP responses may take slightly longer **Blocker 4: No Obvious Use Case for MCP** - Suggest practical scenarios: @@ -133,25 +115,29 @@ Help students understand when to use each mode: ### Success Criteria Validation **MCP Server Working:** -- Student can show Copilot accessing external context +- Student can show Copilot accessing external context via MCP +- For GitHub MCP: ask Copilot to list issues, check PR status, or query repository information +- **Verify OAuth authentication** - student should NOT have GITHUB_PERSONAL_ACCESS_TOKEN in settings.json +- Student can explain why OAuth is preferred (security, no token management, automatic refresh) - For fetch server: ask Copilot to fetch and summarize content from a URL - For filesystem: demonstrate accessing files outside the workspace - Check VS Code settings show configured MCP servers -**Custom Instructions:** -- Student can show the `.github/copilot-instructions.md` file -- Demonstrate that Copilot follows the instructions (e.g., coding style preferences) -- Test by asking Copilot to write a function and verify it follows the guidelines +**GitHub Repository Setup:** +- Repository exists with Whack-a-Mole code pushed to GitHub +- At least 5 issues created with varied labels +- Student can demonstrate querying this data via Copilot with MCP -**Chat Modes:** -- Student can explain the difference between @workspace and editor mode -- Show examples of when each would be most useful -- Demonstrate using at least one specialized agent (@terminal or @vscode) +**MCP Queries:** +- Student successfully uses Copilot to query external data +- Example: "What are all the bug issues in my repo?" +- Example: "Show me the most recently updated pull request" +- Demonstrates understanding of how MCP extends Copilot's reach -**Practical Application:** -- Student used the enhanced Copilot setup to add a feature or solve a problem -- Can articulate how the external context helped -- Example: Used MCP to access documentation and implemented a feature based on it +**Understanding MCP:** +- Student can explain what MCP does and why it's useful +- Understands difference between local workspace context and external MCP context +- Can articulate when MCP adds value vs when it's unnecessary ### Advanced Challenge Guidance @@ -162,37 +148,40 @@ Help students understand when to use each mode: **Multiple MCP Servers:** - Students can configure several servers simultaneously -- Example: filesystem + fetch + custom server +- Example: GitHub + filesystem + fetch - Copilot will use whichever is relevant to the question -**Team Coding Standards:** -- Instructions can encode team preferences -- Include linting rules, naming conventions, architecture patterns -- This becomes a "team knowledge base" for Copilot +**Custom MCP Servers:** +- Point students to the MCP SDK documentation for building their own +- A simple custom server could provide game configuration data +- Could create an MCP server that serves game tips or achievement data -**Internal Documentation Server:** +**Enterprise Use Cases:** - For enterprise scenarios, build MCP server serving company docs - Could connect to Confluence, internal wikis, or API documentation -- Makes Copilot aware of organization-specific patterns +- Makes Copilot aware of organization-specific patterns and data ### Estimated Time This challenge typically takes 45 minutes: -- 15 minutes: Understanding MCP and configuration -- 15 minutes: Setting up custom instructions and exploring chat modes -- 15 minutes: Applying to practical task +- 15 minutes: Understanding MCP concepts and configuration +- 15 minutes: Setting up GitHub repository with issues and MCP server +- 15 minutes: Testing MCP queries and understanding capabilities ### Tips to Share If Teams Are Stuck -- Start simple with the fetch or filesystem server before building custom ones -- Custom instructions are powerful but need to be specific - vague instructions don't help much -- MCP is most valuable when you have domain-specific knowledge to inject -- Don't overthink chat modes - they're just different scopes of context +- Start with the GitHub MCP server since it aligns with the challenge requirements +- **Use OAuth authentication** - don't configure with PAT tokens unless OAuth is unavailable +- When configuring GitHub MCP, VS Code should prompt for OAuth authorization on first use +- Create diverse issues (bugs, features, questions) to make MCP queries interesting +- Use descriptive labels and titles for issues to practice filtering queries +- MCP is most valuable when you have external data or APIs to connect - The Resources.zip may contain example MCP configurations to get started quickly +- If MCP setup is problematic, focus on understanding concepts and trying simpler servers (fetch) ### Reference Links - [Model Context Protocol Documentation](https://modelcontextprotocol.io/) +- [GitHub MCP Server](https://github.com/modelcontextprotocol/servers/tree/main/src/github) - [MCP Servers Repository](https://github.com/modelcontextprotocol/servers) - [GitHub Copilot Chat Documentation](https://docs.github.com/en/copilot/using-github-copilot/asking-github-copilot-questions-in-your-ide) -- [Customizing Copilot](https://docs.github.com/en/copilot/customizing-copilot/adding-custom-instructions-for-github-copilot) diff --git a/071-GitHubCopilot/Coach/Solution-04.md b/071-GitHubCopilot/Coach/Solution-04.md index 4883192314..3c360a8797 100644 --- a/071-GitHubCopilot/Coach/Solution-04.md +++ b/071-GitHubCopilot/Coach/Solution-04.md @@ -1,18 +1,52 @@ -# Challenge 04 - Leveraging GitHub Copilot in Your Dev Workflow - Coach's Guide +# Challenge 04 - Customizing GitHub Copilot in Your IDE - Coach's Guide [< Previous Solution](./Solution-03.md) - **[Home](./README.md)** - [Next Solution >](./Solution-05.md) ## Notes & Guidance -- This challenge is to show that Copilot can do more than just help with developers writing code. Here we are going to also leverage Copilot to help with commit messages and a GitHub Action pipeline (yaml). At the end of this challenge you can also discuss some other areas where Copilot may be able to help. Copilot chat will likely be able to help scaffold a good portion of this. Below are some examples: - - Helping with XML such as in APIM policies - - Infrastructure as code such as ARM/Bicep - - SQL Queries -- To generate a commit message, they can go to VS Code, and in the source control section there will be these stars/diamonds next to the commit message box. Selecting that will allow you to leverage Copilot to generate a commit message. They can generate this after creating the pipeline to have something to checkin to. -- This could also be a great time to talk about some of GitHub Copilot Enterprises other features such as PR message creation which is along the same concept. However this is a higher license tier and not part of the hack. There are three tiers of GitHub Copilot Licensing, this hack will focus on the features that apply to Individual/Business: - - Copilot Individual ($10/Month) - This is for individual developers. - - Copilot Business ($19/Month) - This is meant for organizations and allows capabilities to manage licenses and features within Copilot. - - Copilot Enterprise ($39/Month) - This requires the codebase to be in GitHub but allows for organizations to infuse AI across the developer workflow. - - Full Feature Comparison: https://docs.github.com/en/copilot/get-started/plans - -[Sample Pipeline Solution](./Solutions/Solution-03.yaml) +This challenge focuses on customizing GitHub Copilot behavior **within the IDE** using custom instructions and custom agents. The goal is to show how a small amount of guidance can immediately change Copilot’s output in a meaningful way. We aren't expecting long lengthy instruction files to be built + +Students should focus on **simple, high-impact rules** that are easy to observe during the hackathon. + +--- + +## Key Concepts to Explain Before the Challenge + +### Custom Agent Instructions + +- Defined in `.github/copilot-instructions.md` at the repository root +- Apply to **all Copilot interactions** in the workspace +- Used to guide coding standards, testing expectations, and project conventions +- Changes take effect immediately after file creation or modification + +### Chat Modes (Usage Only) + +- Chat modes are selected explicitly in the IDE +- They provide a focused interactive experience +- They do **not** override or replace agent instructions +- Instructions always apply, regardless of the selected chat mode + +--- + +Sample Instruction File below, many other examples in Awesome Copilot repo. + + +### Example Agent Instructions (.NET) + +Keep instructions short and concrete so behavior changes are obvious. + +```markdown +# GitHub Copilot Project Instructions + +## Coding Standards +- Use C# and modern .NET conventions +- Prefer explicit types over `var` unless the type is obvious +- Use meaningful method and variable names +- Keep methods small and focused on a single responsibility + +## Testing Expectations +- New game logic should include unit tests +- Use xUnit for testing +- Test names should describe behavior, not implementation +- Avoid testing UI code directly; focus on game logic + diff --git a/071-GitHubCopilot/Coach/Solution-05.md b/071-GitHubCopilot/Coach/Solution-05.md index 6122276400..fafef0fbd6 100644 --- a/071-GitHubCopilot/Coach/Solution-05.md +++ b/071-GitHubCopilot/Coach/Solution-05.md @@ -1,9 +1,18 @@ -# Challenge 05 - Leveraging Copilot for Test Case and Documentation - Coach's Guide +# Challenge 05 - Leveraging GitHub Copilot in Your Dev Workflow - Coach's Guide [< Previous Solution](./Solution-04.md) - **[Home](./README.md)** - [Next Solution >](./Solution-06.md) ## Notes & Guidance -- Students should be able to generate test cases and documentation. This can either be done via Copilot Chat by asking in a prompt or by highlighting and right clicking a section and choosing "Generate Tests" or "Generate Docs" from the Copilot menu. -- Students can also ask Copilot Chat to update the pipeline as well. -- In either of these scenarios they can start typing in their IDE and have Copilot assist as well. +- This challenge is to show that Copilot can do more than just help with developers writing code. Here we are going to also leverage Copilot to help with commit messages and a GitHub Action pipeline (yaml). At the end of this challenge you can also discuss some other areas where Copilot may be able to help. Copilot chat will likely be able to help scaffold a good portion of this. Below are some examples: + - Helping with XML such as in APIM policies + - Infrastructure as code such as ARM/Bicep + - SQL Queries +- To generate a commit message, they can go to VS Code, and in the source control section there will be these stars/diamonds next to the commit message box. Selecting that will allow you to leverage Copilot to generate a commit message. They can generate this after creating the pipeline to have something to checkin to. +- This could also be a great time to talk about some of GitHub Copilot Enterprises other features such as PR message creation which is along the same concept. However this is a higher license tier and not part of the hack. There are three tiers of GitHub Copilot Licensing, this hack will focus on the features that apply to Individual/Business: + - Copilot Individual ($10/Month) - This is for individual developers. + - Copilot Business ($19/Month) - This is meant for organizations and allows capabilities to manage licenses and features within Copilot. + - Copilot Enterprise ($39/Month) - This requires the codebase to be in GitHub but allows for organizations to infuse AI across the developer workflow. + - Full Feature Comparison: https://docs.github.com/en/copilot/get-started/plans + +[Sample Pipeline Solution](./Solutions/Solution-03.yaml) diff --git a/071-GitHubCopilot/Coach/Solution-06.md b/071-GitHubCopilot/Coach/Solution-06.md index a08e13cec1..56c7501be3 100644 --- a/071-GitHubCopilot/Coach/Solution-06.md +++ b/071-GitHubCopilot/Coach/Solution-06.md @@ -1,16 +1,9 @@ -# Challenge 06 - Debugging and Code Optimization with Copilot - Coach's Guide +# Challenge 06 - Leveraging Copilot for Test Case and Documentation - Coach's Guide -[< Previous Solution](./Solution-05.md) - **[Home](./README.md)** +[< Previous Solution](./Solution-05.md) - **[Home](./README.md)** - [Next Solution >](./Solution-07.md) ## Notes & Guidance -- Students can grab a file of their choice from the [OWASP Juice Shop Repo](https://github.com/juice-shop/juice-shop). For example you can choose the order.ts file located under routes folder [here](https://github.com/juice-shop/juice-shop/blob/master/routes/order.ts). -- Students should be able to use Copilot chat to ask what the whole file does or highlight and interact with Copilot to explain a snippet of code. -- Asking Copilot Chat should also give them the ability to request for a code snippet to resolve the vulnerability as well. -- Please remind students that while Copilot can find vulnerabilities as we will see here, we should not assume it catches everything. This is not a replacement for other security tools such as static code analysis tools (CodeQL). -- Since this is a known vulnerable application, we do not expect them to fix and checkin the changes. This is just an exercise to see how Copilot can help you understand - - What the file or piece of code is doing - - Find and resolve vulnerabilities - - Find and optimize your code - -- As an added note, you can discuss with your students on other similar scenarios and how this could be useful such as refactoring or code conversion. +- Students should be able to generate test cases and documentation. This can either be done via Copilot Chat by asking in a prompt or by highlighting and right clicking a section and choosing "Generate Tests" or "Generate Docs" from the Copilot menu. +- Students can also ask Copilot Chat to update the pipeline as well. +- In either of these scenarios they can start typing in their IDE and have Copilot assist as well. diff --git a/071-GitHubCopilot/Coach/Solution-07.md b/071-GitHubCopilot/Coach/Solution-07.md new file mode 100644 index 0000000000..37db34f62d --- /dev/null +++ b/071-GitHubCopilot/Coach/Solution-07.md @@ -0,0 +1,16 @@ +# Challenge 07 - Debugging and Code Optimization with Copilot - Coach's Guide + +[< Previous Solution](./Solution-06.md) - **[Home](./README.md)** + +## Notes & Guidance + +- Students can grab a file of their choice from the [OWASP Juice Shop Repo](https://github.com/juice-shop/juice-shop). For example you can choose the order.ts file located under routes folder [here](https://github.com/juice-shop/juice-shop/blob/master/routes/order.ts). +- Students should be able to use Copilot chat to ask what the whole file does or highlight and interact with Copilot to explain a snippet of code. +- Asking Copilot Chat should also give them the ability to request for a code snippet to resolve the vulnerability as well. +- Please remind students that while Copilot can find vulnerabilities as we will see here, we should not assume it catches everything. This is not a replacement for other security tools such as static code analysis tools (CodeQL). +- Since this is a known vulnerable application, we do not expect them to fix and checkin the changes. This is just an exercise to see how Copilot can help you understand + - What the file or piece of code is doing + - Find and resolve vulnerabilities + - Find and optimize your code + +- As an added note, you can discuss with your students on other similar scenarios and how this could be useful such as refactoring or code conversion. diff --git a/071-GitHubCopilot/README.md b/071-GitHubCopilot/README.md index 520ceb4c5c..8db4e90bd8 100644 --- a/071-GitHubCopilot/README.md +++ b/071-GitHubCopilot/README.md @@ -19,18 +19,20 @@ This GitHub Copilot What The Hack will help you learn how to do the following wi ## Challenges - Challenge 00: **[Prerequisites - Ready, Set, GO!](Student/Challenge-00.md)** - - Prepare your workstation to work with Azure. + - Prepare your workstation for the hack. - Challenge 01: **[Introduction to GitHub Copilot](Student/Challenge-01.md)** - Create your first program and explore GitHub Copilot. - Challenge 02: **[Best Practices When Using Copilot](Student/Challenge-02.md)** - Discover GitHub Copilot's best practices. - Challenge 03: **[Extending GitHub Copilot with Model Context Protocol](Student/Challenge-03.md)** - - Learn to extend GitHub Copilot with MCP, custom agents, and chat modes. -- Challenge 04: **[Leveraging GitHub Copilot in Your Dev Workflow](Student/Challenge-04.md)** + - Learn how to extend Copilot with external tools and data sources via MCP. +- Challenge 04: **[Customizing GitHub Copilot in Your IDE](Student/Challenge-04.md)** + - Personalize Copilot with custom agent instructions and chat modes. +- Challenge 05: **[Leveraging GitHub Copilot in Your Dev Workflow](Student/Challenge-05.md)** - Learn to leverage Copilot beyond just writing code. -- Challenge 05: **[Leveraging Copilot for Test Case and Documentation](Student/Challenge-05.md)** +- Challenge 06: **[Leveraging Copilot for Test Case and Documentation](Student/Challenge-06.md)** - Generate test cases and documentation with the help of GitHub Copilot. -- Challenge 06: **[Debugging and Code Optimization with Copilot](Student/Challenge-06.md)** +- Challenge 07: **[Debugging and Code Optimization with Copilot](Student/Challenge-07.md)** - Use GitHub Copilot for debugging and optimizing your code effectively. ## Prerequisites diff --git a/071-GitHubCopilot/Student/Challenge-02.md b/071-GitHubCopilot/Student/Challenge-02.md index 2cbf7fb759..65b11be560 100644 --- a/071-GitHubCopilot/Student/Challenge-02.md +++ b/071-GitHubCopilot/Student/Challenge-02.md @@ -17,8 +17,8 @@ In this challenge, you'll focus on learning best practices for working with GitH ## Success Criteria You will have successfully completed this challenge when you: -1. Demonstrate the differences before and after leveraging prompt engineering techniques. You should be able to demonstrate all three scenarios listed in the description, plus at least one additional example of prompt engineering. -2. Show that you have successfully integrated a new feature into your game. +- Demonstrate the differences before and after leveraging prompt engineering techniques - show all three core techniques listed in the description, plus at least one additional prompt engineering example +- Show that you have successfully integrated a new feature into your game ## Learning Resources - [GitHub Copilot Documentation](https://docs.github.com/en/copilot) diff --git a/071-GitHubCopilot/Student/Challenge-03.md b/071-GitHubCopilot/Student/Challenge-03.md index ee53bc3165..7d44c0f6ee 100644 --- a/071-GitHubCopilot/Student/Challenge-03.md +++ b/071-GitHubCopilot/Student/Challenge-03.md @@ -3,28 +3,33 @@ [< Previous Challenge](./Challenge-02.md) - **[Home](../README.md)** - [Next Challenge >](./Challenge-04.md) ## Introduction -GitHub Copilot is a powerful coding assistant, but what if you could make it even smarter by connecting it to external tools, databases, or APIs? This challenge introduces you to the Model Context Protocol (MCP), which allows you to extend Copilot's capabilities by integrating both custom context sources and tools. You'll also explore custom agent instructions and chat modes to personalize your Copilot experience for your specific development needs. +GitHub Copilot is a powerful coding assistant, but what if you could make it even smarter by connecting it to external tools, databases, or APIs? This challenge introduces you to the Model Context Protocol (MCP), which allows you to extend Copilot's capabilities by integrating both custom context sources and tools. ## Description -The Model Context Protocol enables GitHub Copilot to connect to external data sources and tools, providing both richer context and executable capabilities for more relevant suggestions and actions. Combined with custom agents and specialized chat modes, you can create a truly tailored coding assistant. In this challenge, you will: -- **Understand MCP Fundamentals**: Learn what the Model Context Protocol is and how it enables GitHub Copilot to access external context and tools beyond your codebase -- **Set Up a GitHub Repository**: Create a GitHub repository for your Whack-a-Mole project and populate it with sample issues, labels, and other GitHub resources to practice GitHub MCP queries -- **Configure the GitHub MCP Server**: Set up and connect the GitHub MCP server to provide GitHub Copilot with access to your GitHub repository, issues, pull requests, and other GitHub resources -- **Create Custom Agent Instructions**: Define custom instructions that guide how GitHub Copilot behaves and responds to your specific project needs -- **Build a Custom Chat Mode**: Create your own custom chat mode that leverages MCP and agent instructions to provide specialized assistance for your development workflow -- **Apply to Your Project**: Use your MCP-enhanced Copilot setup to add a new feature to your Whack-a-Mole game or solve a complex coding challenge +The Model Context Protocol (MCP) allows GitHub Copilot to connect to external tools and data sources, giving it access to live context beyond your local codebase. In this challenge, you will use MCP to connect Copilot to GitHub and apply it to your Whack-a-Mole project. -This challenge demonstrates how GitHub Copilot can be customized and extended beyond its default capabilities, making it an even more powerful member of your development team. +You will: + +- **Create a GitHub Repository** + Create a new GitHub repository for your Whack-a-Mole game and push your existing code. + +- **Populate GitHub Context** + Create sample GitHub Issues and labels that represent planned features or improvements to the game. + +- **Configure the GitHub MCP Server** + Configure and connect the GitHub MCP server using OAuth so Copilot can securely access repositories, issues, labels, and pull requests. + +- **Use MCP in Copilot Chat** + Use Copilot Chat with MCP enabled to interact with your GitHub repository and its data. ## Success Criteria You will have successfully completed this challenge when you: -- Show a GitHub repository with your Whack-a-Mole code and at least 5 sample issues with different labels -- Demonstrate a working GitHub MCP server connection that provides access to your GitHub repository resources within Copilot -- Show custom agent instructions that modify Copilot's behavior for your project -- Demonstrate a custom chat mode you've built that provides specialized functionality for your development workflow -- Demonstrate using your MCP-enhanced Copilot to query information from your GitHub repo (such as listing issues, checking issue details, or accessing repository information) +- Verify that your Whack-a-Mole project is stored in a GitHub repository +- Show multiple GitHub Issues with labels that represent planned work for the project +- Demonstrate a working GitHub MCP server connection authenticated using OAuth +- Demonstrate Copilot Chat interacting with your GitHub repository using MCP ## Learning Resources - [Customizing GitHub Copilot](https://docs.github.com/en/copilot/customizing-copilot) diff --git a/071-GitHubCopilot/Student/Challenge-04.md b/071-GitHubCopilot/Student/Challenge-04.md index 1175ef7276..99eca2a93f 100644 --- a/071-GitHubCopilot/Student/Challenge-04.md +++ b/071-GitHubCopilot/Student/Challenge-04.md @@ -1,31 +1,30 @@ -# Challenge 04 - Leveraging GitHub Copilot in Your Dev Workflow +# Challenge 04 - Customizing GitHub Copilot in Your IDE [< Previous Challenge](./Challenge-03.md) - **[Home](../README.md)** - [Next Challenge >](./Challenge-05.md) - ## Introduction -In this challenge, you'll explore how GitHub Copilot can be your ally beyond just writing code. This challenge is about integrating Copilot deeper into your entire development workflow. +GitHub Copilot becomes significantly more useful when it understands the context, standards, and expectations of your project. In this challenge, you will customize Copilot within your IDE by creating custom instructions and installing a custom agent to interact with Copilot in specialized ways. + ## Description -GitHub Copilot is more than just a coding assistant; it's a tool that can enhance various aspects of software development. In this challenge, you will checkin your code into a git repository in GitHub. +GitHub Copilot can be customized within the IDE in multiple ways. Custom instructions define behavior that applies across all Copilot interactions, while custom agents (also known as chat modes) provide specialized, task-focused assistance. -- **Craft Commit Messages with Copilot**: Use Copilot to help you write clear and descriptive commit messages that accurately summarize your code changes. -- **Build Pipelines with GitHub Actions**: Discover how Copilot can assist in creating CI workflows with GitHub Actions, helping you automate your build, test, and deployment processes. +In this challenge you will: -This challenge emphasizes the versatility of GitHub Copilot, showcasing its potential to streamline your entire development lifecycle. +- **Create Custom Instructions** + Define custom instructions in `.github/copilot-instructions.md` that guide Copilot's behavior across all Copilot interactions, such as coding style, architectural preferences, or project-specific assumptions. -## Success Criteria -Successfully complete this challenge by demonstrating that you can: +- **Install and Use a Custom Agent** + Install and select a custom agent (chat mode) from the [Awesome Copilot collection](https://github.com/github/awesome-copilot/tree/main), then use it in the IDE to create a specialized interactive experience while working in the codebase. -- Demonstrate a functional CI pipeline set up with Copilot's guidance. - -## Learning Resources -- [GitHub Copilot Documentation](https://docs.github.com/en/copilot) -- [Creating GitHub Actions for CI/CD](https://docs.github.com/en/actions) -## Advanced Challenges (Optional) +## Success Criteria +You will have successfully completed this challenge when you: -If you're using GitHub Copilot Enterprise, take the opportunity to explore additional features designed to enhance your development workflow further. +- Show a custom instructions file you created and explain how it guides Copilot's behavior +- Demonstrate a custom agent installed from the Awesome Copilot collection and show it being selected and used in the IDE +- Show Copilot responding in a way that reflects your custom instructions -- **Create PR Summaries**: Leverage Copilot to help you draft detailed and informative PR summaries, ensuring your team understands the purpose and content of your changes. -- **Interact in PR Discussions**: Explore how Copilot can help you during the PR process when reviewing code. +## Learning Resources +- [Customizing GitHub Copilot with Custom Instructions](https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-personal-instructions) +- [VS Code Chat Modes and Custom Agents](https://code.visualstudio.com/docs/copilot/copilot-chat) diff --git a/071-GitHubCopilot/Student/Challenge-05.md b/071-GitHubCopilot/Student/Challenge-05.md index 63bf9e6342..bf5a08d11f 100644 --- a/071-GitHubCopilot/Student/Challenge-05.md +++ b/071-GitHubCopilot/Student/Challenge-05.md @@ -1,25 +1,31 @@ -# Challenge 05 - Leveraging Copilot for Test Case and Documentation +# Challenge 05 - Leveraging GitHub Copilot in Your Dev Workflow [< Previous Challenge](./Challenge-04.md) - **[Home](../README.md)** - [Next Challenge >](./Challenge-06.md) + ## Introduction -This challenge focuses on improving the quality and maintainability of your Whack-a-Mole game. You'll leverage GitHub Copilot's capabilities to generate comprehensive test cases and create detailed documentation. This challenge is about maintaining quality and improving ease of maintenance. +In this challenge, you'll explore how GitHub Copilot can be your ally beyond just writing code. This challenge is about integrating Copilot deeper into your entire development workflow. ## Description -Utilize GitHub Copilot to guide you through the creation of meaningful test cases that cover various aspects of your application, from basic functionalities to edge cases. Following that, focus on enhancing your app's documentation with Copilot's assistance to ensure clarity and comprehensiveness. Your tasks are: +GitHub Copilot is more than just a coding assistant; it's a tool that can enhance various aspects of software development. In this challenge, you will checkin your code into a git repository in GitHub. -- **Generate Test Cases**: With the new feature in place, use Copilot to assist in creating comprehensive test cases. Focus on covering a wide range of scenarios, including edge cases, to ensure your application's robustness. -- **Document Your Application**: Add in documentation and comments to make your application easier to maintain for the next developer. -- **Include in CI Pipeline**: After generating the test cases, include them in your CI pipeline. +- **Craft Commit Messages with Copilot**: Use Copilot to help you write clear and descriptive commit messages that accurately summarize your code changes. +- **Build Pipelines with GitHub Actions**: Discover how Copilot can assist in creating CI workflows with GitHub Actions, helping you automate your build, test, and deployment processes. -This challenge is not just about coding but also about thinking about application quality and maintainability. It's an opportunity to see how Copilot can contribute to these aspects of software development. +This challenge emphasizes the versatility of GitHub Copilot, showcasing its potential to streamline your entire development lifecycle. ## Success Criteria -You will have successfully completed this challenge when you: - -1. Show your test cases generated with the assistance of Copilot, covering both the existing and newly added functionalities. -2. Show that your test cases are integrated into your CI Pipeline. -3. Show the documentation you have added to your application. +Successfully complete this challenge by demonstrating that you can: +- Demonstrate a functional CI pipeline set up with Copilot's guidance. + ## Learning Resources - [GitHub Copilot Documentation](https://docs.github.com/en/copilot) +- [Creating GitHub Actions for CI/CD](https://docs.github.com/en/actions) + +## Advanced Challenges (Optional) + +If you're using GitHub Copilot Enterprise, take the opportunity to explore additional features designed to enhance your development workflow further. + +- **Create PR Summaries**: Leverage Copilot to help you draft detailed and informative PR summaries, ensuring your team understands the purpose and content of your changes. +- **Interact in PR Discussions**: Explore how Copilot can help you during the PR process when reviewing code. diff --git a/071-GitHubCopilot/Student/Challenge-06.md b/071-GitHubCopilot/Student/Challenge-06.md index 37bcc51a2d..4dae2c06ad 100644 --- a/071-GitHubCopilot/Student/Challenge-06.md +++ b/071-GitHubCopilot/Student/Challenge-06.md @@ -1,28 +1,25 @@ -# Challenge 06 - Debugging and Code Optimization with Copilot +# Challenge 06 - Leveraging Copilot for Test Case and Documentation -[< Previous Challenge](./Challenge-05.md) - **[Home](../README.md)** +[< Previous Challenge](./Challenge-05.md) - **[Home](../README.md)** - [Next Challenge >](./Challenge-07.md) ## Introduction -In this final challenge, you'll harness the power of GitHub Copilot to identify and resolve security vulnerabilities in a pre-written code snippet. You will also optimize your code, refining its performance and maintainability based on the intelligent suggestions provided by Copilot. This challenge is an opportunity to deepen your understanding of how Copilot can be an integral part of your debugging and code optimization processes. - -Please note, while GitHub Copilot can identify vulnerabilities and filter out security vulnerabilities in its suggestions [Link](https://github.blog/2023-02-14-github-copilot-now-has-a-better-ai-model-and-new-capabilities/), it does not replace traditional security tools such as GitHub Advanced Security which have more robust capabilities at identifying vulnerabilities. +This challenge focuses on improving the quality and maintainability of your Whack-a-Mole game. You'll leverage GitHub Copilot's capabilities to generate comprehensive test cases and create detailed documentation. This challenge is about maintaining quality and improving ease of maintenance. ## Description -This challenge is centered around enhancing your debugging and code optimization skills with the help of GitHub Copilot. We will be using the codebase from [OWASP Juice Shop](https://github.com/juice-shop/juice-shop) which is an intentionally insecure web application. You do not need to grab the entire application for this challenge, you may select one of the many files in the routes directory instead. Your tasks are to: +Utilize GitHub Copilot to guide you through the creation of meaningful test cases that cover various aspects of your application, from basic functionalities to edge cases. Following that, focus on enhancing your app's documentation with Copilot's assistance to ensure clarity and comprehensiveness. Your tasks are: -- **Understand the Code**: Sometimes, understanding what a piece of code does is as crucial as writing it. Use Copilot to explain complex code sections, ensuring you comprehend what your code is doing and why. -- **Identify and Fix Bugs**: Leverage the conversational interface to receive guidance on identifying and fixing these bugs. -- **Optimize the Code**: After rectifying the bugs, focus on optimizing the code. Ask Copilot for suggestions on how to improve the efficiency, readability, and performance of your code. +- **Generate Test Cases**: With the new feature in place, use Copilot to assist in creating comprehensive test cases. Focus on covering a wide range of scenarios, including edge cases, to ensure your application's robustness. +- **Document Your Application**: Add in documentation and comments to make your application easier to maintain for the next developer. +- **Include in CI Pipeline**: After generating the test cases, include them in your CI pipeline. -Through this process, you'll not only refine your code but also deepen your understanding of how Copilot can assist in various stages of the development lifecycle, from debugging to code explanation. +This challenge is not just about coding but also about thinking about application quality and maintainability. It's an opportunity to see how Copilot can contribute to these aspects of software development. ## Success Criteria You will have successfully completed this challenge when you: -1. Have used Copilot to effectively identify and resolve bugs in the provided code snippet. -2. Can demonstrate code optimization improvements suggested by Copilot. -3. Can articulate how Copilot helped in understanding complex parts of the code, shedding light on the 'why' and 'how' behind certain code segments. +- Show your test cases generated with the assistance of Copilot, covering both the existing and newly added functionalities +- Demonstrate that your test cases are integrated into your CI Pipeline +- Show the documentation you have added to your application ## Learning Resources - [GitHub Copilot Documentation](https://docs.github.com/en/copilot) - diff --git a/071-GitHubCopilot/Student/Challenge-07.md b/071-GitHubCopilot/Student/Challenge-07.md new file mode 100644 index 0000000000..80abe79baf --- /dev/null +++ b/071-GitHubCopilot/Student/Challenge-07.md @@ -0,0 +1,28 @@ +# Challenge 07 - Debugging and Code Optimization with Copilot + +[< Previous Challenge](./Challenge-06.md) - **[Home](../README.md)** + +## Introduction +In this final challenge, you'll harness the power of GitHub Copilot to identify and resolve security vulnerabilities in a pre-written code snippet. You will also optimize your code, refining its performance and maintainability based on the intelligent suggestions provided by Copilot. This challenge is an opportunity to deepen your understanding of how Copilot can be an integral part of your debugging and code optimization processes. + +Please note, while GitHub Copilot can identify vulnerabilities and filter out security vulnerabilities in its suggestions [Link](https://github.blog/2023-02-14-github-copilot-now-has-a-better-ai-model-and-new-capabilities/), it does not replace traditional security tools such as GitHub Advanced Security which have more robust capabilities at identifying vulnerabilities. + +## Description +This challenge is centered around enhancing your debugging and code optimization skills with the help of GitHub Copilot. We will be using the codebase from [OWASP Juice Shop](https://github.com/juice-shop/juice-shop) which is an intentionally insecure web application. You do not need to grab the entire application for this challenge, you may select one of the many files in the routes directory instead. Your tasks are to: + +- **Understand the Code**: Sometimes, understanding what a piece of code does is as crucial as writing it. Use Copilot to explain complex code sections, ensuring you comprehend what your code is doing and why. +- **Identify and Fix Bugs**: Leverage the conversational interface to receive guidance on identifying and fixing these bugs. +- **Optimize the Code**: After rectifying the bugs, focus on optimizing the code. Ask Copilot for suggestions on how to improve the efficiency, readability, and performance of your code. + +Through this process, you'll not only refine your code but also deepen your understanding of how Copilot can assist in various stages of the development lifecycle, from debugging to code explanation. + +## Success Criteria +You will have successfully completed this challenge when you: + +- Demonstrate using Copilot to effectively identify and resolve bugs in the provided code snippet +- Show code optimization improvements suggested by Copilot +- Explain how Copilot helped in understanding complex parts of the code, shedding light on the 'why' and 'how' behind certain code segments + +## Learning Resources +- [GitHub Copilot Documentation](https://docs.github.com/en/copilot) +