GitHub Copilot Prompts: 16 to Paste Into Chat and Agent

GitHub Copilot Prompts: 16 to Paste Into Chat and Agent

Short answer

The best GitHub Copilot prompts do four things: point at the exact code (attach the file, function or issue), say what done looks like, set limits on what may change, and ask Copilot to prove the result, usually by running the tests. Below are 16 copy-paste prompts grouped by job (understand, plan, build, debug, test, refactor, review, docs and github.com tasks), each with where to run it: Ask, Plan or Agent in VS Code, or Copilot Chat on github.com. Then save the ones you reuse as a .github/copilot-instructions.md file or an agent skill.

In VS Code, Copilot now runs as an agent with Ask, Plan and Agent modes, chat participants such as @workspace are deprecated, and prompt files are giving way to agent skills. Everything here is checked against GitHub's and VS Code's own docs as of November 2026, and every prompt is written for that setup. If you also use other assistants, our roundup of AI pair programming tools compares Copilot with Cursor, Claude Code and the rest.

How to use these prompts in Copilot today

  • Pick the right agent. In VS Code's Copilot sessions, Ask answers questions with read-only tools, Plan researches and writes a plan (also /plan), and Agent edits files and validates the result, per the VS Code docs.
  • Attach context instead of describing it. Type # to add files, tools and other context, use Add Context, or drag files in. Attach errors, test output and GitHub issues too.
  • Use slash commands for the common jobs. /explain, /fix, /tests, /doc (from inline chat), /plan and /compact for long conversations. Type / to see what your session supports.
  • Skip chat participants in VS Code. Its cheat sheet marks them deprecated and unsupported in Copilot sessions. Ask the agent directly.
  • On github.com, use @ to attach. At github.com/copilot you can attach discussions, files, issues, pull requests and repositories, plus images and PDFs, according to GitHub's chat cheat sheet and chat docs.

Replace everything in [square brackets], and keep the constraint lines. They are what stop Copilot from "helpfully" rewriting files you didn't ask about. For the same jobs in other tools, see our Cursor prompts, the tool-neutral coding prompts for any chat window, and our Claude Code prompts.

The prompts, by job

1. Understand: explain a file to a newcomer

Run in Ask, with the file attached through # or Add Context. Ask only uses read-only tools, so nothing changes.

