Study FAQ
Which Copilot Chat shortcuts can I use to explain, fix, test or document code?
Also asked as 2
- Where are /explain, /fix, /tests and /doc documented for Copilot Chat?
- How do the common code-oriented Copilot Chat slash commands differ by client?
Answer
Use these shortcuts in a client that documents them, with the relevant active or selected code. They are code-oriented Copilot Chat commands, not a universal command set for the Copilot app, CLI or browser.
| Shortcut | Purpose | Clients explicitly listing it in GitHub's multi-client cheat sheet |
|---|---|---|
/explain |
Explain active or selected code | VS Code, Visual Studio, JetBrains IDEs and Xcode |
/fix |
Propose a fix for selected code or errors | VS Code, Visual Studio, JetBrains IDEs and Xcode |
/tests |
Generate unit tests for selected code | VS Code, Visual Studio, JetBrains IDEs and Xcode |
/doc |
Add or generate symbol documentation | Visual Studio and Xcode |
The VS Code and JetBrains common-command lists do not establish /doc support there; absence from those lists is not proof that a client never supports it. Type / in your actual client's prompt box to inspect currently available commands.
Provide explicit context. In VS Code, #file includes a file and #selection includes selected text; the app's # issue syntax has a different meaning. Also check lifecycle commands by client: the cheat sheet describes VS Code /clear as a new chat and /new as creating a project, while browser /new starts a conversation.
Review a proposed fix and execute generated tests before relying on them. Generating tests does not show that they pass or cover the intended behavior.
References: GitHub Copilot Chat cheat sheet - GitHub Docs.
Full explanation
GH-700: Manage Copilot Sessions and Context Across Clients
Study guide · GH-700
Read the full explanation