🧭 Start Here

−

This site blends two things into one reference: the practical VS Code & workflow guide for learning how to work with Copilot, and the CLI cheat sheet for fast command lookup.

📘 Part 1 — VS Code & Workflows

Chat participants, context variables, troubleshooting recipes, and prompt patterns.

⚡ Part 2 — Copilot CLI

Installation, flags, slash commands, agents, MCP, recipes, and troubleshooting.

Reading the badges: Anything marked VS Code only or CLI only applies to just that surface. Everything without a badge works in both.

Part 1

📘 VS Code & Workflow Cheat Sheet

Use Copilot as a collaborator across editing, debugging, code discovery, and daily development work.

🎯 What You'll Learn

−
  • Move beyond autocomplete and use Copilot as a collaborator.
  • Use chat participants, slash commands, and context variables for power-user workflows.
  • Use Copilot CLI in the terminal for shell, git, and troubleshooting help.
  • Apply real-world patterns for building, debugging, and explaining code and errors.

💻 Copilot in VS Code VS Code only

−

Ways to Interact

Mode Trigger Best For
Inline suggestions Just start typing Fast code completion
Inline Chat Ctrl+I / Cmd+I Quick edits and refactors in place
Chat view Ctrl+Alt+I / Cmd+Ctrl+I Multi-turn conversations, planning, explaining
Copilot Edits Ctrl+Shift+I Multi-file coordinated changes
Agent mode Chat view → Agent Autonomous multi-step tasks

Chat Participants (@)

Participant What it does Example
@workspace Knows about your entire project @workspace where is auth handled?
@vscode Knows VS Code features and settings @vscode how do I change my theme?
@terminal Knows your terminal and shell @terminal /explain
@github Queries GitHub issues, PRs, and repos @github show me my open PRs
The gem most teams miss: run a command in the integrated terminal, then ask @terminal /explain to get the flags, side effects, and safer alternatives.

Slash Commands (/)

Command Purpose
/explain Explain the selected code or command
/fix Propose a fix for the selection or diagnostic
/tests Generate unit tests for the selection
/doc Generate documentation or comments
/new Scaffold a new project or file
/newNotebook Create a new Jupyter notebook
/clear Reset the chat context
Heads up: VS Code chat slash commands are not the same list as Copilot CLI slash commands — see CLI slash commands for the terminal set.
Combine participants and slash commands: @workspace /explain how does the login flow work end to end? @terminal /explain @workspace /tests for src/services/pipeline.py

