GitHub Copilot Commands & Prompt Reference
31 commands & parameters · 6 categories · Source: GitHub Docs — Copilot Chat cheat sheet
GitHub Copilot Chat exposes different command sets depending on where you run it: VS Code, Visual Studio, JetBrains, Xcode, the GitHub website, and the Copilot CLI each accept their own slash commands, and VS Code adds # chat variables and @ chat participants on top. This page groups the official cheat-sheet commands by client so you can see at a glance what works where.
The highest-leverage habit is scoping context on purpose: #selection or #function keeps the prompt tight, #project trades speed for breadth, and participants like @terminal or @vscode route the question to the right specialist. Slash commands such as /fix, /tests, and /explain then act on exactly the context you attached.
Also see: GitHub Copilot keyboard shortcuts.
All Commands
Slash Commands & Prompts (VS Code) (7)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /clear | Start a new chat session | Clears the current Copilot Chat conversation in VS Code. |
| /explain | Explain how the code in your active editor works | Select code first for a focused explanation. |
| /fix | Propose a fix for problems in the selected code | Highlight the broken code, then run the command. |
| /fixTestFailure | Find and fix a failing test | Copilot locates the failing test and proposes a repair. |
| /help | Quick reference and basics of using GitHub Copilot | Lists available commands and usage basics. |
| /new | Create a new project | Scaffolds a new workspace from your description. |
| /tests | Generate unit tests for the selected code | Select a function or class before running. |
Chat Variables (#) Prompts (VS Code) (10)
| Command / Syntax | What it does | Notes |
|---|---|---|
| #block | Include the current block of code in the prompt | Type # in the chat box, then the variable name. |
| #class | Include the current class in the prompt | Scopes the context to the enclosing class. |
| #comment | Include the current comment in the prompt | Useful when iterating on a doc comment. |
| #file | Include the current file's content in the prompt | Attaches the whole active file as context. |
| #function | Include the current function or method in the prompt | Scopes the context to the enclosing function. |
| #line | Include the current line of code in the prompt | Narrowest context scope available. |
| #path | Include the file path in the prompt | Passes the location, not the contents. |
| #project | Include the project context in the prompt | Broadest scope; slower but most informed. |
| #selection | Include the currently selected text in the prompt | Select first, then reference #selection. |
| #sym | Include the current symbol in the prompt | Targets the symbol under the cursor. |
Chat Participants (@) Prompts (4)
| Command / Syntax | What it does | Notes |
|---|---|---|
| @azure | Context about Azure services: use, deploy, and manage them | Public preview; subject to change. |
| @github | Use GitHub-specific Copilot skills | Bridges chat to GitHub skills from the IDE. |
| @terminal | Context about the VS Code terminal shell and its contents | Ask it to create or debug terminal commands. |
| @vscode | Context about VS Code commands and features | Ask how to do something in the editor itself. |
Slash Commands (GitHub.com Chat) (4)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /clear | Clear conversation (GitHub.com) | Runs in Copilot Chat on the GitHub website. |
| /delete | Delete a conversation | Removes the conversation from your history. |
| /new | Start a new conversation (GitHub.com) | Opens a fresh chat thread. |
| /rename | Rename a conversation | Give threads descriptive names for later. |
Slash Commands (Visual Studio & Xcode) (3)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /doc | Add a documentation comment for this symbol | Cursor must be on the symbol to document. |
| /optimize | Analyze and improve running time of the selected code | Select the hot path first. |
| /simplify | Simplify the current code selection | Available in Copilot for Xcode. |
Slash Commands (JetBrains & Copilot CLI) (3)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /chronicle | Review and analyze your session history | Subcommands: standup, tips, search, improve. |
| /compact | Compress the current Copilot CLI session context | Keeps a long-running session manageable. |
| /remote | Enable or manage remote control for the current CLI session | Access the session from GitHub.com or GitHub Mobile. |
Frequently Asked Questions
Why do the slash commands differ between editors?
Each Copilot client ships its own command set. The official cheat sheet documents them separately for VS Code, Visual Studio, JetBrains, Xcode, the GitHub website, and the Copilot CLI, which is how this page groups them.
What is the difference between # variables and @ participants?
# variables attach a scope of code as context (#selection, #file, #project). @ participants route the question to a specialist with its own knowledge, such as @terminal or @vscode.
How do I list the commands available right now?
Type / in the chat prompt box of your current environment. The live list reflects your client and context.
Every entry on this page is a literal, typeable token taken from the official documentation linked above. Command sets in AI tools change quickly - the in-product command menu is always authoritative for your installed version.