Engineer Prompts for Performance
Unlock the complete study guide.
Bundled into the existing GitHub Copilot premium course — no separate purchase.
14-day money-back guarantee — no questions asked.
Included in this chapter:
- The assembled request: what the model actually receives
- The chat prompt process flow
- Context that changes while the prompt stays the same
- Context sources by Copilot surface
- Selecting context: indexing, discovery and #-mentions
- One context window for every source
- Chat history: session context, not training
- Managing history: four useful moves
- Iterating on a response that missed
- Practice pitfalls: prompt performance
Four useful moves for managing chat history
| Aspect | Follow-up prompt | Delete a turn | Compaction | New session |
|---|---|---|---|---|
| Use when | The next request builds on earlier turns | A turn is stale or led to a failed result | The same task continues but history has grown large | You switch to an unrelated task |
| What happens to earlier history | Earlier turns can resolve references, unless compacted or omitted | That request and response are removed from the chat history (which is sent with later requests) | Older turns are replaced by a summary | History is not automatically shared with a new chat |
| Main risk | Stale or unrelated turns keep competing for context | Removing a turn that later prompts still refer to | Earlier details may be summarized or omitted | Decisions you still need must be supplied again |
Decision tree
Cheat sheet
Unlock with Premium — includes all practice exams and the complete study guide.
Also tested in
References
- https://docs.github.com/en/copilot/how-tos/manage-your-account/manage-policies
- https://code.visualstudio.com/docs/agents/concepts/context
- https://learn.microsoft.com/en-us/credentials/certifications/resources/study-guides/gh-300
- https://code.visualstudio.com/docs/agents/concepts/agents
- https://docs.github.com/en/copilot/concepts/prompting/prompt-engineering
- https://docs.github.com/en/copilot/responsible-use/chat
- https://code.visualstudio.com/docs/agent-customization/custom-agents
- https://code.visualstudio.com/docs/agents/concepts/language-models
- https://github.blog/changelog/2026-05-18-ask-questions-in-context-with-copilot-on-web/
- https://code.visualstudio.com/docs/chat/copilot-chat-context
- https://docs.github.com/en/copilot/tutorials/optimize-ai-usage
- https://docs.github.com/en/copilot/tutorials/optimize-chat-usage
- https://code.visualstudio.com/docs/agents/concepts/sessions
- https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions
- https://code.visualstudio.com/docs/agents/guides/get-agent-back-on-track
- https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference
- https://docs.github.com/en/copilot/concepts/agents/copilot-cli/context-management
- https://code.visualstudio.com/docs/copilot/prompt-crafting
- https://docs.github.com/en/copilot/get-started/best-practices