
Visual Studio subscribers get Copilot Free automatically. Monthly limits reset on your billing date. To unlock unlimited completions, sign in with an existing GitHub Copilot subscription.
Core Slash Commands
Use these four slash commands for everyday productivity:| Command | Function | Languages |
|---|---|---|
/doc | Inserts documentation comments (PEP8 in Python; XML/Swagger in C#) | Python, C#, JavaScript, etc. |
/exp | Starts a fresh chat session, clearing prior context | All supported languages |
/explain | Generates a natural-language explanation of selected code | All supported languages |
/fix | Proposes corrections for typos, syntax errors, and logic | All supported languages |

Additional Slash Commands
Beyond the essentials, Copilot offers specialized commands to streamline your workflow:| Command | Description |
|---|---|
/fix-test-failure | Targets failing unit tests and suggests fixes. |
/generate | Creates boilerplate code or full components (e.g., interfaces, views). |
/help | Displays a quick reference of all available slash commands. |
/optimize | Analyzes and suggests performance improvements. |
/test | Auto-generates unit tests (including edge cases) for selected code. |
/clear | Clears the chat context and starts a new session. |
/new | Scaffolds a new project (Flask, React, Vue, Blazor, etc.). |

How to Access Slash Commands
Invoke slash commands in three simple ways:- Type a forward slash (
/) in the Copilot Chat message box. - Click the Slash button in the GitHub Copilot chat pane.
- Use inline chat: press Alt + / (or your custom shortcut), right-click in the editor, and choose Ask Copilot.

Seamless Integration
Whether you prefer a dedicated chat window or inline interactions, slash commands keep you focused:- Dedicated Chat Pane: Maintain a continuous conversation without switching contexts.
- Inline Chat: Invoke Copilot suggestions right beside your code.
- Unified Workflow: Both methods preserve your coding flow and history.

Demo: Slash Commands in Visual Studio
Below is a quick walkthrough showing how slash commands speed up documentation, explanation, and testing tasks.
1. Generate XML Documentation
Open Program.cs, position the cursor, and type:2. Explain Code with /explain
Select a block:
/explain to get a step-by-step breakdown of each API call.
3. Generate Unit Tests with /test
Highlight methods and type:
If you use
/clear, all previous chat history is lost. Make sure to save important context or prompts before resetting.With these slash commands at your fingertips, you can document, explain, fix, test, and optimize your code—all without leaving your editor.