The Secret of Breath — Rediscover the sacred rhythm of your breath. Cultivate inner silence that brings clarity, balance, and resilience in daily life.


Understand GitHub Copilot Extensions and Slash Commands

In the previous article, you learned the basics of GitHub Copilot Chat window. Once you've grasped how GitHub Copilot Chat fits into your development environment, it's time to unlock the finer tools that can amplify its capabilities: Copilot Extensions (chat participants) and Slash Commands.

Copilot Extensions — accessed through contextual tags like @workspace or @terminal — help you guide Copilot's attention to specific parts of your environment. Meanwhile, slash commands such as /explain, /fix, or /tests turn broad intentions into clear, executable prompts. These features aren't just about syntax — they're how you shape Copilot into a proactive, responsive coding partner. In this article, we'll explore how extensions and commands combine to create a smarter, smoother development experience.

One of the most powerful ways to interact with GitHub Copilot Chat is by tagging specific extensions using the @ symbol. These act like domain-aware guides, helping Copilot focus its attention on a particular scope — whether that's the project structure, terminal output, or something else entirely.

For example :

  • @workspace lets Copilot reference the entire codebase.
  • @terminal pulls context from command-line activity.
  • @vscode taps into editor state like open files or diagnostics.
By using these tags, you're not just asking a question — you're pinpointing where the answer should come from. Think of it as inviting the right expert into the conversation. Want to know why a build failed? Ask @terminal. Curious about the purpose of a file? Ping @workspace. Wondering which extensions might be slowing things down? Nudge @vscode. These extensions act as context filters, reducing noise and improving the quality of Copilot's responses. You can mix them with plain questions, or pair them with slash commands for ultra-precise results.

Let's look at some examples of how to use these extensions:

We created an ASP.NET Core project in the previous parts. Open that project folder in VS Code. Also open Launch Copilot Chat. In the chat window as you type @ you will get a list of extensions.

Either select @workspace from the list or type it out. After that, type a questions about your project such as :

@workspace how many view files are there in this project

This is what Copilot will respond with :

As you might have guessed, @workspace gives Copilot access to your entire codebase context, making it ideal for architectural insights or onboarding help.

Let's try something else.

Open _ViewImports.cshtml and comment these two lines:

@using GitHubCopilotDemo
@using GitHubCopilotDemo.Models

These are the namespaces that are needed to compile the project successfully. But since we commented them, the build will fail with errors like this:

We will ask @terminal extension to explain why the build failed.

Enter this in Copilot chat:

@terminal explain the error from the last build attempt

Copilot will respond with an explanation of the error and suggest a fix:

As you might have guessed, @terminal reads recent command-line output, making it perfect for debugging workflows and CI/CD issues.

Now that you have some idea of what Copilot extensions can do, let's look at how to use slash commands to refine your interactions.

While extensions help Copilot understand where to look, slash commands tell it what to do. These intuitive triggers — typed as /command — unlock specific behaviors like explaining code, fixing bugs, writing tests, and more.

Some common slash commands include:

  • /explain — break down selected code into plain English
  • /fix — suggest corrections for a bug or error
  • /tests — generate unit tests based on logic and edge cases

What makes them powerful is that they're context-aware: highlight a problematic function, type /fix, and Copilot will scan the surroundings before proposing changes. No need to phrase a detailed request — the command itself is enough.

You can also combine commands with extensions for laser-focused help. For instance:

@workspace /explain how this class interacts with the database 
@terminal /fix the error from last build    

Slash commands feel almost magical when paired with natural language. They're fast, adaptable, and perfect for tackling micro-tasks without breaking your workflow.

Let's see a few examples of how to use slash commands.

Open HomeController.cs and modify the Index() action with this code:

public IActionResult Index()
{
    int numberOfIterations = 10000;
    string result = string.Empty;
    for (int i = 0; i < numberOfIterations; i++)
    {
        result += "Item " + i.ToString() + ", ";
    }
    ViewBag.Result = result;
    return View();
}    

Notice the code shown in bold letters. It's inefficient piece code. Select this code in VS Code editor and issue /optimize command in Copilot chat. See the response below:

Copilot will review the selected code and suggest performance improvements such as using StringBuilder for concatenation. /optimize command is tuned for performance analysis, making it ideal for refining critical code or resource-intensive logic.

Let's see another slash command in action.

Open HomeController.cs again and select the optimized Index() action. Then issue /doc command in Copilot chat.

/doc helps maintain clean, self-explanatory code. Copilot will generate a documentation comment block — typically in the format used by your coding language (e.g., XML, JSDoc, or C#).

GitHub Copilot Chat is more than a reactive assistant — it's an adaptable, context-aware partner that grows smarter with the tools you use. By pairing Copilot Extensions with slash commands, you unlock a workflow that's not just efficient, but conversational and intuitive. Whether you're summarizing your workspace, diagnosing terminal issues, optimizing performance, or documenting code, these features help bridge the gap between intention and implementation.

To keep things approachable, we've used straightforward examples throughout this article. But don't stop there — mix, match, and adapt the prompts to fit your own development style.

And there is more to the story. In upcoming parts, we'll explore Edit mode for precise, multi-file code changes, and Agent mode for autonomous, goal-driven development — giving Copilot the reins when you're ready to move faster.

That's it for now! Keep coding!!


Author : Bipin Joshi
Bipin Joshi is an independent software consultant, trainer, and author, specializing in Microsoft web development technologies. Having embraced the yogic way of life, he also mentors select individuals in Ajapa Gayatri and allied meditative practices. Blending the disciplines of code and consciousness, he has been meditating, programming, writing, and teaching for over 31 years. As a prolific author, he shares his insights on both software development and yogic wisdom through his websites.

Posted On : 21 July 2025