GitHub Copilot CLI is the terminal interface for agentic coding work. It can inspect and edit files, run commands, manage sessions, delegate tasks, and connect to GitHub and VS Code.
You can use this cheat sheet to find its commands, shortcuts, flags, environment variables, permission controls, and customization paths. The VS Code companion section lists Chat commands, context variables, participants, and inline suggestion shortcuts.
Enter /help inside Copilot CLI to open the installed command list. In VS Code Chat, type /, #, or @ to open live lists filtered by extension version, chat context, and organization policy.
Last updated: August 8, 2026.
GitHub Copilot CLI quick reference
The ! prefix executes one command directly. Enter ! alone to stay in shell mode for several commands, then press Esc or Ctrl+C on an empty prompt to return. A lone $ hands the terminal to $SHELL on Unix or %COMSPEC% on Windows. Exit that shell to restore Copilot CLI.
| Syntax | Action |
|---|---|
copilot | Start the interactive terminal interface. |
/command | Run an interactive Copilot command. |
@ path | Attach a file to the current prompt. |
# number | Attach a GitHub issue or pull request. |
! command | Run a local shell command outside the agent tool flow. |
$ | Suspend the interface and open a real interactive shell. |
--flag | Set startup or programmatic behavior. |
COPILOT_* | Configure the process through environment variables. |
Start here
| Task | Command or shortcut |
|---|---|
| Start an interactive session | copilot |
| Sign in | copilot login or /login |
| Initialize repository instructions | copilot init or /init |
| Open command help | copilot help or /help |
| Resume the latest session | copilot --continue |
| Choose a saved session | copilot --resume or /resume |
| Switch Standard, Plan, and Autopilot | Shift+Tab |
| Start with a selected mode | copilot --mode=MODE |
| Select a model | copilot --model=MODEL or /model |
| Review current changes | /diff (experimental) |
| Undo the previous turn | /undo |
| Connect to VS Code | /ide |
| End the session | /exit, /quit, or Ctrl+D |
Install and authenticate Copilot CLI
Install Copilot CLI with npm, WinGet, Homebrew, the shell installer, or a standalone binary. It is also included in the default Codespaces image and available as a Dev Container Feature.
Run copilot version after installation. Run copilot update to install an available release. copilot completion bash, copilot completion zsh, and copilot completion fish print shell-completion scripts for those shells.
npm install -g @github/copilot
winget install GitHub.Copilot
brew install --cask copilot-cliTop-level commands
| Command | Purpose |
|---|---|
copilot | Launch the interactive interface. |
copilot completion SHELL | Print tab-completion setup for Bash, Zsh, or Fish. |
copilot help [TOPIC] | Read help for commands, configuration, billing, providers, logging, permissions, monitoring, or sandboxing. |
copilot init | Analyze the repository and create or update Copilot instructions. |
copilot login [OPTION] | Authenticate through a browser or device-code flow. |
copilot mcp | Manage MCP server definitions outside an interactive session. |
copilot plugin | Manage plugins and plugin marketplaces. |
copilot plugins list | Inspect discovered plugins, MCP servers, skills, instructions, and language servers. |
copilot skill | List, add, or remove agent skills. |
copilot update | Install the latest CLI version. |
copilot version | Print the installed version and check for updates. |
On a local terminal, copilot login starts a browser flow. Remote terminals and CI environments use the device-code flow by default. Use --web-flow or --device-code to choose explicitly. Add --host https://HOSTNAME for a GitHub Enterprise Cloud account with data residency.
Copilot checks authentication variables in this order:
COPILOT_GITHUB_TOKENGH_TOKENGITHUB_TOKEN- OAuth token in the operating-system credential store
- GitHub CLI authentication fallback
Copilot CLI slash commands
| Command | Action |
|---|---|
/ask QUESTION | Ask a side question without adding it to conversation history. |
/clear [PROMPT], /new [PROMPT], /reset [PROMPT] | Start a fresh conversation, with an optional first prompt. |
/compact [FOCUS] | Summarize history and preserve the named focus. |
/context | Display context-window use. |
/copy | Copy the latest response. |
/cwd, /cd [PATH] | Show or change the working directory. |
/refine TEXT | Rewrite rough prompt text for review before submission. |
/restart | Restart the CLI and preserve the active session. |
/search [QUERY], /find [QUERY] | Search the session timeline. Experimental. |
/help | Display the installed interactive command list. |
Sessions, history, and sharing
| Command | Action |
|---|---|
/resume [ID], /continue [ID] | Open another local or remote session. |
/rename [NAME] | Name the current session. |
/session info | Show identifiers, links, and session details. |
/session checkpoints [N] | List recent restoration points. |
/session files | List files associated with the session. |
/session plan | Display the current session plan. |
/session cleanup | Clean session data through the built-in manager. |
/session prune | Prune stored sessions. |
/session delete [ID] | Delete one saved session. |
/session delete-all | Delete all saved sessions after confirmation. |
/fork [NAME], /branch [NAME] | Fork the conversation into another session. Experimental. |
/share, /export | Create a link or export the session. |
/share file [PATH] | Export the transcript as Markdown. |
/share html [PATH] | Export the transcript as HTML. |
/share gist | Create a GitHub gist from the session. |
/share off | Stop link sharing. |
Models, reasoning, plans, and autonomy
| Command | Action |
|---|---|
/model [MODEL], /models | Select Auto or a model for the current session. |
/model --global MODEL | Save the default for future sessions. |
/model --repo MODEL | Save a repository model setting. |
/plan [PROMPT] | Analyze a task and prepare an implementation plan. |
/autopilot, /goal | Start or refocus an autonomous objective. Experimental. |
/limits | Open response-limit controls. |
/limits set max-ai-credits VALUE | Set a soft AI Credits limit per response. |
/limits unset max-ai-credits | Remove the response credit limit. |
/rubber-duck [PROMPT] | Request a second opinion on a plan, implementation, or test set. |
Agents, research, review, and delegation
| Command | Action |
|---|---|
/agent | Browse and choose a custom agent. |
/agents, /subagents | Configure subagent models. |
/tasks | Inspect background subagents and shell commands. |
/fleet [PROMPT] | Split suitable work across parallel subagents. |
/delegate [PROMPT] | Send work to a remote repository and create an AI-generated pull request. |
/research TOPIC | Run a source-backed GitHub and web investigation. |
/review [PROMPT] | Invoke the code-review agent on current changes. |
/security-review [PROMPT] | Inspect active local changes for high-confidence security defects. |
/pr view | Show the pull request for the current branch. |
/pr create | Create a pull request. |
/pr fix | Repair pull request issues. |
/pr auto | Work until the pull request reaches green status. |
/pr automerge | Work until green status, then merge under repository controls. |
Compare terminal agents: Claude Code Commands Cheat Sheet
Files, directories, and worktrees
| Command | Action |
|---|---|
/add-dir PATH | Grant file access to another directory. |
/list-dirs | Display directories approved for file access. |
/reset-allowed-tools | Clear the saved allowed-tool list. |
/permissions reset | Clear in-memory tool and path approvals for this session. |
/diff | Review working-tree changes or the branch diff. Experimental. |
/worktree [BRANCH] | Start work in a new Git worktree. Experimental. |
/worktree new [PROMPT] | Open a new conversation in a new worktree. Experimental. |
/move [BRANCH|TASK] | Move uncommitted changes to a new worktree. Experimental. |
Configuration, extensions, and interface controls
| Command | Action |
|---|---|
/settings, /config | Open the settings manager. |
/settings show KEY | Display the effective value of a setting. |
/settings KEY VALUE | Save a user setting. |
/settings --repo KEY VALUE | Save an overridable repository setting. |
/settings --local KEY VALUE | Save an untracked local repository setting. |
/env | List loaded instructions, agents, skills, hooks, plugins, MCP servers, LSPs, and extensions. |
/extensions, /extension | Manage CLI extensions. |
/lsp show | Show language-server configuration. |
/lsp test SERVER | Test a language server. |
/lsp reload | Reload language-server configuration. |
/statusline, /footer | Configure status-line fields. |
/terminal-setup | Configure multiline terminal input. |
/theme [NAME] | Select a terminal color theme. |
/voice [ACTION] | Configure voice input with on, off, models, or devices. |
/app | Open the Copilot app or show its download page. |
Maintenance, diagnostics, and account commands
| Command | Action |
|---|---|
/changelog, /release-notes | Display release history, with optional version range or summary. |
/chronicle standup | Generate a standup from session history. |
/chronicle tips | Find usage tips from past sessions. |
/chronicle improve | Analyze session habits. |
/chronicle reindex | Rebuild the session-history index. |
/experimental [ACTION] | Manage experimental features with on, off, or show. |
/feedback, /bug | Send product feedback. |
/usage | Show per-session and per-model usage. |
/version | Display the installed version. |
/update, /upgrade | Install the latest release. |
/downgrade VERSION | Install a selected version on supported team accounts. |
/user show | Show the active GitHub account. |
/user list | List saved accounts. |
/user switch | Change the active account. |
/logout | Remove the active login. |
/clikit [COMPONENT], /tuikit [COMPONENT] | Preview internal CLI interface components. |
Remote control and scheduled work
| Command | Action |
|---|---|
/remote | Show remote-control status. |
/remote on | Enable steering from GitHub.com or GitHub Mobile. |
/remote off | End the remote connection. |
/ide | Connect, switch, or disconnect a trusted VS Code workspace. |
/keep-alive on | Prevent sleep during an active session. |
/keep-alive busy | Prevent sleep during agent work. |
/keep-alive DURATION | Prevent sleep for a fixed period. |
/after DELAY PROMPT | Schedule one action in the current session. Experimental. |
/every INTERVAL PROMPT | Schedule a recurring action in the current session. Experimental. |
Copilot CLI keyboard shortcuts
Global and input shortcuts
| Shortcut | Action |
|---|---|
? on an empty prompt | Open quick help. |
Esc | Cancel the current operation; press twice to stop the running turn. |
Ctrl+C | Cancel, clear input, or exit after a second press. |
Ctrl+D | Shut down the CLI. |
Ctrl+G | Edit the prompt in the configured external editor. |
Ctrl+L | Clear the screen. |
Ctrl+Q or Ctrl+Enter | Queue input during agent work. |
Ctrl+R | Search input history in reverse. |
Ctrl+V | Paste clipboard content as an attachment. |
Ctrl+X, then / | Run a slash command without discarding typed prompt text. |
Ctrl+X, then e | Open typed prompt text in the external editor. |
Ctrl+X, then b | Move the active task or shell command to the background. |
Ctrl+X, then o | Open the newest link in the timeline. |
Shift+Enter | Insert a newline where the terminal supports it. |
Alt+Enter on Windows/Linux | Insert a newline. |
Option+Enter on macOS | Insert a newline. |
Shift+Tab | Cycle Standard, Plan, and Autopilot. |
Tab or Ctrl+Y | Accept the current inline input completion. |
Timeline, sessions, and diff shortcuts
| Context | Main keys |
|---|---|
| Timeline | Ctrl+F search, Ctrl+O expand recent items, Ctrl+E expand all, Ctrl+T toggle reasoning, Page Up and Page Down scroll. |
| Session picker | Arrow keys select, Enter opens, s changes sort, Tab switches local and remote, d deletes, Esc closes. |
| Diff viewer | j and k move by line, h and l change file, g and G jump to ends, c comments, s summarizes comments, b toggles branch diff, w hides whitespace changes. |
Modes, permissions, and safety
Standard, Plan, and Autopilot
| Mode | Behavior |
|---|---|
| Standard | The agent works interactively and follows the active permission policy. |
| Plan | The agent inspects the repository, resolves requirements, and prepares a plan before file edits. |
| Autopilot | The agent continues through tool calls and follow-up turns until completion or a configured limit. |
Permission modes and patterns
| Flag | Effect |
|---|---|
--allow-tool=PATTERN | Approve a matching tool without another prompt. |
--deny-tool=PATTERN | Block a matching tool. Deny rules win over allow rules. |
--allow-url=URL | Approve a URL or domain. |
--deny-url=URL | Block a URL or domain. |
--add-dir=PATH | Add a readable or writable directory. |
--allow-all-tools | Approve every tool. |
--allow-all-paths | Remove path verification. |
--allow-all-urls | Approve every URL. |
--allow-all | Apply all three elevated settings. |
--available-tools=LIST | Expose only selected tools to the model. |
--no-ask-user | Remove the agent’s ability to pause for a question. |
Permission patterns use Kind(argument). Supported kinds include read, write, shell, url, memory, and an MCP server name.
copilot --allow-tool='shell(git:*)' --deny-tool='shell(git push)'
copilot --allow-tool='github(create_issue)'
copilot --deny-tool='write(secret.txt)'The :* suffix in shell(git:*) matches the command stem followed by a space. A deny rule takes priority even when an allow-all option is active. Path checks resolve symlinks and path traversal segments before matching.
Sandbox and change review
/sandbox status displays OS-level shell sandbox status. /sandbox policy prints effective filesystem and network rules. /sandbox enable and /sandbox disable change the active setting. Startup flags --sandbox and --no-sandbox apply to one session and require experimental mode.
Use /diff before accepting a large set of changes. Add line comments inside the diff viewer and submit them together. Use /undo immediately after a bad turn. Keep Git commits as durable checkpoints for work that spans several turns or external tools.
Command-line flags for sessions and automation
Session and interface flags
| Flag | Purpose |
|---|---|
-C DIRECTORY | Change directory before startup. |
-i PROMPT, --interactive=PROMPT | Start an interactive session and run the first prompt. |
-n NAME, --name=NAME | Name a new session. |
--continue | Resume the newest session for the current directory. |
-r, --resume[=VALUE] | Open the session picker or resume by ID, prefix, or exact name. |
--session-id ID | Address an exact session or create one with a valid UUID. |
--connect[=ID] | Connect to a remote session. |
--remote | Enable remote steering. |
--remote-export | Export the session for read-only remote viewing. |
--attachment PATH | Attach a file to the initial prompt. |
--model=MODEL | Select a model or auto. |
--reasoning-effort=LEVEL | Set low, medium, high, xhigh, or max where supported. |
--context=default|long_context | Choose a context tier for supported models. |
--screen-reader | Enable screen-reader adjustments. |
--no-color | Remove terminal color output. |
--mouse=on|off | Choose CLI mouse capture or native terminal selection. |
Programmatic mode
-p runs one prompt and exits. -s prints only the agent response. --output-format=json emits JSON Lines for automation. The process waits for background agents and shell commands before exit, subject to COPILOT_TASK_WAIT_TIMEOUT_SECONDS.
copilot -sp "Summarize the request flow and list the main entry points"
copilot -p "Fix the failing unit tests and report changed files" \
--allow-tool='read,write,shell(npm test)' \
--output-format=json
copilot -C ./services/api --plan -i "Plan the authentication migration"Use --secret-env-vars=NAME for extra secrets that need output redaction. GitHub token values receive default redaction. --share=PATH saves a Markdown transcript after a programmatic run, and --share-gist publishes a secret gist. Session transcripts can contain source code, prompts, paths, and tool output. Inspect them before sharing.
Repository-controlled hooks, extensions, and workspace MCP servers stay disabled in prompt mode unless the folder is trusted or the matching opt-in environment variable is set. This protects unattended jobs from executable configuration committed by an untrusted repository.
Copilot CLI environment variables
Authentication, directories, and runtime
| Variable | Purpose |
|---|---|
COPILOT_GITHUB_TOKEN | Highest-priority GitHub authentication token. |
GH_TOKEN | Second-priority token. |
GITHUB_TOKEN | Third-priority token. |
GH_HOST | GitHub hostname shared with GitHub CLI. |
COPILOT_GH_HOST | Copilot-only hostname override. |
COPILOT_HOME | Configuration and state directory; default is $HOME/.copilot. |
COPILOT_CACHE_HOME | Cache location for updates and marketplace data. |
COPILOT_EDITOR | Prompt editor checked after VISUAL and EDITOR. |
COPILOT_AUTO_UPDATE | Set false to disable automatic CLI and first-party plugin updates. |
COPILOT_ENABLE_HTTP2 | Set 1 or true to use HTTP/2 transport. |
COPILOT_ALLOW_ALL | Set true for all permissions. |
COPILOT_MODEL | Select the model for the process. |
Context, skills, and unattended work
| Variable | Purpose |
|---|---|
COPILOT_CUSTOM_INSTRUCTIONS_DIRS | Add comma-separated instruction directories. |
COPILOT_SKILLS_DIRS | Add comma-separated skill directories. |
COPILOT_LARGE_OUTPUT_THRESHOLD_BYTES | Set the direct tool-output threshold; default is 20 KiB. |
COPILOT_MCP_TOOL_CACHE | Set false to disable MCP tool snapshot caching. |
COPILOT_PROMPT_FRAME | Set 1 or 0 to override the decorative prompt frame. |
COPILOT_STRIP_REASONING_ON_RESUME | Set 0 or false to retain BYOK reasoning tokens across resume. |
COPILOT_SUBAGENT_MAX_CONCURRENT | Set concurrent subagent capacity within account limits. |
COPILOT_SUBAGENT_MAX_DEPTH | Set the maximum subagent nesting depth. |
COPILOT_TASK_WAIT_TIMEOUT_SECONDS | Set how long prompt mode waits for background work. |
COPILOT_WEB_FETCH_ALLOW_LOCALHOST | Set 1 to let web_fetch reach a local development server. |
GITHUB_COPILOT_PROMPT_MODE_EXTENSIONS | Set true to load project extensions in prompt mode. |
GITHUB_COPILOT_PROMPT_MODE_REPO_HOOKS | Set true to load repository hooks in prompt mode. |
GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP | Set true to load workspace MCP servers in prompt mode. |
PLAIN_DIFF | Set true to disable rich diff rendering. |
USE_BUILTIN_RIPGREP | Set false to use the system rg executable. |
BYOK and offline variables
BYOK supports OpenAI-compatible endpoints, Azure OpenAI, and Anthropic. OpenAI-compatible endpoints include local services such as Ollama when their selected model supports streaming and tool calls.
| Variable | Purpose |
|---|---|
COPILOT_PROVIDER_BASE_URL | Provider API endpoint. Required for BYOK. |
COPILOT_PROVIDER_TYPE | openai, azure, or anthropic; default is openai. |
COPILOT_PROVIDER_API_KEY | Provider credential when the endpoint requires one. |
COPILOT_MODEL | Provider model or Azure deployment identifier. |
COPILOT_OFFLINE | Set true to stop GitHub network requests. |
Logging and OpenTelemetry
Use --log-level=none|error|warning|info|debug|all|default and --log-dir=PATH for local logs. OpenTelemetry is disabled until an enabling variable is present.
| Variable | Purpose |
|---|---|
COPILOT_OTEL_ENABLED | Set true to enable OpenTelemetry. |
OTEL_EXPORTER_OTLP_ENDPOINT | Set the OTLP collector endpoint and enable telemetry export. |
COPILOT_OTEL_EXPORTER_TYPE | Select otlp-http or file. |
COPILOT_OTEL_FILE_EXPORTER_PATH | Write telemetry signals to a file. |
OTEL_EXPORTER_OTLP_PROTOCOL | Select http/json or http/protobuf. |
OTEL_SERVICE_NAME | Override the default github-copilot service name. |
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT | Set true to record prompts, responses, and tool data. |
Custom instructions, agents, skills, plugins, hooks, and MCP
| Feature | Best use |
|---|---|
| Custom instructions | Persistent repository or personal rules loaded automatically. |
| Prompt files | Reusable IDE prompt templates invoked manually. |
| Custom agents | Named specialist roles with selected tools and models. |
| Agent skills | Task-specific procedures and resources loaded on demand. |
| Plugins | Installable bundles of agents, skills, hooks, MCP servers, and extensions. |
| Hooks | Deterministic commands at agent lifecycle events. |
| MCP servers | External tools, services, APIs, and live data. |
Custom instructions
copilot init and /init analyze the repository and create or improve .github/copilot-instructions.md. Good repository instructions record build, test, and lint commands, architecture boundaries, generated files, coding conventions, and release constraints.
Copilot CLI merges instructions found in these locations:
.github/copilot-instructions.md.github/instructions/**/*.instructions.mdAGENTS.md,CLAUDE.md, andGEMINI.mdin the Git root and working directory$HOME/.copilot/copilot-instructions.md$HOME/.copilot/instructions/**/*.instructions.md- Extra directories in
COPILOT_CUSTOM_INSTRUCTIONS_DIRS
Instruction files can import another file with a line that starts with @path. Use /instructions to inspect and toggle loaded sources. Use /env to confirm the effective customization set. --no-custom-instructions starts a session without these files.
Prompt files
Prompt files live in .github/prompts/*.prompt.md and are invoked from supported IDEs. They package a repeatable prompt with variables and context for a focused action, such as test generation or an API review. Copilot CLI does not load prompt files as a native customization type. Use a skill or a command file for a reusable CLI action.
Custom agents
Project agents live in .github/agents/ or .claude/agents/. Personal agents live in ~/.copilot/agents/. The file name becomes the agent ID. The required description tells Copilot when to use it; optional fields set name, model, tools, inference behavior, and MCP servers.
---
name: test-reviewer
description: Reviews unit tests for missing cases and brittle assertions
tools:
- view
- grep
---
Review tests only. Report findings with file paths and line numbers. Do not edit files.Select an agent with /agent or start directly with copilot --agent=test-reviewer. A read-only agent should omit write and shell tools. Built-in agents handle exploration, command execution, code review, research, security review, and general delegated work.
Agent skills and commands
A skill is a directory with SKILL.md. Project skills can live under .github/skills/, .claude/skills/, or .agents/skills/. Personal skills can live under ~/.copilot/skills/ or ~/.agents/skills/. A valid skill declares name and description in YAML frontmatter.
---
name: release-check
description: Checks version, changelog, tests, and package contents before release
---
Read the project release policy. Run the documented checks and report every failure.Copilot selects a relevant skill automatically, or you can invoke /release-check. Use /skills list, /skills info NAME, /skills add, /skills remove, and /skills reload for management. Individual Markdown commands under .claude/commands/ provide a lighter alternative and have lower precedence than a skill with the same name.
Read More: Most Popular Agent Skills on GitHub for Coding Agents
Plugins
Open the plugin dashboard with /plugins. Use /plugins install SOURCE, /plugins update NAME, and /plugins uninstall NAME for lifecycle management. Marketplace commands add, remove, list, and browse registries. copilot plugins list --json provides a machine-readable inventory outside an interactive session.
Review a plugin before installation, as it can include executable hooks, MCP servers, agents, and skills. Disable one component with copilot plugins disable NAME --mcp, --skill, or --plugin.
Hooks
Hooks live in .github/hooks/*.json. They run deterministic shell commands at defined lifecycle events. Suitable jobs include formatting edited files, checking commands before execution, enforcing path rules, or scanning output for secrets. Review repository hooks before trusting the checkout because they execute code.
MCP servers
Persistent personal MCP configuration lives at ~/.copilot/mcp-config.json. Repository and workspace servers can come from .github/mcp.json or .mcp.json. One-session configuration uses --additional-mcp-config=JSON or --additional-mcp-config=@FILE.
copilot mcp add local-tools -- npx -y @example/mcp-server
copilot mcp add --transport http team-api https://example.com/mcp
copilot mcp list --jsonUse /mcp list, /mcp show NAME, /mcp add, /mcp edit, /mcp disable, /mcp enable, /mcp auth NAME, and /mcp reload during a session. Every MCP tool call requires permission. Remote servers receive the lowest level of trust and always require review. When server names collide, session configuration wins, followed by plugin, workspace, and personal configuration.
Related reference: OpenAI Codex Commands Cheat Sheet (2026)
Connect Copilot CLI to VS Code
Copilot CLI automatically connects when its working directory matches a trusted workspace open in VS Code. Run /ide to inspect the connection, switch workspaces, or disconnect.
The connection shares the active editor selection, diagnostics, workspace trust, and change-review interface. Select code in VS Code, then enter Debug this in the CLI. Proposed edits can open as side-by-side VS Code diffs with accept and reject controls. Elevated edit permission applies changes directly and skips that approval diff.
VS Code’s Sessions view displays CLI transcripts for the current workspace. A saved CLI session can resume in the integrated terminal from that view.
VS Code Copilot Chat cheat sheet
Chat modes
| Mode | Use it for |
|---|---|
| Ask | Questions, explanations, and code suggestions without autonomous repository edits. |
| Plan | Detailed implementation planning before code changes. |
| Agent | Multi-step work that reads files, edits code, runs commands, and iterates. |
| Edit | Direct edits across selected files in client versions that expose this mode. |
VS Code slash commands
| Command | Action |
|---|---|
/clear | Start a new chat session. |
/explain | Explain code in the active editor. |
/fix | Propose a repair for selected code. |
/fixTestFailure | Diagnose and repair a failing test. |
/help | Display Chat basics and available features. |
/new | Create a new project. |
/tests | Generate tests for selected code. |
VS Code chat variables
| Variable | Context added |
|---|---|
#block | Current code block. |
#class | Current class. |
#comment | Current comment. |
#file | Current or named file content. |
#function | Current function or method. |
#line | Current line. |
#path | File path. |
#project | Project context. |
#selection | Selected editor text. |
#sym | Current symbol. |
VS Code chat participants
| Participant | Specialty |
|---|---|
@github | GitHub repositories, issues, pull requests, and GitHub skills. |
@terminal | Terminal commands and visible shell context. |
@vscode | VS Code commands, settings, and editor features. |
@azure | Azure services and deployment context; availability is preview-dependent. |
@workspace | Workspace architecture and cross-file questions where present. |
Useful VS Code prompt patterns
/explain #selection
/fix #file:src/auth.ts Keep the public API unchanged and add a regression test.
@workspace Trace the request from the HTTP route to the database write. List files in execution order.
@terminal Explain the latest test failure and identify the first actionable error.
#file:src/cache.ts #file:test/cache.test.ts Add tests for expiration and concurrent reads.VS Code inline suggestion shortcuts
| Action | macOS | Windows and Linux |
|---|---|---|
| Accept suggestion | Tab | Tab |
| Dismiss suggestion | Esc | Esc |
| Show next suggestion | Option+] | Alt+] |
| Show previous suggestion | Option+[ | Alt+[ |
| Trigger suggestion | Option+\ | Alt+\ |
| Open additional suggestions | Ctrl+Return | Ctrl+Enter |
Platform and customization matrix
| Surface | Main strengths | Customization notes |
|---|---|---|
| Copilot CLI | Terminal agent, automation, sessions, permissions, plugins, skills, hooks, MCP. | Instructions, agents, subagents, skills, hooks, and MCP are supported. Prompt files are absent. |
| VS Code | Inline completion, Chat, local agents, visual diffs, CLI connection. | Full instructions, prompt files, agents, subagents, skills, and MCP; hooks remain preview-dependent. |
| Visual Studio | Completion and IDE Chat for .NET workflows. | Instructions, prompt files, agents, skills, and MCP; subagent and hook support differs. |
| JetBrains IDEs | IDE Chat and customization editor. | Several customization types remain in preview; MCP is supported. |
| Xcode | Completion and Chat for Apple-platform work. | Instructions, agents, and prompt files have preview status; MCP is supported. |
| GitHub.com | Repository Chat, cloud agents, pull requests, and remote sessions. | Instructions, agents, skills, hooks, and MCP are supported; prompt files and subagents are absent. |
Workflow Examples
Explore a repository before editing
Map the application entry points, request flow, persistence layer, and test layout. Read only. Return file paths and the commands used to verify your findings.Start in Standard or Plan mode. Attach relevant files with @ and confirm the working directory with /cwd. Request evidence paths and a concrete architecture summary.
Plan a multi-file change
/plan Add idempotency to payment creation. Preserve the public API, reuse the existing database transaction helper, include rollback behavior, and name the tests that must pass.Review the plan for migration impact, failure behavior, and test scope before switching modes. Run /rubber-duck when the change has a risky assumption or several valid designs.
Fix a failing test
Run the failing test in isolation. Find the first product-code defect, apply the smallest correction, rerun the focused test, then run the related test suite. Report commands and changed files.Grant only the shell commands and paths required for the repair. Avoid global permission bypass for an unfamiliar repository.
Review a change set
/review Focus on correctness, security, data loss, concurrency, and missing regression tests. Ignore formatting unless it changes behavior.Inspect /diff, add line comments, and run /security-review for security-sensitive code. Commit after the change passes its required tests.
Delegate independent work
/fleet Inspect the API, database, and test layers independently. Return one combined implementation risk report. Do not edit files.Parallel agents fit independent repository areas. A single agent is clearer for one tightly connected refactor.
Troubleshooting
| Problem | Check |
|---|---|
| A documented command is missing | Run /help, /version, and /update; check /experimental show and account policy. |
| Login uses the wrong account | Inspect /user show and token variables; an environment token overrides stored OAuth. |
| Classic PAT fails | Use OAuth or a fine-grained PAT with Copilot Requests permission. |
| Agent mode is absent | Check organization policy, account access, extension version, and the active IDE mode picker. |
| Copilot cannot read a directory | Run /list-dirs, then /add-dir PATH after reviewing the target. |
| Permission prompts repeat | Inspect /permissions show; review exact tool, path, and URL patterns. |
| Context fills too quickly | Run /context, reduce attached files, then /compact with focus instructions. |
| Wrong files are being edited | Run /cwd, inspect /env, and verify the Git root before continuing. |
| Model is unavailable | Open /model; availability depends on provider, plan, policy, and catalog. |
| MCP server fails to start | Run /mcp list, /mcp show NAME, and /mcp reload; keep stdio logs on stderr. |
Workspace MCP is absent under -p | Trust the folder or opt in with GITHUB_COPILOT_PROMPT_MODE_WORKSPACE_MCP=true. |
| VS Code connection is absent | Open the matching trusted workspace, then run /ide. |
| Rich diff blocks text selection | Start with --mouse=off or set mouse support off in settings. |
| An autonomous run continues too long | Press Esc twice and set a continuation or AI Credits limit before resuming. |
FAQs
Can BYOK run without a GitHub login?
Yes. Copilot CLI can use an external or local model provider without GitHub authentication. /delegate, GitHub Code Search, and the built-in GitHub MCP server still require a GitHub login. Combine BYOK with GitHub authentication when the session needs those hosted features.
Where does Copilot CLI store sign-in credentials?
OAuth credentials go to the operating-system credential store: Keychain Access on macOS, Credential Manager on Windows, or a supported secret service on Linux. If no credential store is available, Copilot can save the token in plain text at ~/.copilot/config.json, or under the directory set by COPILOT_HOME. Protect that file and avoid the plain-text fallback on shared systems.
Do commands entered with ! use Copilot permission rules?
No. The ! prefix runs a command directly in the local shell and bypasses the agent tool approval flow. The command receives the permissions of the user account running the terminal. Read it as carefully as any command copied from another source.
How can I keep a Copilot CLI session local?
Start the session with --no-remote, set the remote configuration value to off, or disable remote access through /remote off. This prevents session syncing and remote control. A model provider still receives prompts and context unless the session uses an approved local provider in offline mode.
Does /undo replace Git commits?
No. /undo restores conversation state and tracked file changes from a selected turn. Git commits record durable project history, support team review, and remain available after session data is removed. Commit tested milestones during long or high-risk changes.





