Prompts for getting more out of GitHub Copilot: scoping issues for the Copilot coding agent, building features in agent mode, writing pull request descriptions from a diff, reviewing changes for security holes and breaking API changes, and setting up repository instructions.
Get a ready-to-commit .prompt.md file with valid YAML frontmatter, scoped Copilot tool permissions, and a deterministic verification loop for your team.
Get a .github/copilot-instructions.md built from your repo's real commands and conventions, a table of what GitHub Copilot ran, and up to three path-scoped files.
Guides GitHub Copilot agent mode to inspect the repository, state assumptions, plan a minimal change, implement it, and add tests. It ends with a verification report you can use to decide whether to open a PR.
Turns a vague GitHub issue into a self-contained task with context, testable acceptance criteria, files to touch, and tests to add, so the Copilot coding agent can finish it.
Get a deterministic integration test suite for any external API client covering timeouts, 429 rate limits, malformed JSON, and retry backoff without hitting live endpoints.
Generate an automated audit of regular expressions or parser snippets that flags catastrophic backtracking, isolates edge cases, and produces unit test fixtures.
Get a ready-to-commit .prompt.md file with valid YAML frontmatter, scoped Copilot tool permissions, and a deterministic verification loop for your team.
Preview prompt
Act as a Staff Developer Experience Engineer who builds standardized GitHub Copilot workflows for engineering teams.
Your job is to write a complete, ready-to-commit .prompt.md file that teammates can invoke in GitHub Copilot Chat with a single slash command.
First, ask these 3 short questions in one numbered message and wait for my answers:
1. What repeatable task should this slash command run (such as PR security review, endpoint scaffolding, or unit test generation)?
2. What language, framework, and test or lint command does the repository use?
3. Should Copilot only read and suggest edits, or modify files and run terminal commands?
Once I reply, follow these rules:
- Include valid YAML frontmatter with description, mode, and a minimal tools list scoped only to what the task requires.
- Write concrete, numbered instructions that reference real repository paths instead of vague guidance.
- Add a deterministic verification step using the exact test, typecheck, or lint command before finishing.
- Keep the file under 80 lines so it stays readable in version control.
Output format:
- File Path: exact path under .github/prompts/
- Prompt File: the complete .prompt.md file in one Markdown code block
- Team Rollout Note: 2-3 bullets on how to invoke and verify it locally
End with one line listing any assumptions about repository layout or tool permissions.
Get a .github/copilot-instructions.md built from your repo's real commands and conventions, a table of what GitHub Copilot ran, and up to three path-scoped files.
Preview prompt
You are GitHub Copilot in agent mode in this repository. Write .github/copilot-instructions.md from what the repo actually contains, so Copilot chat, the coding agent and code review follow the real setup.
Steps:
1. Read package manifests and lockfiles, Makefile or task scripts, .github/workflows, lint and format configs, test folders, the README and any AGENTS.md, CLAUDE.md or .github/instructions files.
2. Take the exact install, build, single-test, full-test, lint and typecheck commands from scripts and CI. Run the quick, safe ones and record the result.
3. Note the folder layout, naming and error-handling conventions, and the do-not areas: generated files, migrations, secrets, vendored code.
4. Propose at most three path-specific files at .github/instructions/NAME.instructions.md, each with an applyTo glob in its front matter and only the rules that differ for that area.
5. Final check: every command in the file appears in your table, and every path you mention exists.
Rules:
- Never invent a command or convention; mark anything you could not run as unverified.
- Never run deploys, migrations or commands that write outside the repo.
- Under about two pages, every line checkable, nothing a linter or CI already enforces, no README text copied.
- Create or edit files under .github/ only; do not change source or tests.
Output format:
1. copilot-instructions.md in one code block
2. Each .instructions.md file in its own code block
3. Table: command | source file | ran | result
4. Could not verify, and any assumptions you made
Guides GitHub Copilot agent mode to inspect the repository, state assumptions, plan a minimal change, implement it, and add tests. It ends with a verification report you can use to decide whether to open a PR.
Preview prompt
Role: You are a senior {language_and_framework} engineer working in GitHub Copilot agent mode inside my open workspace. You follow existing repository conventions and prefer the smallest correct change.
Context: I need to ship a scoped change. The decision I must make at the end is whether this change is ready for a pull request or needs more work. Use #codebase and any .github/copilot-instructions.md file to learn conventions before editing.
Task: Implement {feature_description}, add or update tests, and report verification results honestly.
Inputs
- Feature description: {feature_description}
- Likely files or folders: {target_paths}
- Language and framework: {language_and_framework}
- Test command: {test_command}
- Constraints (compatibility, performance, style): {constraints}
- Acceptance criteria from the ticket: {acceptance_criteria}
- Out of scope: {out_of_scope}
If any input is blank or ambiguous, list it under Missing information and ask at most 3 targeted questions. Proceed only on assumptions that are low risk, and label each one.
Workflow
1. Discovery: search the codebase for related modules, existing patterns, similar features, and current tests. List the files you read and why they matter. Do not edit yet.
2. Assumptions: list assumptions separately from facts found in the repo.
3. Plan: give a numbered plan of file-level changes, each tied to an acceptance criterion. Flag anything that touches public APIs, schemas, config, or dependencies.
4. Implement: make the minimal edits that satisfy the plan. Reuse existing helpers. Do not add new dependencies unless unavoidable, and justify any you add.
5. Test: add or update tests for the happy path, at least two edge cases, and one failure path. Match the existing test style.
6. Verify: run {test_command} in the terminal if available. Report only real output. If you cannot run it, say so and give the exact command for me to run.
7. Self-review: re-read your diff for unrelated changes, dead code, missing error handling, and leaked secrets.
Constraints
- Do not modify files outside {target_paths} without stating why first.
- Do not refactor unrelated code or reformat whole files.
- Do not invent APIs, functions, or config keys; confirm they exist in the repo.
- Never claim tests passed unless you saw them pass.
- Honor: {constraints}
Output format
Return these sections in order:
1. Summary (3 sentences max)
2. Missing information and assumptions (table: item | type fact/assumption/missing | impact)
3. Plan (numbered list)
4. Files changed (table: file | change | acceptance criterion covered)
5. Tests added or updated (table: test name | scenario | expected result)
6. Verification (command, actual result, or not run and why)
7. Risks and follow-ups (bulleted, each with a suggested next action)
8. PR readiness verdict: Ready, Ready with caveats, or Not ready, with one-line justification
Acceptance criteria
- Every item in {acceptance_criteria} maps to at least one code change and one test.
- The diff contains no changes outside the stated scope, or each such change is justified.
- New tests fail without the change and pass with it, or the report explains why that was not checked.
- Verification states real results or clearly says not run.
Quality checks
- Does the code follow naming, error handling, and logging patterns found in neighboring files?
- Are all new public functions typed or documented per repo convention?
- Did you avoid hard-coded secrets, URLs, and environment-specific paths?
- Is each assumption either confirmed in code or listed for me to confirm?
- Is the verdict consistent with the risks listed?
Turns a vague GitHub issue into a self-contained task with context, testable acceptance criteria, files to touch, and tests to add, so the Copilot coding agent can finish it.
Preview prompt
You are a maintainer preparing a GitHub issue to assign to the Copilot coding agent. The agent cannot ask questions mid-task, so the issue must stand alone. Here is the vague issue: {paste the vague issue here} Before writing, ask me one or two short questions if you need the repo layout, the test command, or the intended behavior. Rules: every acceptance criterion must be observable and pass or fail, such as a returned value, a status code, or a rendered state. Label file paths as confirmed or likely, and do not present guesses as facts. State what is out of scope. If the work is larger than one reviewable PR, propose a split into separate issues. Output exactly this: Title (imperative, under 80 characters). Context (why this matters and the current behavior). Desired behavior. Acceptance criteria as a checkbox list. Files to touch as a table with columns Path, Change, Confidence. Tests to add (name, input, expected result). Out of scope. How to verify (exact commands). Open questions for the maintainer. Finish with a one-line risk note on what could make the agent go wrong.
Separates wire-breaking schema, status code, and migration changes from safe additions, returning a consumer impact table and deprecation plan.
Preview prompt
Act as a staff API platform engineer reviewing a pull request for backward compatibility. I will paste a git diff and any related schema or migration files right after this prompt. Audit the diff to separate wire-breaking changes from safe additive changes.
Rules:
1. Classify every API change as Wire-Breaking, Behavioral-Breaking, or Safe Additive, citing the exact file path and symbol name from the diff.
2. Check for renamed or removed fields, tightened validation, changed HTTP status codes, altered default values, and database migrations that drop or lock columns before old code stops reading them.
3. Never assume a change is safe because a test passed; flag missing contract tests or undocumented version bumps.
4. For every breaking item, provide a zero-downtime alternative using expand-and-contract or versioned routing.
Output format:
- **Verdict:** Ship, Ship with Deprecation, or Block, with a two-sentence rationale.
- **Consumer Impact Table:** Markdown table with columns: File and Symbol, Change Type, Severity, Affected Consumers, Required Fix.
- **Safe Additive Changes:** Bullet list of non-breaking additions verified in the diff.
- **Deprecation and Rollout Plan:** Numbered steps to deploy safely without breaking existing clients.
End with one short section listing assumptions made and any missing context (such as unknown external consumers or missing schema files) needed to finalize the review.
Get a line-by-line PR security review mapping each flaw to an OWASP category, concrete abuse scenario, and minimal drop-in code patch.
Preview prompt
Act as a principal application security engineer reviewing a production pull request. I will paste a git diff right after this prompt. Audit the changed lines for authentication bypasses, broken access control, injection flaws, secret leaks, and unsafe deserialization.
Rules:
1. Report only concrete issues visible in the diff; skip generic security checklists and style advice.
2. Map every finding to a specific OWASP Top 10 category and cite the exact file path and line number from the diff.
3. Explain the realistic abuse scenario in two sentences so a developer understands the business impact without guesswork.
4. Provide a minimal drop-in code patch for each finding that preserves existing behavior for authorized users.
5. Rank findings from Critical to Low severity; if no real security flaw exists, state that clearly instead of inventing one.
Output format:
- Summary table with columns: Severity, File and Line, OWASP Category, Issue.
- Numbered finding sections, each containing: Impact and Abuse Scenario, and Minimal Patch in a fenced code block.
- Verification checklist with 2 to 3 targeted tests to confirm the fixes.
End with one short paragraph noting any security assumptions that depend on unseen middleware, database rules, or gateway configs.
Get a deterministic integration test suite for any external API client covering timeouts, 429 rate limits, malformed JSON, and retry backoff without hitting live endpoints.
Preview prompt
Act as a senior backend reliability engineer who specializes in resilient HTTP clients and deterministic test suites.
Write failure-mode integration tests for the external API client code I paste below. Infer the language, test runner, and HTTP mocking library from my imports. Only ask up to 2 short questions first if retry limits or timeout values are missing from the code.
Rules:
- Cover five failure modes: read timeout, HTTP 429 with Retry-After, HTTP 503 recovering on retry, malformed JSON on HTTP 200, and non-retryable HTTP 401.
- Mock traffic at the HTTP transport layer so zero live requests leave the machine and tests stay deterministic offline.
- Stub sleep or clock calls so backoff and Retry-After delays are verified by exact duration without slowing execution.
- Assert both the final exception or return value and the exact HTTP attempt count.
Output format:
1. Test Matrix: a table with columns Failure Mode, Mocked Response, Expected Attempts, and Expected Outcome.
2. Integration Test Suite: complete, runnable test code with idiomatic fixtures and zero skipped tests.
3. Verification Commands: exact CLI commands to run the suite and confirm offline isolation.
End with one line noting any timeout, retry, or circuit-breaker assumptions not visible in the pasted client code.
Reviews code diffs for silent concurrency bugs, mapping concurrent execution timelines and providing exact thread-safe mitigation fixes.
Preview prompt
Act as a principal systems engineer specialized in concurrency and multithreaded debugging. Your task is to audit the git diff I will paste below to detect silent race conditions, unsafe shared state, non-atomic read-modify-writes, and deadlocks.
Rules:
1. Focus strictly on lines introduced or modified in the diff, plus immediate surrounding context.
2. Ignore general style or cosmetic issues; highlight only hazards where timing, reordering, or concurrent execution can corrupt data or panic.
3. For every discovered issue, trace a concrete execution timeline with at least two threads or concurrent tasks.
4. Provide the exact thread-safe patch using language-standard primitives (such as mutexes, atomic types, or immutable structures).
Output format:
- Summary: A 2-sentence overview of overall concurrency safety in this diff.
- Findings Table: A Markdown table with four columns: Location (file and line), Shared State / Hazard, Concurrent Timeline (Thread A vs Thread B sequence), and Recommended Mitigation.
- Hardened Code Snippets: For each finding, display the exact corrected code block.
- Assumptions and Blind Spots: Note what runtime model, runtime scheduler settings, or external database guarantees this analysis assumes.
Paste your git diff below this prompt to begin.
Generate an automated audit of regular expressions or parser snippets that flags catastrophic backtracking, isolates edge cases, and produces unit test fixtures.
Preview prompt
Act as a compiler engineer and regex security specialist. I will paste a regular expression or token parser snippet below along with sample inputs that fail or run slowly.
Analyze the code using these rules:
1. Break down the pattern into logical match groups and identify catastrophic backtracking risks (nested quantifiers or overlapping alternatives).
2. Explain why the provided sample inputs cause failures, timeouts, or unexpected captures.
3. Provide a corrected, safer pattern or equivalent sequential parser code with zero exponential complexity risk.
4. Write a compact test fixture table listing at least three valid strings, three invalid strings, and two adversarial edge cases.
Output format:
- Vulnerability and Performance Analysis (state time complexity in big-O notation)
- Failure Root Cause (bulleted breakdown of the pasted samples)
- Optimized Implementation (the clean regex or code snippet)
- Test Fixtures (Markdown table with columns: Input String, Expected Match, Purpose)
End with one short line identifying any parser engine limitations (such as ECMAScript vs PCRE2 features).
Audits intensive loops and hot paths to eliminate heap allocations, slice cloning, and temporary objects while providing benchmark code.
Preview prompt
Act as a systems performance engineer. I will paste a code snippet representing a hot path, loop, or stream processor.
Your job is to identify every unnecessary heap allocation, slice reallocation, and temporary buffer clone, then provide zero-allocation or pooled alternatives.
Rules:
1. Identify exact lines where allocations occur on each iteration or function call.
2. Rewrite the code using memory-efficient techniques (such as pre-allocated buffers, object pools, or direct slice reuse).
3. Provide a runnable benchmark snippet comparing the original logic against the optimized version.
4. Avoid premature micro-optimizations that damage readability without reducing GC or heap pressure.
Output format:
- Allocation Hotspots (bullet list naming line concepts and allocation causes)
- Optimized Implementation (complete replacement code block)
- Benchmark Harness (ready-to-run benchmark snippet)
- Tradeoffs and Caveats (concurrency constraints, buffer reset requirements, or safety risks)
Please paste your code snippet, specify the programming language, and state your target throughput or batch size.
Turns pasted Express, Fastify, or Next.js route handlers into valid OpenAPI 3.1 YAML specs, typed JSDoc blocks, and a list of undocumented error edge cases.
Preview prompt
Act as a staff backend engineer and API specification architect.
I will paste one or more route handler files (and any referenced middleware or validation schemas) right after this prompt. Your job is to extract an accurate OpenAPI 3.1 YAML specification and matching JSDoc comments directly from the code.
Follow these rules:
1. Extract every HTTP method, path parameter, query parameter, request body field, and response status code strictly from the pasted code. Never invent fields, status codes, or defaults that do not exist in the implementation.
2. Document authentication and authorization headers by inspecting middleware, guards, or header lookups in the handler.
3. Map every thrown error, early return, and catch block to its exact HTTP status code and response payload shape.
4. Write JSDoc blocks ready to paste directly above each handler function, including summary, parameter descriptions, and return types without using curly-brace placeholders.
5. Flag undocumented edge cases such as unhandled promise rejections, missing input validation, or implicit 500 responses.
Output format:
- OpenAPI 3.1 YAML: A valid YAML snippet covering paths, parameters, requestBody, security, and responses.
- JSDoc Blocks: Ready-to-paste comment blocks for each exported handler.
- Undocumented Edge Cases: A bulleted table or list of code-level gaps with line or symbol references.
End with one short line listing any middleware, external types, or global error handlers that were missing from the pasted code and had to be assumed.
Turn messy error logs and stack traces into structured, actionable bug reports with minimal reproduction scripts.
Preview prompt
Act as a Senior Software Engineer. Your job is to analyze raw error logs and stack traces to create a professional, reproducible bug report. Before starting, ask me these 3 questions: 1. Paste the full stack trace or error log. 2. What framework or language version are you using? 3. What were the specific user actions or inputs leading to this error? Wait for my answers. Once I provide them, generate the response using these rules: First, identify the exact failing function call chain. Second, write a minimal, self-contained reproduction script in the original language. Third, create an Expected vs Actual Behavior table. Fourth, list 3 potential root causes based on the trace. Output format: # Bug Report: [Short Title] ## Failing Call Chain: [List the chain] ## Minimal Reproduction Script: [Code block] ## Behavior Comparison: [Table with columns: Scenario, Expected, Actual] ## Root Cause Analysis: [Numbered list] This is not professional software engineering advice; consult your team lead for critical production system changes.
Get a comprehensive unit test suite focusing on edge cases, null pointers, and arithmetic overflows for any function you paste.
Preview prompt
Act as a Senior Software Engineer. I will paste a code function below. Your task is to generate a comprehensive suite of unit tests focusing exclusively on boundary conditions. Follow these rules: 1. Create a table of test cases that includes the input scenario, the expected behavior, and the specific boundary condition being tested. 2. Write the actual test code using a standard testing framework like PyTest, JUnit, or Jest. 3. Ensure no external mocks are used; if a dependency is required, suggest the minimal structural change instead. 4. Include tests for empty collections, null inputs, maximum integer values, and off-by-one errors. Output format: 1. Test Case Table 2. Unit Test Code Block. Please wait for me to paste the code after you acknowledge this request.
Get a step-by-step technical plan for migrating database schemas without downtime, including data backfill logic and verification steps.
Preview prompt
Act as a Senior Database Reliability Engineer. I need to perform a breaking schema migration on a production SQL database. Before providing the plan, please ask me these 3 questions: 1. What is the current schema change you need to implement? 2. What is the approximate size of the table in rows? 3. Is the database using Postgres, MySQL, or another engine? Once I answer, provide a migration strategy divided into 5 phases: Dual-Write, Backfill, Read-Switch, Cleanup, and Verification. Rules: 1. Every phase must include a specific SQL verification query. 2. Ensure all steps are backward-compatible. 3. Use standard SQL syntax. 4. Do not include placeholders. Output format: ## Phase Name - Goal: One sentence. - Action: Bulleted technical steps. - Verification: The exact SQL query to confirm success. This is not legal or financial advice; consult with a database architect for high-stakes production changes.
Get a step-by-step plan to break a large monolithic class into smaller, testable services while preserving the original public API behavior.
Preview prompt
Act as a Senior Software Architect. Your task is to refactor a monolithic class into smaller, single-responsibility services using dependency injection. First, ask me these three questions: 1. Paste the code of the monolithic class you want to refactor. 2. List the primary responsibilities currently handled by this class. 3. Name the programming language and framework you are using. After I answer, provide a refactoring plan. Rules: 1. Identify logical groupings for new services. 2. Define an interface for each new service. 3. Update the original class to act as a facade that delegates calls to these new services to ensure no breaking changes to the existing public API. 4. Show the new dependency injection structure. Output format: # Refactoring Strategy, ## Proposed Services, ## Interface Definitions, ## Refactored Facade Implementation. This is for educational purposes and requires code review by a human lead developer before deployment.
About this list
They are written for Copilot Chat and agent mode in your editor, and most also work in ChatGPT or Claude when you paste the code in. Each one gives Copilot what it needs to stay on task: the files in scope, the behaviour that must not change, the tests to run and the shape of the answer you want back.
There are prompts for unit and integration tests, regex and parser debugging, splitting up oversized classes, zero-downtime database migrations and API documentation, plus a generator for a Copilot instructions file built from your real build and test setup. Review every change Copilot makes and run your tests before merging, since it can still write plausible but wrong code.
What is the difference between Copilot Chat, agent mode and the coding agent?
Copilot Chat answers questions and suggests code in your editor. Agent mode lets Copilot plan and edit several files, run commands and iterate inside your editor while you watch. The coding agent works on an assigned GitHub issue in the background and opens a pull request for you to review. Pick the one that matches how closely you want to supervise.
What is a Copilot instructions file?
It is a Markdown file in your repository's GitHub folder that Copilot reads as standing instructions for that repository: how to build and test, coding conventions and things to avoid. A good one saves repeating the same context in every chat. The generator prompt here writes it from your real scripts and configuration rather than generic advice.
How do I write a good issue for the Copilot coding agent?
Treat it like a ticket for a new teammate: state the problem, the expected behaviour, the files or modules involved, the acceptance criteria and how to test the change. Keep the scope to one change that fits in a single pull request. The issue rewriting prompt turns a vague request into this format before you assign it.