< Previous Challenge - Home - Next Challenge >
In this challenge, you will optimize Copilot context using a real code task in the NYC starter app under Resources/Challenge-02-NYCApp.
The app intentionally includes an oversized global .github/copilot-instructions.md file and multiple routes (events, restaurants, neighborhoods) so you can compare broad context (#Codebase) against precise, task-focused attachments.
Every token sent to GitHub Copilot has a cost. Context that persists across interactions, such as global instruction files or broad workspace references, can increase recurring spend by adding tokens that are not needed for the current task.
You will audit the over-stuffed global instructions file, restructure it into scoped path-specific files, and replace broad references with pinned attachments to reduce the base cost of each Copilot interaction while maintaining output quality.
Use the project in:
Resources/Challenge-02-NYCApp
.github/copilot-instructions.md and identify what is:
.github/instructions/ for rules that should apply only to specific paths/tasks. For example, create an api.instructions.md file and an events.instructions.md file.src/routes/events.ts..github/skills/free-events-endpoint/SKILL.md that captures the pattern for implementing a free events endpoint. This skill should only load when explicitly invoked, making it a conditional cost rather than a recurring one.Implement GET /events/free-this-week in src/routes/events.ts with this behavior:
price === 0{ count, events }Important:
src/routes/events.tssrc/routes/restaurants.tssrc/routes/neighborhoods.tsIn the GitHub Copilot Chat interface, run this exact query twice and compare results:
“What data or features does this application support?”
Run it twice and record the token usage each time:
#Codebase)src/routes/events.ts, src/data/events.ts, and relevant instruction files)Capture both token counts from the Copilot Chat usage details/output, compare answer quality, and calculate the difference.
For each run, record context window stats in this format:
Example format:
Then compute:
Use this table to record your measurements:
| Run | Context Strategy | Query | Used Tokens | Total Context Window Tokens | Utilization % | Notes |
|---|---|---|---|---|---|---|
| A | Broad (#Codebase or equivalent) |
What data or features does this application support? | ||||
| B | Scoped pinned files | What data or features does this application support? |
| Comparison Metric | Value |
|---|---|
| Used-token delta (A - B) | |
| Utilization delta percentage points (A - B) |
To complete this challenge successfully, you should be able to:
.github/copilot-instructions.md is significantly smaller than the original.github/instructions/.github/skills/free-events-endpoint/SKILL.md/events/free-this-week implementation in src/routes/events.tssrc/routes/restaurants.ts and src/routes/neighborhoods.ts remained unchanged#Codebase and pinned attachments for the same task/api, put the instruction file in /api/.github/