GH-300 - Apply prompt engineering and context crafting - Section 4.1

Craft prompts with clear structure and context, and explain how Copilot determines context.

Write prompts with clear intent, structure, and supporting context, and explain how GitHub Copilot determines context from open files, the selection, neighbouring tabs, and chat history. Use that knowledge to give Copilot the context it needs for a relevant suggestion.

Prompt structureContextOpen filesNeighbouring tabs

Practice question for this objective

Free sampleApply prompt engineering and context craftingmedium

A developer hears that neighbouring tabs influence Copilot's inline suggestions and wants to understand the mechanism. Which statement best describes how neighbouring tabs contribute to context?

  • ANeighbouring tabs are uploaded to train the underlying model, so over time the suggestions in the active file reflect what was learned from those tabs.
  • BCopilot looks at relevant code in the developer's other open tabs and uses it as additional context when generating suggestions for the active file. Correct
  • CNeighbouring tabs are scanned only after a content exclusion rule names them, because tabs are otherwise blocked from contributing any inline context.
  • DNeighbouring tabs matter only on a Copilot Enterprise seat, where the editor is permitted to read more than the single file currently in focus.
Explain that neighbouring tabs supply relevant code from other open files as additional live context for Copilot suggestions. The neighbouring tabs technique lets Copilot use relevant code from the developer's other open files as additional context for the active file, improving suggestion relevance in real time. This is live context use, not model training, and it is not gated behind exclusions or a particular plan tier.

Why A is wrong: Copilot Business and Enterprise content is not used to train the models, and neighbouring tabs inform live context rather than being absorbed into training.

Why B is correct: Correct: neighbouring tabs hold other open files whose relevant code Copilot draws on as nearby context, sharpening suggestions in the file being edited.

Why C is wrong: Content exclusions remove files from context rather than enable tabs; open tabs contribute context by default without any exclusion rule being declared.

Why D is wrong: Using nearby open tabs for context is part of the core editor experience across plans and is not a capability gated behind a Copilot Enterprise seat.

See more GH-300 practice questions, answers explained.

More in this domain

Back to all Apply prompt engineering and context crafting objectives, or the GH-300 cert hub.

Examworthy is not affiliated with or endorsed by GitHub. Original, blueprint-aligned practice material only.