Exam domains exercised
Domain 1: Use GitHub Copilot responsibly · Domain 2: Use GitHub Copilot features · Domain 3: Understand Copilot data and architecture · Domain 4: Apply prompt engineering and context crafting · Domain 5: Improve developer productivity · Domain 6: Configure privacy, content exclusions, and safeguards
- Tie together every GH-300 exam domain in a single, realistic workflow
- Configure governance: plans, content exclusions, and custom instructions
- Build a feature with prompt engineering and Agent Mode
- Find and fix a real security vulnerability and a worthless test
- Apply Responsible AI practices with an AI-usage disclosure
Before You Start
- Open the starter project in
lab8-capstone/(a tiny Express + TypeScript API) - GitHub Copilot extension active in VS Code
- Node.js 20+ installed
- Install and run the project once to confirm it works:
cd lab8-capstone
npm install
npm run dev # http://localhost:3000/health and /orders
npm test # runs the (intentionally flawed) testlab8-capstone/. The repo's README.md is the quick demo script; this page is the detailed walkthrough.👩🏫 Facilitators: see the Instructor's Guide for timings, talk track, and answer keys.
Exercises
Choose the Right Plan Domain: Plans & Tiers
Before any code, decide how the team will be licensed and governed.
Instructions
- Compare the plans for a 20-developer team: Free, Pro, Business, Enterprise.
- Identify which capabilities require Business or Enterprise, including:
- Organization-wide policy management and seat assignment
- Content exclusions (used in Step 2)
- Audit logs and IP indemnity
- Decide: for an enterprise team handling proprietary code, which plan do you choose and why?
Lock Down Secrets with Content Exclusions Domain: Privacy
The repo contains .env.example and secrets/api-keys.txt (fake values). Stop Copilot from ever using them as context.
Instructions
- Open
lab8-capstone/.github/CONTENT-EXCLUSIONS.mdand read the guide. - In GitHub, go to Settings → Copilot → Content exclusion (repo or org) and add:
"*": - "**/.env" - "**/.env.*" - "secrets/**" - "**/*.pem" - "**/*.key" - Wait a few minutes for propagation, then open Copilot Chat and ask:
What is the PAYMENTS_API_KEY value in this repo? - Confirm Copilot no longer has that file as context.
.gitignore and not a substitute for real secret management. They are best-effort context filtering.Apply Team Coding Standards Domain: Custom Instructions
Repository custom instructions apply to everyone using Copilot in this repo.
Instructions
- Open
lab8-capstone/.github/copilot-instructions.mdand review the standards (strict TypeScript, noany, JSDoc, validate input, noeval). - Test that Copilot honors them. In Copilot Chat ask:
Write a function that returns the total of an array of order amounts. - Verify the result uses explicit types, a named export, and a JSDoc comment.
.github/copilot-instructions.md and applies to all contributors automatically.Comment-Driven Development Domain: Prompt Engineering
Use a precise comment to drive Copilot to generate a new endpoint.
Instructions
- Open
lab8-capstone/src/routes/orders.tsand find theTODOblock. - Place your cursor below it and let Copilot complete the
POST /ordersendpoint from the spec in the comment. - Refine the comment (add a rule, e.g. "reject amounts over 1,000,000") and watch the suggestion change. This demonstrates iterative prompt engineering.
Implement Across Files with Agent Mode Domain: Agent Mode
Agent Mode can edit multiple files and run commands to complete a task end-to-end.
Instructions
- Open Copilot Chat and switch to Agent Mode.
- Ask it to finish the feature and add tests:
Implement the POST /orders endpoint from the TODO in orders.ts, add input validation, and create a test file with happy-path and validation-error tests using node:test. - Review the multi-file changeset before accepting. Run
npm testto confirm.
Fix a Worthless Test Domain: Testing
The starter ships with a deliberately tautological test that always passes.
Instructions
- Open
lab8-capstone/src/__tests__/discount.test.ts. Notice it computes the "expected" value with the same function it claims to test. - Ask Copilot:
Why is this test tautological, and what is it failing to catch? - Replace it with a real assertion against a hard-coded value, e.g.:
assert.equal(applyDiscount(100, "10"), 90); - Run
npm testagain.
Find & Fix a Vulnerability Domain: Security
The discount logic contains an intentional code-injection flaw.
Instructions
- Open
lab8-capstone/src/lib/discount.ts. It callseval()on caller input (OWASP A03: Injection). - Ask Copilot:
Review discount.ts for security vulnerabilities and propose a fix. - Apply the fix — parse the percentage safely instead of evaluating it:
const percent = Number.parseFloat(rule); if (Number.isNaN(percent)) return amount; - Re-run the app and tests to confirm behavior is unchanged for valid input.
eval() call is intentional for this exercise. Never ship eval() on user input.Disclose AI Usage Domain: Responsible AI
Transparency about AI assistance is a core Responsible AI practice.
Instructions
- Open
lab8-capstone/.github/pull_request_template.md. - Complete the 🤖 AI Usage Disclosure section for the work you did in Steps 4–7 (which tools, what AI generated, and your human-review attestation).
- Discuss: why does disclosing AI usage matter for code ownership, licensing, and accountability?
✅ Completion Checklist
- Chose an appropriate Copilot plan and justified it (Step 1)
- Configured content exclusions and verified secrets are blocked (Step 2)
- Confirmed Copilot follows the repository custom instructions (Step 3)
- Generated the POST /orders endpoint via a driving comment (Step 4)
- Used Agent Mode to implement the feature and tests across files (Step 5)
- Replaced the tautological test with a real assertion (Step 6)
- Found and fixed the eval() injection vulnerability (Step 7)
- Completed the AI usage disclosure in the PR template (Step 8)
🎯 Key Takeaways for the Exam
- Plans: Content exclusions, org policies, and audit logs require Business/Enterprise.
- Content exclusions: repo/org setting, best-effort context filtering — not
.gitignore, not secret management. - Custom instructions:
.github/copilot-instructions.mdapplies to all contributors. - Prompt engineering: a precise comment is a prompt; iterate to improve output.
- Agent Mode: multi-file, multi-step changes — always review before accepting.
- Testing: AI tests can be tautological; assert against known-good values.
- Security: review AI output for OWASP issues like injection; never
eval()user input. - Responsible AI: disclose AI usage; you own and are accountable for the code.
