Skip to main content
LLM Reasoning EngineCopilot / GitHubMicrosoft

Microsoft Copilot Prompt Engineering Guide

Integrated Workspace Context Hooks and Real-Time Engineering Flow Completion

GitHub Copilot is the ubiquitous pair-programmer for millions of software engineers. Through context hooks like #file, #editor, #selection, and workspace indexing, Copilot predicts multi-line completions and refactors code in the exact idioms of your existing project. Combined with Microsoft 365 Copilot, it bridges IDE engineering with enterprise documents.

Architecture:Integrated IDE Agent with Local Context Indexing + Cloud Models
Context / Res:Adaptive IDE window buffer with workspace embedding index
Official Portal

Parameter & Token Syntax Cheat Sheet

Official parameter flags, modifiers, and delimiters recognized by the Microsoft Copilot engine.

Parameter / FlagNameAccepted ValuesDefaultDescription & Example
#file:<path>File Context PinRelative workspace filepath—

Explicitly injects another file in your repository into Copilot's active prompt buffer.

#file:src/types/prompt.ts Generate a new zod validator for this interface.
/fixDiagnostic Error ResolverSlash command—

Analyzes current compiler or linter errors in active editor selection and proposes fix.

/fix Resolve TypeScript type mismatch on line 42
/testsTest Suite ScaffolderSlash command—

Generates comprehensive unit tests mocking external calls based on active function signature.

/tests Write Jest/Vitest unit tests covering edge cases

Engineering Best Practices

  • Keep relevant type definitions and interfaces open in adjacent editor tabs so Copilot indexes them.
  • Write expressive function names and JSDoc comments before writing code; Copilot will autocomplete the implementation body.
  • Use #file tags when working in monorepos to guide Copilot across package boundaries.

Common Anti-Patterns to Avoid

  • Don't write vague comments like '// do math'; specify parameters, return types, and business rules.
  • Don't blindly Tab-accept completions without checking boundary null checks and security sanitization.

Gold-Standard Template Breakdown

How an optimized Microsoft Copilot prompt looks in production with all parameters aligned.

Workspace Context-Aware Component RefactoringProduction Exemplar
#file:src/types/prompt.ts #file:src/components/prompts/prompt-card.tsx Task: Refactor PromptCard to support the newly added visualMetadata interface. Ensure 0 TypeScript errors, use Next.js <Image /> with explicit dimensions to prevent CLS, and add a fallback badge when previewImageUrl is undefined.

Architectural Rationale: Pins exact workspace files into Copilot context so the generated diff matches existing styling tokens and TypeScript types perfectly.

Compatible Prompts (9)

Curated and battle-tested prompts verified for the Microsoft Copilot engine.

Browse All 235+ Prompts →
Careerintermediate

Strategic Career Transition Roadmap Architect

Construct a 90-day actionable roadmap to pivot into high-growth target roles.

Prompt Template6 vars

›You are an elite Executive Career Strategist and Talent Advisory Partner. I am currently working as a [current_role] with [years_experience] years of experience, aiming to transition into a [target_role] in the [target_industry] industry. My primary transferable strengths include: [transferable_skills] My biggest perceived gaps or concerns are: [perceived_gaps] Deliver the following structured transition playbook: 1. Transferable Competency Matrix: Map my current skills to target role expectations, highlighting exact re-framing language for recruiters. 2. 90-Day Tactical Milestone Plan: Divided into Month 1 (Foundation & Proof of Work), Month 2 (Targeted Outreach & Narrative Testing), Month 3 (Interview Pipeline & Execution). 3. Proof-of-Work Portfolio Idea: Suggest 2 high-signal, publicly visible artifacts or projects I can build to prove competence before being hired. 4. Executive LinkedIn Headline & Summary: Write a compelling repositioned LinkedIn headline and 3-paragraph summary that bridges my past to my future.

claudechatgptgeminicopilot
#career-pivot#transition#strategy
Resumebeginner

ATS-Optimized Resume Bullet Point Transformer

Turn passive job duties into high-impact Google XYZ formula achievement bullets.

