Prompt engineering is the practice of designing and refining instructions for an AI coding assistant. Clear English requests help Copilot produce more relevant code, but precision cannot guarantee correctness: even a careful prompt may produce a mistake. section 1.6 section 3.8
Use an iterative prompt-and-check routine:
- Describe the required task precisely, including the function’s purpose, parameters, and expected result. section 1.6 section 3.8
- Inspect and test the generated code rather than assuming that fluent-looking code is correct. section 1.6 section 6.0
- When the result is wrong or incomplete, identify the problem and revise the prompt; small wording changes can substantially change the output. section 1.6 section 8.3.2
- Test with varied inputs and keep debugging under your own control, so you can judge whether suggested fixes and tests are reasonable. section 3.8 section 6.0
Requesting a more useful explanation
If a general explanation is too vague, replace it with a specific request: “Explain that code again, but do it line by line. Give each line of code and the explanation of what it does.” The revised prompt asks for the level of detail needed to connect each statement with its purpose. section 4.2
/explain
Use the /explain command as a starting point, then craft a more specific prompt when the built-in explanation does not meet your needs. section 4.2





































