GH-300 - Apply prompt engineering and context crafting (13% of the exam) - 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.

Exam traps in Apply prompt engineering and context crafting

Answers that look right on this material and are not. Each one is a distractor from a different question in the GH-300 bank for this domain.

  • Copilot retains the most-edited file of the day in a persistent cache that quietly overrides the current file's context.

    Why it is wrong: There is no persistent most-edited cache that overrides the current file; the influence comes from the file still being open in a tab.

  • Add a content exclusion rule for the new module so that Copilot is forced to treat its functions as the preferred source for inline suggestions.

    Why it is wrong: Content exclusions stop named files being used as context; excluding the new module would remove it from suggestions rather than make Copilot follow it.

  • The full commit history of the repository, which Copilot reads end to end so that every past change shapes each inline completion it offers.

    Why it is wrong: Tempting because history holds project knowledge, but Copilot does not scan the entire commit log for inline context; it draws on the code currently open in the editor.

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