Post Content
Optimize GitHub Copilot context and token usage to get better AI results with fewer tokens. Learn how the context window works and use /context, /init, and /compact to keep Copilot sessions focused, accurate, and efficient.
Episode 5 of 10 in Build your personal brand with Copilot. Continue to Episode 6 and explore the full series:
https://aka.ms/student-learning-series-website
Build your personal brand with Copilot is a beginner-friendly Microsoft Developer series for students. Follow Microsoft employees as they use GitHub Copilot, Visual Studio Code, GitHub Pages, Microsoft Foundry, MCP servers, and agent skills to create, publish, and improve a professional portfolio website.
In this episode:
0:00 Welcome and an introduction to context and tokens
0:21 What context includes
0:38 How Copilot processes information as tokens
0:46 Viewing context with /context
0:53 Understanding the context window with a suitcase analogy
1:04 Why too little or too much context can hurt results
2:07 Generating a case study page without project context
3:04 Adding project files for better results
3:57 Refreshing project context with /init
4:02 How copilot-instructions.md guides Copilot
5:02 Starting a focused session with the right context
6:08 Checking context usage
6:44 Reducing token usage with /compact
7:11 Recap of context and token optimization
Connect with the presenters:
Emily Rothrock – Software Engineer at Microsoft: https://www.linkedin.com/in/emily-rothrock/
Shivani Sundaresan – Software Engineer at Microsoft: https://www.linkedin.com/in/shivanisundaresan/
Resources:
Download the prompts, code, and episode artifacts from GitHub: https://aka.ms/student-learning-series
Learn more about GitHub Copilot: https://aka.ms/StudentAI-GitHubCopilotApp
Some features and cloud services may have eligibility, usage, or cost limits. Review the current terms before creating resources.
Subscribe to Microsoft Developer for more practical developer and AI learning:
https://www.youtube.com/@MicrosoftDeveloper
#GitHubCopilot #PromptEngineering #AITools Read More Microsoft Developer