5.1.4. Best Practices for Prompt Crafting
💡 First Principle: Good prompting is iterative: you rarely nail it on the first try, so the real skill is refining — adding context, tightening specificity, breaking down the task — based on what Copilot returns.
GitHub's documented best practices distill to a handful of moves the exam expects you to recognize:
- Be specific and unambiguous — state the goal, types, constraints, and output format.
- Provide relevant context — open the right files, select the relevant code, reference the right symbols.
- Break complex tasks into simpler ones — ask for a plan or sub-steps rather than one giant request.
- Give examples when format matters — few-shot for specific patterns.
- Start general, then refine — set direction, then get precise.
- Iterate — treat the first suggestion as a draft; refine the prompt or context and try again.
- Follow good coding practices — well-named functions and clear surrounding code improve suggestions, because the model completes the document you give it.
A scenario: a developer asks Copilot to "build the whole feature" and gets a sprawling, half-right result. Breaking it into "scaffold the data model," then "add the service," then "write the tests" produces tighter, reviewable suggestions at each step.
✅ Best Practice: When a suggestion misses, don't immediately hand-fix it. Ask why the context led there and adjust the prompt or workspace — that both fixes the result and teaches you how Copilot reads your code.
⚠️ Exam Trap: The best response to a poor suggestion is usually to refine the prompt or context, not to conclude Copilot "can't do it" or to switch tools. Iteration is the documented best practice.
Reflection Question: Why does breaking a large request into smaller prompts typically outperform one big prompt, and how does that connect to the model's context window from Phase 4?