GitHub Copilot Commands & Prompt Reference

59 commands & parameters · 8 categories · Sources: GitHub Docs — GitHub Copilot Chat cheat sheet, all client tabs (page of 2026-10-06; unchanged in github/docs main on 2026-10-10) and 2 more · Checked

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 / SyntaxWhat it doesNotes
/planPlan before codingResearches the change and proposes steps, so you can review the approach before any code is edited.
/explainExplain editor codeVisual Studio and JetBrains list it too; the Xcode version explains the selected code instead.
/fixSuggest a fixActs on the selected code; in Xcode it suggests fixes for typos as well as code errors.
/testsWrite unit testsSelect the code to test first; Visual Studio, JetBrains and Xcode accept the same command.
/fixTestFailureRepair a failing testOutside chat, the VS Code Test Explorer has a Fix Test Failure action for the same job.
/helpShow Copilot helpVS Code answers with the commands and agents you can use in a local Ask chat; Visual Studio and JetBrains list it too.
/clearStart over in a new chatThe chat you leave is archived or marked as done.
/newScaffold a workspace or fileUse /newNotebook when you want a notebook; the GitHub cheat sheet describes /new as creating a project.
/newNotebookScaffold a notebookCreates a notebook rather than a workspace; an agent can then edit and run its cells.
/forkBranch the conversationThe branch starts with the full history of the original conversation.
/rename <name>Rename a local chatType the new title after the command; only local chats can be renamed this way.
/modelsOpen the model pickerSwitching the model leaves the agent harness as it is.
/toolsChoose tools for the chatAgents choose tools by themselves; this sets which ones a local chat may call.
/troubleshootAnalyze agent debug logsRuns in a local session or in a Copilot CLI session.
/debugShow the Chat Debug viewUse it from the Chat view; the Agents window does not accept it.

Customizing agents in VS Code (7)

Command / SyntaxWhat it doesNotes
/initWrite workspace instructionsCreates or refreshes the workspace instructions; available in a local agent session.
/instructionsManage instruction filesInstruction files carry coding standards, architecture notes and test commands so prompts need not repeat them.
/promptsManage prompt filesPrompt files are saved prompts that you then run on demand as their own slash commands.
/skillsManage agent skillsA skill packages a workflow with scripts or examples and loads when relevant or by name.
/agentsManage custom agentsA custom agent defines a role with its own tool selection, for example a read-only reviewer.
/hooksManage agent hooksHooks run a command at a fixed point in the agent lifecycle instead of relying on instructions.
/<name>Run a skill or saved promptA skill stored in .github/skills/webapp-testing/SKILL.md, for example, runs as /webapp-testing.

Context references in VS Code (13)

Command / SyntaxWhat it doesNotes
#selectionAttach the selected textOnly offered while text is selected in the editor.
#<file>Attach a fileType # and part of the file name, then pick the file from the list.
#<folder>Attach a folderWorks like a file reference but brings a whole folder into the prompt.
#<symbol>Attach a code symbolThe file that defines the symbol has to be open before it can be picked.
#search/codebaseFind relevant workspace codePart of the #search tool set, which also covers text, file and usage searches.
#search/changesList source control changes
#search/usagesFind symbol referencesCovers implementations and definitions too, not only the places a symbol is used.
#read/problemsRead Problems panel diagnosticsPoints the agent at compiler or lint errors that VS Code already reports.
#execute/testFailureGet test failure detailsGives the agent the unit test failure details instead of your summary of them.
#read/terminalLastCommandRead the last terminal commandBrings in what the command printed as well as the command line itself.
#read/terminalSelectionRead selected terminal textSelect part of the terminal output first; only that part is attached.
#web/fetchFetch a web pageBelongs to the #web tool set, which gives the agent access to web content.
#githubRepoSearch a GitHub repositoryName the repository as owner/repo; the search goes by meaning, not keywords.

Chat variables (GitHub cheat sheet) (9)

Command / SyntaxWhat it doesNotes
#blockAttach the current code blockType # in the chat box, then the variable name.
#classAttach the current classScopes the context to the enclosing class.
#commentAttach the current comment
#fileAttach the current fileSends the file content, where #path sends only its location.
#functionAttach the current functionWorks for a method as well as a standalone function.
#lineAttach the current lineNarrower than #block: just the one line of code.
#pathAttach the file pathPasses the location, not the contents.
#projectAttach project contextThe widest scope in this list, beyond any single file.
#symAttach the current symbolThe VS Code reference writes symbol references as # followed by the symbol name.

Chat participants (5)

Command / SyntaxWhat it doesNotes
@azureAsk about Azure servicesStill in public preview, so its behaviour may change.
@githubUse GitHub-specific skillsThe VS Code docs point to it for repositories, issues and pull requests.
@terminalAsk about the terminalSuits writing or debugging shell commands without leaving the chat.
@vscodeAsk about VS Code itselfCovers editor commands, features and settings rather than your code.
@vscode /searchBuild a Search view queryTurns a plain description into a query for the VS Code Search view.

Slash commands on GitHub.com (4)

Command / SyntaxWhat it doesNotes
/clearClear the conversationRuns in Copilot Chat on the GitHub website, where /delete removes a conversation instead.
/deleteDelete a conversationRemoves the conversation from your history.
/newStart a new conversationOn GitHub.com this opens a fresh thread; in VS Code /new scaffolds a project instead.
/renameRename a conversationGive threads descriptive names for later.

Slash commands in Visual Studio and Xcode (3)

Command / SyntaxWhat it doesNotes
/docDocument this symbolVisual Studio adds a doc comment and Xcode writes documentation; VS Code offers it from inline chat.
/optimizeSpeed up selected codeVisual Studio only; it looks at the running time of the code you select.
/simplifySimplify selected codeListed for Copilot in Xcode, where it works on the current selection.

Slash commands in JetBrains and Copilot CLI (3)

Command / SyntaxWhat it doesNotes
/chronicleReview session historyAccepts standup, tips, search and improve as subcommands.
/compactShrink CLI session contextVS Code chat accepts /compact as well for a long conversation.
/remoteControl a CLI session remotelyWorks 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

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