skip to content

In VS Code's Copilot Chat, how do a / command like /explain, an @ participant like @terminal and a # mention like #codebase differ?

level: juniorimportance: should knowfreq 14%

answer

  1. three prefixes, three jobs
  2. a command, an expert, a context item
  3. /explain, /fix, /tests, /doc
  4. @vscode, @terminal, @github
  5. a # tool still needs approval

basics

~20 s

A / command runs a task such as /explain or /tests, or a saved prompt. An @ participant hands the question to a domain specialist such as @vscode or @terminal. A # mention adds context or a tool, such as #codebase.

solid answer

~40 s

The prefix says what kind of thing you are invoking. `/` runs a command: the built-ins `/explain`, `/fix` and `/tests` explain code, suggest a fix or generate tests, `/doc` writes documentation comments from editor inline chat, and `/<name>` runs a prompt file or agent skill. `@` addresses a **chat participant**, a specialist for one domain: `@vscode` for editor features and settings, `@terminal` for shell questions, `@github` for repositories, issues and pull requests. They combine, as in `@vscode /search`, which builds a Search view query. `#` attaches context (`#<file>`, a folder, a symbol, `#selection`) or points at a tool such as `#codebase` or `#fetch`. Naming a tool does not bypass its approval controls. The lists depend on the surface, harness and enabled features, so type the prefix to see what is available.

go deeper

for a junior

Recall what each prefix invokes: / runs a command such as /explain, @ picks a specialist such as @vscode, and # adds context or a tool such as #codebase.

for a middle

Explain the details: /doc belongs to editor inline chat, /<name> runs prompt files and skills, participants can be detected without @, and a # tool still goes through approval.

for a senior

Diagnose a prompt that used the wrong prefix, for example @terminal where #terminalSelection was meant, and say why lists differ across harnesses and surfaces.

for a principal

Decide which repeated team requests deserve a saved / command and which should stay ad-hoc prompts with the right # context, given how commands differ between harnesses.

## Three prefixes, three kinds of thing Copilot Chat in VS Code reads three prefixes in the chat input. They look similar but do different jobs, and the question often comes up when a prompt "did nothing special" because it used the wrong one. | Prefix | What it invokes | Examples | What it changes | |---|---|---|---| | `/` | A **command**: a built-in shortcut, a saved prompt file, or an agent skill | `/explain`, `/fix`, `/tests`, `/doc`, `/plan`, `/<name>` | Which task runs | | `@` | A **chat participant**, a specialist for one domain | `@vscode`, `@terminal`, `@github` | Who answers | | `#` | A **context item** or a **tool** | `#<file>`, `#selection`, `#codebase`, `#fetch` | What the model sees or may use | Type any prefix on its own to see what the current session offers. VS Code's reference says availability depends on the chat surface, the harness, the role and the enabled features. ## `/` commands: shortcuts for common tasks VS Code's cheat sheet lists these built-in commands among others: - `/explain`, `/fix`, `/tests`: explain code, suggest a fix, or generate tests. - `/doc`: generate documentation comments, from **editor inline chat**. - `/plan`: research a change and propose an implementation plan. - `/clear`: start a new chat. `/compact`: compact the conversation's context. - `/<name>`: run a **prompt file** or an **agent skill** by its name, e.g. `/webapp-testing` for a skill in `.github/skills/webapp-testing/SKILL.md`. Text after the command is passed along with it, so `/tests for the edge cases around empty carts` narrows the request. ## `@` participants: specialists for one domain A chat participant is a specialist assistant tuned for one area. It answers better in that area because it has that area's context. - `@vscode` knows VS Code's commands, features and settings ("@vscode how to enable word wrapping"). - `@terminal` knows the integrated terminal and its shell ("@terminal what are the top 5 largest files in the current directory"). - `@github` covers repositories, issues and pull requests through GitHub-specific skills, such as a web search. - Extensions can contribute their own participants. Participants and commands combine: `@vscode /search` asks `@vscode` to generate a Search view query. You do not always have to type the name. `chat.detectParticipant.enabled` (default `true`) lets the Chat view detect a participant from your wording, and GitHub's documentation labels that automatic inference a public preview. Participants appear only on chat surfaces that support them. ## `#` mentions: context and tools `#` covers two different things: 1. **Context items** add information without asking for an action: `#<file>`, `#<folder>` and `#<symbol>` chosen from the picker (open the file that contains a symbol first), and `#selection` for the selected text in the editor. 2. **Tools and tool sets** name a capability: `#codebase` runs a semantic search of the workspace, `#fetch` retrieves a web page, and `#search` groups the workspace search tools. Two rules travel with `#`: - **Approval still applies.** VS Code's tools reference says that referencing a tool does not bypass its approval and permission controls. For example, VS Code asks for confirmation before it reaches an external URL through `#fetch`. - **Mentions are explicit, not exclusive.** The active file and selection are still sent implicitly, and an agent can still gather more context on its own. ## The same grammar on the lighter surfaces The prefixes are not only for the Chat view: - **Quick Chat** supports the same `#` and `@` mentions as the Chat view, so `@terminal` or `#<file>` work there for a short question. - **Editor inline chat** is where `/doc` is listed, and a selection there already sets the scope, so you rarely need a `#` mention to point at the code in front of you. - **Saved commands** share the `/` menu. Prompt files and agent skills appear next to the built-ins, so a team's own `/write-tests` sits beside `/tests`. Typing `/` is the quickest way to tell whether a name is built in or one the team added. ## Mixing them up The common mistakes come from treating one prefix as another: - Typing `@terminal` to *attach* terminal output. A participant answers shell questions. To attach terminal output you use a `#` item, such as `#terminalSelection`. - Writing `#explain` or `@fix`. The built-in tasks are `/` commands. - Looking for `/doc` in the Chat view first. VS Code's cheat sheet lists it as a command for editor inline chat, so start it there. When in doubt, type the bare prefix: the picker shows the commands, participants or context items that the current surface and session actually support.

  • How do you see which / commands and @ participants are available in your current Copilot Chat session?
    Type the bare `/` or `@` in the chat input. The picker lists what this surface, harness and session offer. VS Code says availability depends on the surface, harness, role and enabled features, so a list from another setup may not match yours.
  • Can a participant and a command be used together in one Copilot Chat prompt?
    Yes. VS Code's cheat sheet gives `@vscode /search` as an example: the `@vscode` participant handles a `/search` command and generates a Search view query, so you don't have to write the search yourself.

  • Typing @terminal attaches the terminal's output to the prompt as context.
  • Every / command works the same on every chat surface and harness.
  • Writing #fetch in a prompt pre-approves the web request it makes.
  • /doc is a Chat view command that writes a project README.
  • A participant is used only when you type its @ name yourself.