GitHub Copilot Commands & Prompt Reference
Copilot Chat commands grouped by client, checked on 2026-10-10 against the GitHub Docs Copilot Chat cheat sheet and the VS Code 1.141 docs dated 2026-10-07. VS Code has the longest list: slash commands, customization commands and # references. GitHub still lists variables such as #block for VS Code, while the VS Code reference names #selection, file and symbol references and tools like #search/codebase. Keyboard shortcuts and the standalone Copilot CLI command list are left out.
Also see: GitHub Copilot keyboard shortcuts.
All Commands
Slash commands in VS Code (15)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /plan | Plan before coding | Researches the change and proposes steps, so you can review the approach before any code is edited. |
| /explain | Explain editor code | Visual Studio and JetBrains list it too; the Xcode version explains the selected code instead. |
| /fix | Suggest a fix | Acts on the selected code; in Xcode it suggests fixes for typos as well as code errors. |
| /tests | Write unit tests | Select the code to test first; Visual Studio, JetBrains and Xcode accept the same command. |
| /fixTestFailure | Repair a failing test | Outside chat, the VS Code Test Explorer has a Fix Test Failure action for the same job. |
| /help | Show Copilot help | VS Code answers with the commands and agents you can use in a local Ask chat; Visual Studio and JetBrains list it too. |
| /clear | Start over in a new chat | The chat you leave is archived or marked as done. |
| /new | Scaffold a workspace or file | Use /newNotebook when you want a notebook; the GitHub cheat sheet describes /new as creating a project. |
| /newNotebook | Scaffold a notebook | Creates a notebook rather than a workspace; an agent can then edit and run its cells. |
| /fork | Branch the conversation | The branch starts with the full history of the original conversation. |
| /rename <name> | Rename a local chat | Type the new title after the command; only local chats can be renamed this way. |
| /models | Open the model picker | Switching the model leaves the agent harness as it is. |
| /tools | Choose tools for the chat | Agents choose tools by themselves; this sets which ones a local chat may call. |
| /troubleshoot | Analyze agent debug logs | Runs in a local session or in a Copilot CLI session. |
| /debug | Show the Chat Debug view | Use it from the Chat view; the Agents window does not accept it. |
Customizing agents in VS Code (7)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /init | Write workspace instructions | Creates or refreshes the workspace instructions; available in a local agent session. |
| /instructions | Manage instruction files | Instruction files carry coding standards, architecture notes and test commands so prompts need not repeat them. |
| /prompts | Manage prompt files | Prompt files are saved prompts that you then run on demand as their own slash commands. |
| /skills | Manage agent skills | A skill packages a workflow with scripts or examples and loads when relevant or by name. |
| /agents | Manage custom agents | A custom agent defines a role with its own tool selection, for example a read-only reviewer. |
| /hooks | Manage agent hooks | Hooks run a command at a fixed point in the agent lifecycle instead of relying on instructions. |
| /<name> | Run a skill or saved prompt | A skill stored in .github/skills/webapp-testing/SKILL.md, for example, runs as /webapp-testing. |
Context references in VS Code (13)
| Command / Syntax | What it does | Notes |
|---|---|---|
| #selection | Attach the selected text | Only offered while text is selected in the editor. |
| #<file> | Attach a file | Type # and part of the file name, then pick the file from the list. |
| #<folder> | Attach a folder | Works like a file reference but brings a whole folder into the prompt. |
| #<symbol> | Attach a code symbol | The file that defines the symbol has to be open before it can be picked. |
| #search/codebase | Find relevant workspace code | Part of the #search tool set, which also covers text, file and usage searches. |
| #search/changes | List source control changes | |
| #search/usages | Find symbol references | Covers implementations and definitions too, not only the places a symbol is used. |
| #read/problems | Read Problems panel diagnostics | Points the agent at compiler or lint errors that VS Code already reports. |
| #execute/testFailure | Get test failure details | Gives the agent the unit test failure details instead of your summary of them. |
| #read/terminalLastCommand | Read the last terminal command | Brings in what the command printed as well as the command line itself. |
| #read/terminalSelection | Read selected terminal text | Select part of the terminal output first; only that part is attached. |
| #web/fetch | Fetch a web page | Belongs to the #web tool set, which gives the agent access to web content. |
| #githubRepo | Search a GitHub repository | Name the repository as owner/repo; the search goes by meaning, not keywords. |
Chat variables (GitHub cheat sheet) (9)
| Command / Syntax | What it does | Notes |
|---|---|---|
| #block | Attach the current code block | Type # in the chat box, then the variable name. |
| #class | Attach the current class | Scopes the context to the enclosing class. |
| #comment | Attach the current comment | |
| #file | Attach the current file | Sends the file content, where #path sends only its location. |
| #function | Attach the current function | Works for a method as well as a standalone function. |
| #line | Attach the current line | Narrower than #block: just the one line of code. |
| #path | Attach the file path | Passes the location, not the contents. |
| #project | Attach project context | The widest scope in this list, beyond any single file. |
| #sym | Attach the current symbol | The VS Code reference writes symbol references as # followed by the symbol name. |
Chat participants (5)
| Command / Syntax | What it does | Notes |
|---|---|---|
| @azure | Ask about Azure services | Still in public preview, so its behaviour may change. |
| @github | Use GitHub-specific skills | The VS Code docs point to it for repositories, issues and pull requests. |
| @terminal | Ask about the terminal | Suits writing or debugging shell commands without leaving the chat. |
| @vscode | Ask about VS Code itself | Covers editor commands, features and settings rather than your code. |
| @vscode /search | Build a Search view query | Turns a plain description into a query for the VS Code Search view. |
Slash commands on GitHub.com (4)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /clear | Clear the conversation | Runs in Copilot Chat on the GitHub website, where /delete removes a conversation instead. |
| /delete | Delete a conversation | Removes the conversation from your history. |
| /new | Start a new conversation | On GitHub.com this opens a fresh thread; in VS Code /new scaffolds a project instead. |
| /rename | Rename a conversation | Give threads descriptive names for later. |
Slash commands in Visual Studio and Xcode (3)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /doc | Document this symbol | Visual Studio adds a doc comment and Xcode writes documentation; VS Code offers it from inline chat. |
| /optimize | Speed up selected code | Visual Studio only; it looks at the running time of the code you select. |
| /simplify | Simplify selected code | Listed for Copilot in Xcode, where it works on the current selection. |
Slash commands in JetBrains and Copilot CLI (3)
| Command / Syntax | What it does | Notes |
|---|---|---|
| /chronicle | Review session history | Accepts standup, tips, search and improve as subcommands. |
| /compact | Shrink CLI session context | VS Code chat accepts /compact as well for a long conversation. |
| /remote | Control a CLI session remotely | Works only in Copilot CLI sessions; you then follow the session on GitHub.com or in GitHub Mobile. |
Recipes
Copilot Chat commands and context references used together: planning a change, grounding a request, fixing a failing test, terminal help and long sessions.
Plan a complex change before any edits
/plan → review the plan → ask the agent to implement it
The VS Code docs suggest plan, implement, verify, review for larger changes. /plan researches the change and proposes the steps, and you review the approach before an implementation agent touches the code.
Ground the request in the code that matters
#selection or #<symbol> → /fix
Attaching the selection or a symbol gives Copilot the exact code instead of a description of it. The same goes for errors: #read/problems hands over the diagnostics VS Code already shows.
Fix a failing test from the failure itself
/fixTestFailure or #execute/testFailure → state what must not change
/fixTestFailure finds the failing test for you. In an agent session, #execute/testFailure attaches the failure details, and the request can add the constraint (keep the expected behaviour) and ask for the tests to be run again.
Get a terminal command without leaving the editor
@terminal → describe the command you need
@terminal has context about the terminal shell and its contents, so it suits creating or debugging shell commands. Add #read/terminalLastCommand when the last command failed and its output matters.
Keep a long session workable
/compact or /fork or /clear
/compact shrinks the context of a long session, in a Copilot CLI session as well as in VS Code chat. In VS Code, /fork branches the conversation with its history, and /clear starts over when the next task is unrelated. In a CLI session, /chronicle reviews the session history afterwards.
Frequently Asked Questions
Why do the slash commands differ between editors?
Each Copilot client ships its own command set. The GitHub cheat sheet has separate tabs for VS Code, Visual Studio, JetBrains IDEs, Xcode and the GitHub website, and the VS Code docs list more commands for VS Code chat. A command several clients share appears once on this page, with the other clients named in its note.
What is the difference between # references and @ participants?
# references attach context or point the agent at a tool, such as #selection, a file, or #search/codebase. @ participants route the question to a specialist with its own knowledge, such as @terminal or @vscode.
Why do the GitHub and VS Code lists of # variables differ?
The GitHub cheat sheet lists #block, #class, #function and similar variables under VS Code, while the VS Code tools and context reference (version 1.141) lists #selection, file, folder and symbol references and tool names instead. This page shows both lists; type # in the chat input to see what your build accepts.
How do I list the commands available right now?
Type / in the chat prompt box of your current environment; the list depends on the client, the session and the features you have enabled. Type # for context references and @ for participants.
Sources and checks
- GitHub Docs — GitHub Copilot Chat cheat sheet, all client tabs (page of 2026-10-06; unchanged in github/docs main on 2026-10-10) Slash commands for VS Code, Visual Studio, JetBrains IDEs, Xcode and GitHub.com; the VS Code chat variables and participants
- VS Code docs, version 1.141 (page dated 2026-10-07) — AI features cheat sheet, chat reference VS Code chat slash commands, customization commands and the @vscode /search example
- VS Code docs, version 1.141 (page dated 2026-10-07) — Tools and context reference # context items and tool references in VS Code chat
Every row on this page was matched to a line in the documentation above on . A command or parameter that could not be found there is not listed.
AI tools change their commands, parameters and model names between releases: the vendor's current documentation and the version you run have the last word. Found a wrong or missing entry? Tell us and it gets checked against the source. How we verify describes the process and its limits.
Related prompt references
Cursor (72) · Claude Code (157) · OpenAI Codex CLI (49) · All AI prompt references