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 / SyntaxWhat it doesNotes
/clearStart a new chat sessionClears the current Copilot Chat conversation in VS Code.
/explainExplain how the code in your active editor worksSelect code first for a focused explanation.
/fixPropose a fix for problems in the selected codeHighlight the broken code, then run the command.
/fixTestFailureFind and fix a failing testCopilot locates the failing test and proposes a repair.
/helpQuick reference and basics of using GitHub CopilotLists available commands and usage basics.
/newCreate a new projectScaffolds a new workspace from your description.
/testsGenerate unit tests for the selected codeSelect a function or class before running.

Chat Variables (#) Prompts (VS Code) (10)

Command / SyntaxWhat it doesNotes
#blockInclude the current block of code in the promptType # in the chat box, then the variable name.
#classInclude the current class in the promptScopes the context to the enclosing class.
#commentInclude the current comment in the promptUseful when iterating on a doc comment.
#fileInclude the current file's content in the promptAttaches the whole active file as context.
#functionInclude the current function or method in the promptScopes the context to the enclosing function.
#lineInclude the current line of code in the promptNarrowest context scope available.
#pathInclude the file path in the promptPasses the location, not the contents.
#projectInclude the project context in the promptBroadest scope; slower but most informed.
#selectionInclude the currently selected text in the promptSelect first, then reference #selection.
#symInclude the current symbol in the promptTargets the symbol under the cursor.

Chat Participants (@) Prompts (4)

Command / SyntaxWhat it doesNotes
@azureContext about Azure services: use, deploy, and manage themPublic preview; subject to change.
@githubUse GitHub-specific Copilot skillsBridges chat to GitHub skills from the IDE.
@terminalContext about the VS Code terminal shell and its contentsAsk it to create or debug terminal commands.
@vscodeContext about VS Code commands and featuresAsk how to do something in the editor itself.

Slash Commands (GitHub.com Chat) (4)

Command / SyntaxWhat it doesNotes
/clearClear conversation (GitHub.com)Runs in Copilot Chat on the GitHub website.
/deleteDelete a conversationRemoves the conversation from your history.
/newStart a new conversation (GitHub.com)Opens a fresh chat thread.
/renameRename a conversationGive threads descriptive names for later.

Slash Commands (Visual Studio & Xcode) (3)

Command / SyntaxWhat it doesNotes
/docAdd a documentation comment for this symbolCursor must be on the symbol to document.
/optimizeAnalyze and improve running time of the selected codeSelect the hot path first.
/simplifySimplify the current code selectionAvailable in Copilot for Xcode.

Slash Commands (JetBrains & Copilot CLI) (3)

Command / SyntaxWhat it doesNotes
/chronicleReview and analyze your session historySubcommands: standup, tips, search, improve.
/compactCompress the current Copilot CLI session contextKeeps a long-running session manageable.
/remoteEnable or manage remote control for the current CLI sessionAccess 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.