A developer is writing a Python module and wants Copilot to generate a complete function body from a clear description before they write any code. Which prompting practice gives Copilot the best chance of generating an accurate first draft?
- AType only the keyword def on a blank line with no name or parameters, so Copilot is free to invent the whole function from scratch without constraints.
- BOpen a pull request first so Copilot code review can read the diff and then suggest the missing function body back inside the local editor for you.
- CAdd a content exclusion entry for the file, because Copilot only generates a full function body once the path has been declared as excluded in settings.
- DWrite a descriptive function signature and a short comment stating the inputs, the expected output, and an example, then let Copilot complete the body. Correct
Why A is wrong: Tempting as minimal effort, but with no name, parameters, or intent Copilot lacks context and is far more likely to produce an irrelevant or generic body.
Why B is wrong: Wrong surface: code review comments on existing diffs in a pull request and does not author a brand new function body in the editor before code exists.
Why C is wrong: Content exclusions stop named files being used as context; they do not trigger generation and would actually reduce the context available to Copilot.
Why D is correct: Correct: a clear signature plus a comment describing inputs, output, and an example gives Copilot the specific context it needs to generate an accurate body.