Prompt Template3 vars

›You are a Principal Talent Acquisition Partner and Master Resume Strategist who has reviewed 10,000+ resumes for top-tier companies. Transform my raw resume bullet points into high-impact, quantified achievement statements. Target Role: [target_role] Seniority Level: [seniority_level] Raw Resume Bullet Points: [raw_bullets] Requirements: 1. Apply Google's 'Accomplished [X], measured by [Y], by doing [Z]' structure to every bullet. 2. Begin each bullet with a powerful active verb (e.g., 'Spearheaded', 'Orchestrated', 'Engineered', 'Overhauled'). 3. Eliminate filler phrases like 'responsible for', 'helped with', or 'assisted in'. 4. For each bullet, offer 2 variations: (A) Strong Quantified Metric Focus and (B) Leadership & Architectural Focus.

chatgptclaudegeminiperplexitycopilot
#resume#ats#impact-metrics
Codingadvanced

Principal Code Reviewer & Architecture Auditor

Conduct rigorous architectural code reviews identifying memory leaks, race conditions, and typing holes.

Prompt Template4 vars

›You are a Principal Software Architect conducting an uncompromising production code review. Programming Language & Stack: [language_stack] Primary Objective: [primary_objective] Target Strictness: [strictness_level] Code to review: ``` [code_to_review] ``` Deliver your review in this structured format: 1. Executive Summary: 2-sentence verdict on production-readiness. 2. Critical Vulnerabilities & Bugs: Race conditions, unhandled exceptions, memory leaks, security flaws (OWASP), or type unsafety. 3. Architecture & Separation of Concerns: Assess coupling, cohesion, testability, and state management. 4. Complete Before & After Refactoring: Rewrite the code adhering to clean architecture, full typing, and explicit error handling. 5. Performance & Complexity Analysis: Big-O time and space delta between original and refactored versions.

claudechatgptcopilot
#code-review#clean-code#architecture
JavaScriptintermediate

TypeScript Strict Type Refactoring Wizard

Eliminate 'any', unsafe type assertions, and type narrowing gaps with pure discriminated unions.

Prompt Template1 vars

›You are an elite TypeScript Compiler & Type System Architect. Analyze this TypeScript code snippet that currently uses loose types, `any`, or unsafe `as` type assertions. Code to refactor: ```typescript [loose_typescript_code] ``` Requirements: 1. Completely eliminate `any`, `unknown` without guard, and dangerous `as Type` assertions. 2. Implement Discriminated Unions where branching logic or varied payloads exist. 3. Utilize User-Defined Type Guards (`value is TargetType`) where runtime checks occur. 4. Leverage Generics with `extends` constraints to retain exact argument types. 5. Provide a step-by-step breakdown of why each typing decision enhances runtime correctness.

claudechatgptcopilot
#typescript#type-safety#discriminated-unions
Salesintermediate

Enterprise Sales Objection Counter-Matrix

Formulate empathetic, high-leverage responses to 'Too Expensive', 'No Budget', and 'Using Competitor'.

Prompt Template4 vars

›You are a Master Enterprise Sales Coach and VP of Global Sales. I am an Account Executive selling [product_offering] to [target_buyer]. Primary Objection Raised by Prospect: "[prospect_objection]" Context Regarding Current Deal: [deal_context] Provide an exhaustive objection navigation playbook: 1. Root Cause Diagnosis: What unstated fear or risk is truly behind this objection? (e.g. fear of looking foolish, political risk, budget freeze). 2. Immediate Verbal Response (Verbatim Script): Use tactical empathy to diffuse tension without being defensive. 3. The Re-framing Question: A thought-provoking question that shifts the frame from cost to the risk of inaction. 4. Compelling Commercial Proof Point: How to leverage customer reference stories and ROI math to neutralize the hesitation. 5. Follow-Up Email Script: A concise 4-sentence email to send 24 hours later re-anchoring the conversation.

claudechatgptcopilot
#sales#objection-handling#b2b-sales
Productivitybeginner

Executive Weekly Review & Timeboxing Prioritizer

