Sub topic 3
Choose Between Ask, Edit, and Agent Modes
Assume you can open a VS Code workspace, edit code, and use the Command Palette. You also need an active GitHub Copilot account.
Choose a Chat Mode
Copilot Chat offers different modes for different levels of control:
| Mode | Best for | Typical result |
|---|---|---|
| Ask | Understanding code or exploring ideas | An explanation or suggested code |
| Edit | Applying focused changes | A reviewable edit to selected files |
| Agent | Completing a multi-step task | Edits, commands, and file changes across the workspace |
Use Ask when you want to stay in control. Use Edit when you know which files should change. Use Agent when the task requires several connected steps. Review every proposed change, especially in Agent mode.
Give Chat the Right Context
A useful prompt identifies the file, relevant symbols, constraints, and expected result. References such as #file:utils.ts attach a specific file. Workspace context can help Copilot find related files, but do not assume it understands every project rule.
For example:
Explain what #file:utils.ts does. Suggest a smaller implementation,
but preserve its public function names and existing error behavior.Add Repository Instructions
Save project conventions in .github/copilot-instructions.md. Copilot can use these instructions in future requests.
# Copilot instructions
- Use TypeScript strict mode.
- Avoid `any`.
- Write tests with Vitest.
- Prefer named exports.Keep instructions specific and maintain them like code.
Configure Copilot Per Language
In VS Code settings, enable or disable inline suggestions by language:
{
"github.copilot.enable": {
"*": true,
"plaintext": false,
"markdown": false
}
}Privacy and Troubleshooting
Review Copilot's data-use, telemetry, and content-exclusion settings in your GitHub and VS Code accounts. Exclude secrets, generated files, and sensitive directories where your organization requires it. Never paste credentials into chat.
If suggestions are missing, confirm that you are signed in, Copilot is enabled for the current language, and the extension is current. For failures, check the Output panel for Copilot errors and verify network or proxy access. A workspace policy can also disable features.
Exercise
Which mode should you choose to understand why a function is failing without immediately changing files?
Show answer
Ask mode.