How to extend GitHub Copilot with prompt files

Posted on

Why, You Ask?

Remember when I went absolutely euphoric about vibe coding? Well, that honeymoon phase taught me one crucial lesson: context matters, and you really need to spend time writing good prompts.

At first, I was frantically scribbling prompts in my notes app like some kind of digital hoarder. Then I graduated to GitHub Copilot instruction files, adding rules like "when asked for review, do this and that." But constantly switching between apps and copy-pasting prompts? I'm tired of it.

That's exactly why GitHub Copilot's new prompt files are such a game changer.

The Game Changer: .prompt.md Files

Prompt files turn your best prompts into reusable slash commands. VS Code gives you two flavors:

  • Workspace prompts (.github/prompts/): Travel with your repository, perfect for team-shared helpers
  • User prompts: Stored in your VS Code profile, available everywhere for personal tools

Both become accessible as /my-prompt directly in VS Code chat. Instead of hunting through notes for that brilliant review prompt, you just type /svnscha-blog-review and boom, there it is.

Note: Prompt files are currently in public preview and may change in future releases.

Real-World Example: Blog Review Prompt

Let me show you what this looks like in practice. I use project prefixes for workspace prompts and /my-... for personal ones.

For this blog, I created /svnscha-blog-review - a specialized prompt that understands my writing style:

---
mode: "agent"
description: "Review blog posts for svnscha.github.io with focus on style, grammar, and technical accuracy"
---

# Blog Post Review for svnscha.github.io

You are an expert editor reviewing a blog post for svnscha's technical blog.

Focus on:

## Writing Style & Tone

- Consider using "Why, You Ask?" openings when it makes sense for the topic (not mandatory for all posts)
- Keep the direct, slightly sarcastic but helpful voice
- Ensure smooth transitions between sections
- End posts with "Wrapping Up" and "What's Next?" sections when appropriate

## Technical Accuracy

- Verify code examples are correct and practical
- Check that technical explanations are clear and accurate
- Ensure all file paths and commands are properly formatted

## Grammar & Spelling

- Fix any grammatical errors or typos
- Improve sentence structure where needed
- Maintain consistency in technical terminology

## Content Structure

- Ensure headings flow logically
- Verify examples support the main points
- Suggest ending with "Wrapping Up" (summary) and "What's Next?" (actionable next steps) sections
- Check that the conclusion ties back to the opening

Provide specific, actionable feedback that maintains the author's voice while improving clarity and correctness.

This becomes available as /svnscha-blog-review in VS Code, giving me instant access to a specialized editor that knows my style.

Smart Naming & Location Strategy

The naming convention is simple: project prefixes for workspace prompts, /my-... for personal ones. So /svnscha-blog-review is specific to this blog, while /my-commit works everywhere.

Choose your location based on scope:

  • Workspace prompts: Team-shared, project-specific helpers
  • User prompts: Personal tools that follow you across all projects

Dynamic Prompts with Variables

Make your prompts adapt to context with VS Code variables:

# Code Review Prompt

Review the following code in ${file}:

${selection}

Focus on:
- Security vulnerabilities in ${fileBasename}
- Performance implications 
- Code style consistency with ${workspaceFolderBasename} standards

The most useful variables include:

  • Workspace: ${workspaceFolder}, ${workspaceFolderBasename}
  • File context: ${file}, ${fileBasename}, ${fileDirname}
  • Selection: ${selection}, ${selectedText}

For the full list of available variables and advanced features, check out the VS Code prompt files documentation.

Setting Up Your Prompt Arsenal

Getting started is simple:

Workspace Prompts

  1. Create .github/prompts/ in your repository
  2. Add your .prompt.md files
  3. Commit and push - your team now has access

User Prompts

  1. Open Command Palette (Ctrl+Shift+P)
  2. Run "Chat: New Prompt File"
  3. Choose "User profile" for location
  4. Author and save your prompt

Both methods make prompts available with /prompt-name in GitHub Copilot chat. Workspace prompts travel with your repository, while user prompts sync across devices with Settings Sync.

For examples and community contributions, check out the Awesome GitHub Copilot prompts collection.

Wrapping Up

Prompt files transform good prompting from an exclusive skill into a shared superpower. Your team gets expert-level guidance, your hotfix deployments get proper review, and your collective wisdom becomes instantly accessible with slash commands.

What's Next?

  1. Start small - Convert your three most-used prompts to .prompt.md files
  2. Choose scope wisely - Workspace prompts for teams, user prompts for personal tools
  3. Use variables - Make prompts dynamic with ${selection}, ${file}, and ${input:variableName}
  4. Follow naming conventions - Project prefixes for workspace, /my-... for user prompts
  5. Explore the community - Check out Awesome GitHub Copilot prompts
  6. Read the docs - VS Code prompt files documentation has the latest features

Welcome to the future of prompt management - where expertise is democratized and copy-pasting is finally dead.


Copyright © 2025 Sven Scharmentke. All rights reserved.