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

Explain prompt engineering principles, the prompt process flow, and how chat history is used.

Explain the principles behind prompt engineering for GitHub Copilot, the prompt process flow from intent to response, and how chat history and prior turns are used to refine answers. Use iterative prompting and follow-up turns to improve a result.

Prompt process flowChat historyIterative promptingPrompt engineering principles

Practice question for this objective

Free sampleApply prompt engineering and context craftingmedium

A developer asks Copilot Chat to refactor a function, then sends a one-line follow-up reading now also add retry handling without naming the function again, and Copilot correctly applies it to the same function. Which aspect of the prompt process flow best explains why the follow-up landed on the right target?

  • AThe model was trained on this developer's prior sessions, so it has learned which function they usually mean when they omit the name in a request.
  • BCopilot permanently remembers the function across all conversations once it has been refactored, so any later thread can refer to it without naming it again.
  • CChat history carries the earlier turns into the new prompt, so the previously discussed function remains in context and resolves the unnamed reference. Correct
  • DThe follow-up triggers a fresh repository-wide scan that re-identifies the only function recently refactored, independent of anything said earlier in the thread.
Chat history feeds earlier turns into each new prompt, which is how an unnamed follow-up reference resolves to the right subject. Within one Copilot Chat conversation, prior turns are included as context when the next prompt is assembled. That history lets Copilot resolve a pronoun or unnamed target to the function discussed earlier, without persistence across threads or any model training on the developer's data.

Why A is wrong: Tempting because it sounds adaptive, but Business and Enterprise prompts are not used to train the model, and resolution relies on in-thread history.

Why B is wrong: Tempting because memory sounds plausible, but history is scoped to the single thread and does not persist across separate conversations.

Why C is correct: Correct: conversation history supplies the prior turns as context, letting Copilot resolve now to the function established earlier in the thread.

Why D is wrong: Tempting because Copilot does use repository context, but the resolution here comes from the conversation turns, not a special scan tied to refactoring.

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.