Explain [#file] to a developer who joined the team this week.
Start with what this file is responsible for in one sentence.
Then list the 3 to 5 functions that matter most, what each one takes and returns, and which other files call them.
Point out anything surprising: side effects, global state, hidden network or database calls.
Finish with the one thing I should not change without talking to the owner. Quote line numbers for every claim.

2. Understand: trace a request end to end

Ask mode again. Good before touching code you didn't write.

Trace what happens when a user [submits the checkout form] in this workspace.
Follow the request from the UI event to the API route, the service layer and the database write, then back to the response.
For each hop, give the file path and function name.
List every place an error can be thrown and whether it is caught.
Do not guess: if a step goes through code you can't find, say so.

3. Plan: a feature before any code

Use the Plan agent (or /plan) and read the plan before you hand it to Agent.

/plan Add [CSV export to the invoices page].
Requirements: [export the current filtered list], [include these columns], [no more than 10,000 rows].
Research the existing code first and reuse its patterns for API routes, permissions and file downloads.
Give me: the files you would change or add, the order of changes, the tests you would add, and the risks.
List open questions instead of making assumptions about product behavior.

4. Plan: check a plan for risks

Paste a plan (yours or Copilot's) and ask for the holes before anyone writes code.

Review this implementation plan as a skeptical senior engineer:
[paste plan]
Find: steps that touch shared code without a test, data migrations without a rollback, missing permission checks, and anything that changes a public API.
For each issue, say how bad it is (high, medium, low) and the smallest change to the plan that fixes it. Do not rewrite the whole plan.

5. Build: implement and verify

Agent mode. Name the outcome and how Copilot should prove it worked.

Implement [the plan above / this change: describe it].
Constraints: follow the patterns in [#file of a similar feature], do not add new dependencies, and keep changes inside [src/billing].
When done, run [npm test -- billing] and fix anything that fails.
Then summarize: files changed, why, the test results, and anything you could not verify.

6. Build: add an endpoint that matches the codebase

Agent mode, for a new route that should look like the ones you already have.

Add a [GET /api/projects/:id/members] endpoint.
Copy the structure of [#file of an existing route]: same validation library, same error format, same auth middleware.
Return [id, name, role] for each member and a 404 if the project doesn't exist or the user can't see it.
Add tests for: success, not found, and a user from another workspace. Run them.

7. Debug: fix from a stack trace

Paste the full error and attach the file it points to. Ask for the cause before the fix.

Here is the error and stack trace:
[paste error]
1. Explain the root cause in two or three sentences, pointing to the exact line.
2. Say whether the same bug can happen anywhere else in the codebase.
3. Propose the smallest fix and show the diff.
Do not change unrelated code, and do not suppress the error with a try/catch unless that is the right fix.

8. Debug: a failing test, without moving the goalposts

Agent mode with the test output attached. The last line matters.

This test fails: [test name], output below.
[paste output]
Find out whether the bug is in the code or in the test.
Fix the implementation without changing the expected behavior of the test. If you believe the test itself is wrong, stop and explain why instead of editing it.
Run the test file again and show the result.

9. Debug: reproduce an issue first

Attach the GitHub issue as context, then let Agent write the failing test before the fix.

Read the bug report in [issue link or pasted text].
Write a test that reproduces it and confirm the test fails for the reason described.
Only then fix the code so the test passes, run the related tests, and tell me if the report was missing anything you had to assume.

10. Tests: edge cases for one function

Select the function first, or attach it, then run this. Works with /tests too.

Write unit tests for [function name] using [Jest / pytest / the project's existing framework].
Cover: normal inputs, empty and null inputs, boundary values, invalid types, and the error paths.
Use the existing test helpers in [#file] instead of new mocks.
One behavior per test, with a test name that reads as a sentence. Run the tests and fix only the tests if they fail for setup reasons.

11. Refactor: in small, safe steps

Agent mode on a file that has tests. If it doesn't, run prompt 10 first.

Refactor [#file] to [split the 300-line function into smaller functions / remove the duplicated parsing logic].
Rules: no change in behavior, no change to exported names or signatures, run the tests after every step.
Work in steps of one change each and list them as you go. If a test fails, undo that step and tell me why.

12. Review: my changes before I commit

Ask mode, with your changed files attached. A second read, not a replacement for yours.

Review my uncommitted changes in [these files].
Look for: bugs, missing error handling, unhandled null or empty cases, N+1 queries, secrets or debug code left in, and tests that no longer cover the change.
Report each finding with the file, line, why it matters and a suggested fix. Skip style comments unless they hide a bug.

13. Review: a security pass on one folder

Ask mode. Keep the scope small so the answer stays specific.

Do a security review of [src/api].
Check authentication, authorization on every route, input validation, SQL or command injection, file upload handling, and what gets logged.
Only report a control as present if you can point to the code. Group findings as high, medium and low, with the file and line for each.

14. Docs: comments and a README section

Use /doc on a selected symbol for comments, or this prompt for the bigger picture.

Write a README section for [the billing module] for developers on this team.
Include: what it does, the main entry points, required environment variables (names only, no values), how to run its tests, and two common mistakes.
Base everything on the code in [src/billing]; mark anything you could not confirm as TODO.

15. github.com: summarize a pull request for reviewers

In Copilot Chat on github.com, type @ to attach the pull request, then ask.

Summarize [the attached pull request] for a reviewer who has 5 minutes.
Give: what changed and why in three bullets, the riskiest file and why, what is not tested, and the questions I should ask the author.
Do not restate the diff line by line.

16. github.com: turn a bug report into a clean issue

Paste a raw report from a user or teammate and attach the repository with @.

Turn this report into a GitHub issue for [the attached repository]:
[paste report]
Use sections: Summary, Steps to reproduce, Expected, Actual, Environment, and Possible cause (only if you can point to code).
Keep the reporter's facts; mark anything missing as "Unknown" instead of filling it in.

Which prompt for which job

JobPromptsWhere to run itAttach
Understand code1, 2VS Code AskThe file, or nothing for a trace
Plan a change3, 4VS Code Plan or /planRequirements, a similar feature
Build a feature5, 6VS Code AgentA file that shows the pattern
Debug7, 8, 9VS Code AgentStack trace, test output or the issue
Write tests10VS Code Agent or /testsThe function and a test helper file
Refactor11VS Code AgentThe file, with its tests
Review12, 13VS Code AskChanged files or one folder
Docs14VS Code Ask, or /doc in inline chatThe module folder
Pull requests and issues15, 16Copilot Chat on github.comThe pull request or repository with @

Save your best prompts: instructions and skills

Rules you repeat in every prompt belong in an instructions file. GitHub's docs put repository-wide instructions in .github/copilot-instructions.md and path-specific ones in .github/instructions/NAME.instructions.md with an applyTo glob, and Copilot also reads AGENTS.md. VS Code's custom instructions guide adds that instructions guide the model but don't guarantee compliance, and don't apply to inline suggestions.

Workflows you run on demand belong in a skill: a folder in .github/skills/ with a SKILL.md file whose frontmatter has a name (lowercase letters, numbers and hyphens, matching the folder) and a description. It shows up as a slash command. VS Code says prompt files (.prompt.md) only run in its Local option, which is deprecated and will be removed by February 2027, and recommends converting them to skills. Two starting points:

.github/copilot-instructions.md (example)

Project-wide rules Copilot reads with every request in this repository. Keep it short and specific.

# Project instructions
- This is a [Next.js 15 + TypeScript] app. Package manager: [pnpm].
- API routes live in [src/app/api]. Database access only through [src/db/queries], never from components.
- Validate every request body with [zod] schemas in [src/schemas].
- Tests: [Vitest]. Run [pnpm test <file>] for the files you change.
- Never add a dependency without saying why in your summary.
- Errors returned to clients use the shape { error: { code, message } }.

.github/skills/review-pr/SKILL.md (example)

A reusable review workflow you run as /review-pr. The name must match the folder name.

---
name: review-pr
description: Review the current branch's changes for bugs, missing tests and security issues. Use before opening a pull request.
---
# Review the current changes
1. List the changed files and read each diff in full.
2. For every change, check error handling, empty and null inputs, permission checks and tests.
3. Run the tests for the changed files and include the result.
4. Report findings as high, medium or low with file and line. Do not report style issues.
5. End with a one-line verdict: ready, ready with fixes, or not ready.

Copilot plans and prices (November 2026)

From GitHub's Copilot plans page and its plans docs, as of November 2026: Free $0 with 2,000 completions a month and limited chat and agent usage; Pro $10 per user a month; Pro+ $39; Max $100; Business $19 per granted seat a month; Enterprise $39 per granted seat a month. Chat and agents draw on monthly GitHub AI Credits, while code completions stay unlimited on paid plans. Assigning work to Copilot so it opens a pull request starts at Pro.

Common mistakes

  • No definition of done. "Fix the bug" invites a guess. "Fix it, run the test file, show the result" gets a checked answer.
  • Using Agent to ask questions. Ask can't edit files, which is exactly what you want while you're still learning the code.
  • Letting it edit the test. When a test fails, say whether the code or the test is the source of truth.
  • One giant prompt. Plan, then build, then review. Three short prompts beat one long one.
  • Rules scattered across chats. If you typed the same constraint three times, move it into the instructions file.

Prompts are only half of it. Our AI coding best practices cover reviewing, testing and owning AI-written code.

Frequently Asked Questions

What are good prompts for GitHub Copilot?
Prompts that name the exact code (attach the file, function or issue), say what done looks like, set limits (files, dependencies, behavior that must not change) and ask Copilot to verify its own work, for example by running the tests. The 16 prompts on this page follow that pattern for explaining, planning, building, debugging, testing, refactoring, reviewing and writing docs.

What slash commands does Copilot Chat have?
In VS Code, the docs list /plan, /explain, /fix, /tests, /doc (from inline chat), /new, /compact and /clear, among others. Type / to see what your current session supports. On github.com, Copilot Chat lists /clear, /delete, /new and /rename. Skills and saved prompts also show up as slash commands.

Can I still use @workspace and other chat participants?
VS Code's docs now mark chat participants as deprecated and say they are not supported in the Copilot agent sessions. Ask the agent directly and attach context with # or Add Context instead. On github.com, typing @ attaches discussions, files, issues, pull requests or repositories to the conversation.

Where do Copilot custom instructions go?
Repository-wide instructions go in .github/copilot-instructions.md. Path-specific ones go in .github/instructions/NAME.instructions.md with an applyTo glob in the frontmatter. Copilot also reads AGENTS.md files, and GitHub's docs say a single CLAUDE.md or GEMINI.md at the repository root works too. Instructions don't apply to inline suggestions as you type.

Are prompt files still supported?
In VS Code, prompt files (.prompt.md in .github/prompts) run only in the Local option, which VS Code says is deprecated and will be removed by February 2027; its docs recommend converting them to agent skills. GitHub's docs list prompt files as a public preview for VS Code, Visual Studio and JetBrains IDEs.

Do these prompts work on the free Copilot plan?
Yes. GitHub's plans page lists agent mode, custom instructions and Copilot Chat on Free, with 2,000 completions a month and limited chat and agent usage. Assigning work to Copilot so it opens a pull request needs Pro or above.

Ready to be a
10x Marketer?

See it in action

left-gradient
left-gradient
Questera Logo
SOC 2 Type II Cert.
SOC 2 Type II Cert.
AI Security Framework
AI Security Framework
Enterprise Encryption
Enterprise Encryption
Security Monitoring
Security Monitoring

© 2026 Questera

Follow in Google