Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6852ce0
Update README.md
Whowong Feb 4, 2025
dfad661
Merge branch 'microsoft:master' into master
Whowong Oct 17, 2025
e8eac2f
Revise notes to include new GitHub Copilot methods
Whowong Nov 21, 2025
bc451af
Revise guidance with updated best practices
Whowong Nov 21, 2025
4f81ff0
Create Challenge-New-3.md
Whowong Nov 21, 2025
bb17575
Updating to include the new challenge 3 and shifting the other 3 chal…
Whowong Nov 25, 2025
30858c9
Updating for solution 1
Whowong Nov 25, 2025
deb475c
Merge branch 'microsoft:master' into GitHubWTHUpdates
Whowong Dec 2, 2025
fbb3cf6
Updating challenge 2 and solutions
Whowong Dec 3, 2025
97a148b
Fix formatting inconsistencies in WTHAuthor chatmode
Whowong Dec 4, 2025
13bf893
Fix formatting and wording in Solution-02.md
Whowong Dec 4, 2025
adafd98
Update Solution-03.md
Whowong Dec 4, 2025
672a383
Fix formatting in WTHAuthor.chatmode.md
Whowong Dec 4, 2025
c138cb9
Refine wording for modularity in challenges
Whowong Dec 4, 2025
fc46f0d
Add 'npx' to the wordlist
Whowong Dec 4, 2025
4d270f9
Delete .github/chatmodes/WTHAuthor.chatmode.md
Whowong Dec 5, 2025
9a2e4a4
Change Copilot pricing link to documentation
Whowong Dec 14, 2025
bb9ad7c
Update title for Challenge 04 in Coach's Guide
Whowong Dec 14, 2025
08e5d50
Update title for Challenge 05 in documentation
Whowong Dec 14, 2025
96396c9
Updating titles and links
Whowong Dec 14, 2025
8c93a45
Merge branch 'microsoft:master' into GitHubWTHUpdates
Whowong Dec 30, 2025
3523f78
Split old challenge 3 into 2 challenges. One dedicated to MCP and on…
Whowong Dec 30, 2025
bb5a05f
Updated to match guidelines
Whowong Dec 30, 2025
e71750b
Updating Challenge 4 solution to be more condensed
Whowong Dec 30, 2025
752baca
adding xUnit to wordlist
Whowong Dec 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 071-GitHubCopilot/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ zenquotes
OWASP
codebase
npx
xUnit
21 changes: 12 additions & 9 deletions 071-GitHubCopilot/Coach/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
179 changes: 84 additions & 95 deletions 071-GitHubCopilot/Coach/Solution-03.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]
Expand All @@ -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

Expand All @@ -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:
Expand All @@ -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

Expand All @@ -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)
60 changes: 47 additions & 13 deletions 071-GitHubCopilot/Coach/Solution-04.md
Original file line number Diff line number Diff line change
@@ -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

Loading