Introduction
This cheat sheet summarizes key practices from the GitHub Copilot Playbook for .NET & Azure developers.
Foundations π§ β
-
π‘ Copilot is an assistant, not an authority
- You own design, correctness, security, and compliance.
-
β Use in supported environments
- Visual Studio 2022 version 17.8 or later for C#/.NET and Azure projects.
- VS Code for full-stack work (C#, TypeScript, Bicep/Terraform, YAML, etc.).
-
π§° Core capabilities
- Inline completions, Chat, PR review, Copilot CLI, custom prompts, instructions, agents, and MCP-backed tools.
Copilot Modes (When to Use What) ποΈβ
- Ask (chat) β Questions, explanations, small suggestions.
- Edit β Scoped changes to selected code or files; keep diffs small.
- Plan β Larger work (migrations, new features, major refactors); get a step-by-step plan first.
- Agent β Copilot Coding Agent or specialized agents to execute plans across files/tools; always tightly scope and review via PR.
- Custom β Repo/org-specific prompts, instructions, and agents (including from awesome-copilot) for repeatable workflows.
β Rule of thumb: Ask β Plan β Edit/Agent, always with human review and tests.
Choosing Models π§ͺβ
- GPT-5.1 (Preview) β Complex refactors, architecture, security-sensitive flows, large documentation.
- GPT-4o β Fast, localized edits, prototypes, simple scripts, lightweight docs.
- Coding-optimized variants (e.g., GPT-5.1 Codex) β Code-heavy work in one stack, stronger completions.
- Reasoning-optimized models (e.g., Claude Sonnet 4.5, Claude Opus 4.5, Gemini 3 Pro) β Deep analysis of specs/logs, cross-system design, trade-off analysis.
π Check LiveBench and your orgβs evaluations to keep defaults up to date.
High-Value Workflows πβ
-
π Greenfield features
- Clarify user story β ask Copilot for design outline β generate scaffolding β refine β review & test.
-
π§ Maintenance / refactors
- Explain legacy code β propose safer modern patterns (DI, async, logging) β refactor in small steps β run tests.
-
π§ͺ Tests & automation
- Generate xUnit/NUnit/MSTest, bUnit, and integration tests; you add edge cases and prune brittle tests.
-
π Docs & knowledge capture
- Use Copilot to write XML docs, architecture notes, and playbook updates close to the code.
- GPT models are better for writing XML docs, while Claude models are better for writing Markdown files.
-
βοΈ Azure workflows
- IaC (Bicep/Terraform/ARM), Azure Functions, CI/CD (GitHub Actions/Azure DevOps) with Copilot scaffolding followed by manual hardening.
Prompting Essentials βοΈβ
-
β Good patterns
- Role + context + constraints.
- Step-by-step (outline first, then details).
- Ask for specific formats (checklists, tables, PR descriptions).
-
β οΈ Avoid
- "Do everything" prompts that produce huge diffs.
- Policies/legal text/compliance commitments from Copilot.
- Suggestions that introduce secrets or personal data.
Context & Slash Commands π―β
- Implicit context
- Copilot pays extra attention to open tabs. Keep relevant files open and close noisy ones before asking for help.
- Explicit context variables
@workspaceβ ask about the overall project/solution.#fileβ point Copilot at a specific file.#selectionβ focus on the currently selected code.
- Slash commands (VS Code/VS)
/explainβ explain selected code./fixβ propose a fix for an error or warning./testsβ generate tests for the selection./docβ generate documentation/comments.
Prompt Templates (Examples) π§Ύβ
- New feature β Design + implement
- "You are assisting with a .NET [app type] deployed to Azure [service]. I need to implement [feature]. Given these files [list], propose a design and then generate minimal code changes following our existing patterns, DI, async, and logging conventions."
- Bug fix β Root cause + focused patch
- "In this .NET [project type], observed behavior: [x], expected: [y]. Here is the relevant code: [files]. Identify likely root cause and propose a small, focused fix plus any missing tests."
- Tests β Coverage you can trust
- "Generate [xUnit/NUnit/MSTest] tests for this class. Cover happy path, validation failures, and key edge cases using Arrange-Act-Assert and clear test names."
Promote successful patterns into shared .prompt.md files under .github/prompts.
Safety & Responsible Use π‘οΈβ
-
π Secrets & data
- No passwords, connection strings, tokens, certificates, or real customer data in prompts.
- Use Key Vault, managed identity, environment variables, and user secrets.
-
π Human-in-the-loop
- All Copilot-assisted changes go through normal design/code review and appropriate tests.
-
β Quality & security
- Run tests, linters, and security tools. Be extra careful with auth, crypto, input validation, data access, and infra.
-
βοΈ Bias & fairness
- Avoid logic based on protected characteristics; test AI-influenced logic with diverse synthetic data.
-
π MCP servers
- MCP servers can execute code and access system resources, posing security risks if compromised.
- Only use MCP servers from trusted sources and verify their code before installation.
- Apply least-privilege principles and monitor MCP server activity for suspicious behavior.
Team Practices π₯β
-
π Code review with Copilot
- Use Copilot to summarize PRs, suggest tests, and flag risky changesβbut reviewers remain accountable.
-
π¦ Shared assets
- Store prompts, instructions, and agents in the repo (
.github/prompts,.github/instructions,*.agent.md). - Reuse and adapt high-quality assets from awesome-copilot.
- Store prompts, instructions, and agents in the repo (
-
π§ Onboarding
- Walk new devs through this cheat sheet, playbook, your Copilot instructions, prompts, agents, MCP setup, and review expectations.
Key External Resources πβ
-
π GitHub Copilot Quickstart
- Official getting-started guide, installation, and basic workflows
-
π§° awesome-copilot
- Curated prompts, instructions, agents, and patterns to extend this playbook
-
π§© awesome-mcp-servers
- Catalog of Model Context Protocol (MCP) servers you can connect to Copilot-compatible tools for controlled access to external systems
-
π‘ MDC GitHub Copilot Playbook
- Day-to-day workflows, prompt patterns and guardrails to help MDC developers
π§ Use this cheat sheet as a quick reference; consult the full playbook for deeper guidance and examples.