Back to Blog

The Best GitHub Copilot Prompts for Faster Coding (2026)

March 20, 2026by Nav
github copilot promptscopilot chat promptsgithub copilotai coding toolsdeveloper productivity

GitHub Copilot has evolved well past autocomplete. Copilot Chat, workspace-level agents, and slash command extensions make it a full coding assistant inside VS Code and GitHub.com. But most developers use maybe 20% of what it can do — usually just accepting inline suggestions.

Promptzy in action – manage AI prompts on Mac

This list covers the full range: slash commands, inline comment triggers, Chat prompts, and workspace agent prompts. Save the ones you use repeatedly.


Copilot Chat Slash Commands

Slash commands are built-in shortcuts in Copilot Chat. These work in VS Code's Copilot Chat panel.

1. /explain — Understand Unfamiliar Code

/explain

Walk through this code step by step. I want to understand:
- What each major section does
- Why this pattern was likely chosen
- Any non-obvious dependencies or assumptions
- What I'd need to change to modify [SPECIFIC BEHAVIOR]

2. /fix — Fix a Bug With Context

/fix

The bug: [DESCRIBE WHAT'S WRONG]
Expected behavior: [WHAT SHOULD HAPPEN]
What I've tried: [ATTEMPTS SO FAR]

Fix the bug and explain what caused it.

3. /tests — Generate Tests

/tests

Generate comprehensive tests for this code using [JEST/VITEST/PYTEST/GO TEST].

Cover:
- Happy path (all valid inputs)
- Boundary cases (empty arrays, zero, max values)
- Error cases (invalid inputs, null, undefined)
- Any async behavior or side effects

Add a comment explaining what each test verifies.

4. /doc — Generate Documentation

/doc

Generate documentation for this code. Include:
- JSDoc/docstring with param types and return type
- A usage example with realistic inputs and expected output
- Any important notes about edge cases or limitations
- Description of side effects if any

5. /optimize — Performance Improvements

/optimize

Identify performance bottlenecks in this code and optimize them.

Focus on: algorithm complexity, unnecessary iterations, database query patterns, memory allocation, and caching opportunities. Show before/after and explain the performance gain.

Inline Comment Triggers

These are code comments you write that trigger Copilot autocomplete in a specific direction. Write the comment, then let Copilot complete the implementation.

6. Function Implementation

// Implements a debounce function that delays calling fn until after
// wait milliseconds have elapsed since the last time this was called.
// Returns a function that clears the timeout when called immediately.
function debounce(fn, wait) {

7. Validation Function

// Validates an email address. Returns true if valid, false otherwise.
// Valid: standard email format with @ and domain. Handles edge cases:
// multiple dots, + aliases, subdomains. Returns false for empty strings.
function isValidEmail(email) {

8. API Call With Error Handling

// Makes a GET request to the given URL with retry logic.
// Retries up to 3 times on network errors or 5xx responses.
// Throws a typed ApiError on 4xx responses. Returns parsed JSON.
// Includes timeout of 10 seconds per attempt.
async function fetchWithRetry(url: string): Promise<unknown> {

9. Data Transformation

# Transforms a list of user dicts (with 'first_name', 'last_name', 'email',
# 'created_at' ISO string) into a DataFrame with a 'full_name' column,
# email domain extracted as 'domain', and created_at as a datetime column.
# Drops rows with missing email. Returns the DataFrame sorted by created_at desc.
def transform_users(users: list[dict]) -> pd.DataFrame:

10. SQL Query

-- Returns the top 10 customers by total order value in the last 90 days.
-- Includes: customer_id, email, total_orders, total_value, first_order_date.
-- Excludes test accounts (email contains '@test.' or '@example.').
-- Orders by total_value descending.
SELECT

Copilot Chat: Task-Based Prompts

11. Scaffold a New Feature

I need to add [FEATURE] to my [FRAMEWORK] project.

Look at the existing patterns in this codebase and scaffold the implementation following those patterns. I need:
- The file structure (what to create and where)
- The core implementation with proper types
- Tests for the main functionality
- Any migration or configuration changes needed

Follow the exact conventions already in use — don't introduce new patterns.

12. Refactor to Modern Patterns

This code was written in [OLDER PATTERN]. Refactor it to use modern [LANGUAGE/FRAMEWORK] conventions.

Specific modernizations I want:
- [async/await instead of callbacks / hooks instead of classes / etc.]
- TypeScript types if not already present
- Current library APIs (flag anything that uses deprecated APIs)

Don't change behavior — only modernize the implementation.

13. Write a Database Migration

I need to add [SCHEMA CHANGE] to my database.

Current schema (relevant part): [PASTE SCHEMA]
ORM/migration tool: [PRISMA / TYPEORM / ALEMBIC / etc.]

Write:
- The migration file
- Any seed data if needed
- Rollback migration
- Note whether this requires downtime

14. Debug This Error

I'm getting this error:

[ERROR MESSAGE AND STACK TRACE]

I was trying to: [WHAT YOU WERE DOING]
My code: [PASTE RELEVANT CODE]

What's causing this? Walk me through the root cause and give me the fix. If there are multiple possible causes, list them in order of likelihood.

15. Code Review Checklist

Review this code before I submit it for PR review.

Check:
- Logic errors and edge cases I might have missed
- TypeScript errors or type weaknesses
- Missing error handling
- Performance issues
- Security concerns (input validation, auth, secrets)
- Tests I should add
- Anything that violates the patterns I can see in the rest of the codebase

Be specific — tell me line numbers or function names, not just categories.

GitHub.com Copilot (PR & Issue Context)

16. PR Description Generator

Based on the diff in this PR, write a PR description with:

- What this PR does (1-2 sentences)
- Why this change was needed
- How to test it
- Any known limitations or follow-up work
- Migration steps if applicable

Keep it under 300 words and useful for the reviewer.

17. Summarize a Long PR

This PR has a lot of changes. Give me a summary:
- The core purpose of this PR in 2 sentences
- The highest-risk changes worth reviewing carefully
- Any changes that seem unrelated to the main purpose
- What automated tests would catch if this breaks something

18. Issue Triage Helper

Triage this issue:
- What's the user actually asking for?
- Is this a bug, a feature request, or a support question?
- What information is missing to reproduce or act on this?
- What part of the codebase is this likely in?
- Is this a duplicate of any other issue you're aware of?

19. Generate Release Notes

Based on the commits merged in this release, generate release notes in this format:

## What's New
[Features and improvements — user-facing language]

## Bug Fixes
[Bugs fixed — specific and concise]

## Breaking Changes
[Anything that breaks existing behavior — be explicit]

## Under the Hood
[Technical improvements users don't directly see]

Keep each item to 1-2 sentences. User-friendly language throughout.

Workspace Agent Prompts (Copilot for VS Code)

20. Understand the Codebase

@workspace I'm new to this codebase. Give me an orientation:
- What does this project do?
- What are the main modules or packages and what does each do?
- What's the entry point for the application?
- Where does the main business logic live?
- What are the key data models?

21. Find Related Code

@workspace Find all the code related to [FEATURE/CONCEPT].

Show me:
- Where it's defined (main implementation)
- Where it's used (callers)
- Where it's tested
- Any configuration or feature flags that affect it

22. Trace a Request

@workspace Trace a [HTTP REQUEST / EVENT / FUNCTION CALL] for [SPECIFIC ACTION] through the codebase.

Start from the entry point and walk me through every file and function that gets invoked, what each does, and where the data flows.

23. Find Where to Add This

@workspace I want to add [NEW FEATURE/BEHAVIOR]. Where in the codebase should I add it?

Show me:
- The right file(s) to modify
- The pattern currently used for similar features
- Any interfaces or types I need to extend
- Tests I need to add or update

Tips for Better Copilot Results

A few things that make a meaningful difference:

Open the right files. Copilot uses your open tabs as context. Before asking a question, open the files most relevant to what you're working on.

Use @workspace sparingly. It's powerful but slower. Use it when you need cross-file context; use standard chat for single-file questions.

Reject and retry. If a suggestion is almost right, accept it and then immediately ask: "That's close but [ISSUE] — revise it to [CORRECTION]."

Chain prompts. "Now add error handling" or "Now write tests for that function" works well as a follow-up. You don't need to re-explain context.


Save These as a Promptzy Collection

The inline comment triggers and Chat prompts are the ones worth saving — they're specific enough to produce good output but generic enough to reuse across projects. Promptzy stores each as a Markdown file on your Mac. Press Cmd+Shift+P, type "copilot debug" or "pr description," and it pastes into VS Code's Copilot Chat. $5 one-time.

These prompts work best with GitHub Copilot but many work with any AI coding assistant.

Store and manage your prompts with Promptzy

Free prompt manager for Mac. Search with Cmd+Shift+P, auto-paste into any AI app.

Download Free for macOS