Context Variables (#)

Variable Purpose
#file Reference a specific file
#selection Current editor selection
#editor Currently active editor
#terminalLastCommand The last command you ran
#terminalSelection Highlighted terminal output
#codebase Broader codebase search
#problems Current diagnostics / problems panel
#changes Uncommitted git changes
Example prompts: /fix #problems Explain #terminalLastCommand and why it failed Refactor #selection to use async/await Summarize #changes for a commit message

Edits vs. Agent Mode:

  • Copilot Edits = coordinated changes across files you choose, with inline diff review.
  • Agent mode = give a goal, and Copilot plans, edits, runs commands, and iterates until done.

🛠️ Troubleshooting Workflows

−

Explain a Failing Terminal Command VS Code only

@terminal /explain # Copilot reads the last command and its output

Fix an Error from the Problems Panel VS Code only

/fix #problems

Understand a Stack Trace VS Code only

@workspace explain #terminalSelection and point me to the file most likely responsible

Debug with the Debugger VS Code only

why is variable X null here? # Ask in inline chat while paused on a breakpoint

Turn Changes into a Commit Message

Write a conventional commit message for #changes copilot -p "Write a conventional commit message for my staged changes"

Understand an Unfamiliar Codebase Quickly

@workspace give me a tour of this repo — entry points, main modules, and how data flows @workspace where is <feature> implemented?

🧠 Prompt Patterns That Work

−

Role + Goal + Constraints

You are a senior Python engineer. Refactor #selection to use dataclasses. Keep the public API unchanged and add type hints. Do not add new dependencies.

Ask for a Plan Before Code

@workspace outline the steps to add JWT auth to this API. Don't write code yet — just the plan and files that will change. # Then follow up with: Great — implement step 1.

Generate Tests First

/tests for #file:src/services/pipeline.py covering happy path, empty input, and network failure.

Explain Then Modify

/explain #selection Now rewrite it to stream results instead of buffering.

Use #codebase for Cross-File Reasoning

#codebase where do we validate customer IDs, and is the logic consistent everywhere?

✅ Discovery Cheat Sheet

−

Things worth trying today:

  • Run @terminal /explain after any command you don't fully understand.
  • Try /fix #problems on the next red squiggle you see.
  • Ask @workspace for a tour of the repo you joined most recently.
  • Ask Copilot to write your next commit message from #changes.
  • Install Copilot CLI and try copilot -p "..." for a quick lookup.
  • Try Agent mode on a small task, such as adding a CI status badge to the README.
  • Use /tests on a function that has no tests.
  • Ask @vscode how to configure something in the editor instead of searching the web.

🤝 Tips, Gotchas, and Etiquette

−
1
Context is king. The more relevant files and selections you add, the better the answer.
2
Iterate — don't restart. Follow-up prompts are cheaper and better than starting fresh.
3
Verify before you run. Read a suggested command, or ask Copilot to explain it first.
4
Don't paste secrets. Redact tokens, connection strings, and PII before prompting.
5
Use /clear. Reset stale context when you switch topics.
6
Keyboard shortcuts pay off. Ctrl+I (inline chat) and Ctrl+Alt+I (chat view) are the two to memorize first.

Part 2

⚡ Copilot CLI Cheat Sheet

Quick reference for installation, commands, shortcuts, flags, agents, MCP, recipes, and troubleshooting in the terminal.

⌨️ CLI Overview CLI only

−

Copilot CLI brings Copilot to the terminal — no editor required. It is ideal for scripting, ops work, git help, and quick "what does this command do?" moments.

Tool Command Best For
Copilot CLI copilot Agentic sessions that read and edit your repo
gh copilot suggest gh copilot suggest -t git "undo my last commit but keep changes staged" Getting a shell, git, or gh command suggested
gh copilot explain gh copilot explain "git rebase -i --autosquash HEAD~5" Understanding a command before you run it
Shell aliases: add ghcs / ghce with gh copilot alias -- bash >> ~/.bashrc (or the zsh / pwsh equivalent).

📦 Installation CLI only

−
Platform Command
npm (all platforms) npm install -g @github/copilot
WinGet (Windows) winget install GitHub.Copilot
Homebrew (macOS/Linux) brew install copilot-cli
Install Script (macOS/Linux) curl -fsSL https://gh.io/copilot-install | bash
Verify installation: copilot --version

🔐 Authentication CLI only

−
Command Description
copilot login Authenticate via browser-based device code flow
copilot login --host HOST Authenticate to a specific GitHub Enterprise instance
copilot logout Sign out and remove stored credentials
Alternative: Set a fine-grained PAT with Copilot Requests permission: export GH_TOKEN=your_token_here

🎮 Modes of Operation CLI only

−
Mode How to Start Description
Interactive copilot Full conversation — explore, iterate, and build
Programmatic copilot -p "prompt" One-shot prompt — get an answer and exit
Autopilot copilot --autopilot Fully autonomous mode
Agent Mode copilot --agent=NAME Use a specific custom agent
Switch modes during a session: Press Shift+Tab to cycle:
Interactive → Plan → Autopilot → Interactive

⌨️ Keyboard Shortcuts CLI only

−
Shortcut Action
Shift+Tab Cycle modes: interactive → plan → autopilot
Ctrl+T Toggle reasoning visibility (show/hide thinking)
Ctrl+S Save (e.g., when editing config)
Ctrl+G Open prompt in your default text editor
Ctrl+L Clear the terminal screen
Ctrl+C Cancel / clear input (press twice to exit)
Ctrl+D Exit the CLI session
Esc Cancel the current operation
↑ / ↓ Navigate command history
Tab Autocomplete file paths with @

🔧 Command-Line Flags CLI only

−
Flag Description
-p "prompt" / --prompt Run in non-interactive (programmatic) mode
--agent=NAME Select a specific custom agent
--model=MODEL Override the AI model (e.g., gpt-4)
--autopilot Enable autonomous mode
--yolo / --allow-all Enable all permissions (use with caution!)
--experimental Enable experimental features
--no-experimental Explicitly disable experimental features
--continue Resume your most recent session
--resume Choose from a list of previous sessions
--max-autopilot-continues N Limit autopilot continuation cycles
--config-dir PATH Use a custom configuration directory
--output-format FORMAT Specify output format (json, markdown)
--share Share session context externally
--acp Start as Agent Client Protocol server
Example — Autonomous mode with agent: copilot --agent=architect --autopilot --yolo -p "Design a microservices API"

📝 Slash Commands CLI only

−

Session Management

Command Description
/help List all available slash commands
/exit or /quit Leave the CLI session
/clear or /new Start a fresh conversation
/compact Summarize conversation to free context space
/context Show token usage visualization
/usage Display session statistics (requests, tokens, duration)
/share Export session as markdown file or GitHub gist

Code & Review

Command Description
/diff Show uncommitted changes in working directory
/review Run AI code review on your changes
/undo or /rewind Rewind the last turn and revert file changes
/pr [view|create|fix|auto] Operate on pull requests for the current branch
/copy Copy the last response to the clipboard

Configuration

Command Description
/instructions View loaded custom instruction files
/agent Browse and select custom agents
/mcp Manage MCP server connections
/model Switch between available AI models
/experimental Enable experimental features in-session
/cwd Confirm working directory scope
/add-dir PATH Allow Copilot to read/write a directory
/allow-all or /yolo Enable all permissions for this session

Advanced

Command Description
/plan [PROMPT] Create an implementation plan before coding
/fleet [PROMPT] Enable parallel subagent execution of parts of a task
/delegate TASK Push session to Copilot coding agent on GitHub
/remote Enable remote access from GitHub.com and GitHub Mobile
/research TOPIC Run a deep research investigation using GitHub search and web sources
/tasks View and manage background tasks (subagents and shell sessions)
/skills Manage skills for enhanced agent capabilities
/changelog [VERSION] Show the CLI changelog
/login Authenticate (if not already logged in)

🔤 Special Prefixes CLI only

−
Prefix Purpose Example
@ Include file contents in prompt @src/Program.cs Explain this file
! Run shell command (bypasses AI) !git status
& Shortcut for /delegate & complete the API tests

Quick Mental Model:

  • @ = "Hey Copilot, look at this file"
  • ! = "Hey terminal, run this command"
  • & = "Hey GitHub, take this task and run with it"

🤖 Custom Agents

−

Custom agents are specialized AI personas defined in .github/agents/.

Command Description
/agent Browse available agents in-session
copilot --agent=NAME Start session with specific agent
copilot --agent=NAME -p "..." One-shot prompt with agent

Example Agents:

🏗️ blueprint / architect System architecture & design
🔨 forge / developer Code implementation
🛡️ shield / reviewer Code review & security
📚 sage / doc-writer Documentation generation

🔌 MCP (Model Context Protocol)

−

MCP extends Copilot with external tools and data sources.

Command Description
/mcp View and manage MCP server connections
@server-name Reference a specific MCP server in prompts
Config locations:
  • CLI: .github/copilot/mcp.json
  • VS Code: .vscode/mcp.json
Example MCP query: Using @microsoft-learn, explain EF Core migrations

🧩 Plugins CLI only

−
Command Description
copilot plugin marketplace list List available plugin marketplaces
copilot plugin marketplace add NAME Add a plugin marketplace
copilot plugin install NAME Install a plugin
copilot plugin list List installed plugins
Default marketplaces: copilot-plugins, awesome-copilot

📁 Custom Instructions

−

Copilot automatically loads instruction files from your repo:

.github/
├── copilot-instructions.md          ← Global: always included
└── instructions/
    ├── csharp.instructions.md       ← Conditional: *.cs files
    └── razor.instructions.md        ← Conditional: *.cshtml files
View loaded instructions: /instructions

🎯 CLI Quick Recipes CLI only

−

Explore a New Codebase

copilot > What is the structure of this project? > @README.md Summarize the key features > @src/main.ts Explain the entry point

Code Review Workflow

copilot > /diff > /review > /share

Autonomous Feature Implementation

copilot --autopilot --yolo -p "Add input validation to the user registration form"

Delegate to Copilot Coding Agent

copilot > Design a REST API for user management > /delegate implement this design and open a PR

Quick Lookup (Non-Interactive)

copilot -p "What does the --no-restore flag do in dotnet build?"

Switch Model Mid-Session

/model # Select from available options

Session Continuity

Resume most recent session copilot --continue
Choose from session history copilot --resume
Export session for sharing /share

⚡ CLI Power Tips CLI only

−
1
Batch context loading: Reference multiple files at once: @src/models/User.cs @src/models/Task.cs Compare these models
2
Context management: When your context fills up, use /compact to summarize and free space.
3
Tab completion: Type @ then start typing a file path — use Tab to autocomplete.
4
Escape hatch: Use ! for quick shell commands without leaving your conversation.
5
Trust once: Choose "Yes, and remember this folder" to skip the trust prompt next time.
6
Model switching: Use /model to balance speed vs. capability based on task complexity.
7
Session export: Use /share to save design discussions as markdown for team review.

🪙 Token Optimization

−

Token optimization means giving Copilot enough relevant context to help, without noisy oversized prompts that burn through the context window.

Practice Why it helps
Start narrow Attach the smallest useful file, selection, or error before expanding to broader codebase context
Summarize long output Paste only the failing section or stack trace instead of full logs
State explicit goals Task, constraints, and desired output mean fewer turns spent inferring intent
Reset stale context Use /clear for topic changes and /compact to summarize long sessions
Prefer references over copies Use #file in VS Code or @path/to/file in the CLI instead of pasting whole documents
Ask for a plan first A plan surfaces missing context before tokens are spent going the wrong direction
Efficient prompt pattern: Goal: fix the failing auth test. Context: #problems and the auth test only. Constraint: do not change the public API. First explain likely causes, then propose the smallest fix.

🆘 CLI Troubleshooting CLI only

−
Issue Solution
copilot: command not found Ensure npm global bin is in PATH: npm bin -g
Custom agents not appearing Run from repo root, check .github/agents/ exists
MCP server not connecting Verify Node.js 22+, check JSON config syntax
Session context full Run /compact to summarize and free space
Authentication expired Run /login or copilot login

📚 Resources

−