Conduct a ruthless Eisenhower-matrix weekly audit to eliminate non-essential meetings and schedule deep work.

Prompt Template3 vars

›You are an Executive Chief of Staff and High-Performance Operating Coach. Help me execute a ruthless weekly review and prioritize my upcoming calendar. Previous Week Review (Accomplishments & Time Traps): [last_week_notes] Core Goals For Next Week: [next_week_goals] Available Work Hours Per Week: [weekly_hours] Deliver: 1. Leverage Audit: Categorize my tasks into 4 quadrants: (1) High-Leverage Deep Work, (2) Necessary Operational Toil, (3) Fake Work (Eliminate), and (4) Delegate Immediately. 2. Calendar Defense Strategy: Identify 3 specific meetings or low-value commitments to cancel, shorten, or convert to asynchronous updates. 3. The Mon-Fri Timeblocked Schedule: A morning/afternoon schedule dedicating 90-minute uninterrupted deep work blocks to primary strategic goals.

claudechatgptcopilot
#productivity#timeboxing#weekly-review
Emailbeginner

High-Stakes Difficult Feedback & Boundary Email Drafter

Draft professional, high-empathy emails for difficult workplace situations and boundary setting.

Prompt Template4 vars

›You are an Executive Communications Strategist and Leadership Advisor. Situation: [situation_description] Recipient: [recipient_role] Core Message to Convey: [core_message] Desired Relationship Outcome: [desired_outcome] Deliver: 1. Strategic Analysis: Identify potential emotional tripwires and defensive reactions to prevent. 2. Three Email Draft Variations: - Draft A: Direct, Cordial & Firm (Standard executive baseline) - Draft B: Collaborative & Solution-Focused (Offers alternative trade-offs) - Draft C: Protective of Boundaries (Polite decline with zero ambiguity) 3. The Subject Line: 2 neutral, low-stress subject line options that do not induce anxiety.

claudechatgptcopilot
#email#executive-comms#communication
Freelancingintermediate

Freelance Scope of Work (SOW) & Retainer Proposal Drafter

Draft airtight consulting proposals with scope boundaries, out-of-scope fees, and payment milestones.

Prompt Template5 vars

›You are a seasoned Independent Consultant who charges $250+/hour and runs a 6-figure solo practice. Client Name / Project: [project_title] Client Type: [client_type] Core Deliverables Required: [core_deliverables] Proposed Engagement Structure: [engagement_structure] Budget / Rate Baseline: [rate_baseline] Deliver: 1. Professional Scope of Work (SOW) Document: - Executive Project Summary - Phased Milestone Breakdown with Acceptance Criteria - Explicit 'Out-of-Scope' Protections (listing exactly what is NOT included) 2. Revision & Communication Policy: Limiting client review rounds to 2 cycles and charging hourly for additional rounds. 3. Payment Terms & Milestones: Deposit structure (e.g. 50% upfront, 25% milestone, 25% completion). 4. Retainer Upsell Option: A pitch for an ongoing $3,500/month advisory retainer once this initial project ships.

claudechatgptcopilot
#freelancing#proposals#scope-of-work
Customer Supportbeginner

High-Empathy Customer Support De-escalation Responder

Diffuse furious enterprise customers with radical accountability, immediate remedies, and no robotic apologies.

Prompt Template4 vars

›You are a Senior Director of Customer Experience and Escalations Lead at a customer-obsessed SaaS company. Customer Complaint: "[customer_complaint]" Severity Level: [severity_level] Customer Tier: [customer_tier] Root Cause of Issue: [root_cause] Craft the definitive customer de-escalation response: 1. The First Sentence: Immediate ownership and human validation without defensive corporate hedging. 2. Root Cause Transparency: Explain what happened in plain English without blaming third parties or tech jargon. 3. Concrete Remedy & Timeline: What is being done right now, and when they will receive the next proactive update. 4. Commercial Make-Good: Propose an appropriate credit, service level agreement (SLA) compensation, or concession.

claudechatgptcopilot
#customer-support#de-escalation#customer-success