github-copilot-cli-expert

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

GitHub Copilot CLI Expert

GitHub Copilot CLI 专家

Comprehensive knowledge of GitHub Copilot CLI - the terminal-native AI coding assistant.
Note: Command syntax and model availability may change. Run
/help
in Copilot CLI for current options.
全面了解GitHub Copilot CLI——这款原生终端AI编码助手。
注意:命令语法和模型可用性可能会变更。在Copilot CLI中运行
/help
获取当前可用选项。

Purpose

用途

This skill provides expert guidance on:
  1. Installing and updating GitHub Copilot CLI
  2. All slash commands and keyboard shortcuts
  3. Custom agents, skills, and MCP server configuration
  4. Security, permissions, and trusted directories
  5. Integration with GitHub workflows (PRs, issues, Actions)
  6. Programmatic and interactive usage modes
本技能提供以下方面的专业指导:
  1. GitHub Copilot CLI的安装与更新
  2. 所有斜杠命令及键盘快捷键
  3. 自定义Agent、技能及MCP服务器配置
  4. 安全、权限及可信目录设置
  5. 与GitHub工作流的集成(PR、Issue、Actions)
  6. 程序化与交互式使用模式

Quick Reference

快速参考

Installation (Pick One)

安装(任选其一)

bash
undefined
bash
undefined

Homebrew (macOS/Linux) - Recommended

Homebrew(macOS/Linux)- 推荐方式

brew install copilot-cli
brew install copilot-cli

npm (all platforms, requires Node.js 22+)

npm(全平台,需Node.js 22+)

npm install -g @github/copilot
npm install -g @github/copilot

WinGet (Windows)

WinGet(Windows)

winget install GitHub.Copilot
winget install GitHub.Copilot

Install script (macOS/Linux)

安装脚本(macOS/Linux)

undefined
undefined

Update to Latest Version

更新至最新版本

bash
undefined
bash
undefined

Homebrew

Homebrew

brew upgrade copilot-cli
brew upgrade copilot-cli

npm

npm

npm update -g @github/copilot
npm update -g @github/copilot

WinGet

WinGet

winget upgrade GitHub.Copilot
winget upgrade GitHub.Copilot

Check version

查看版本

copilot --version
undefined
copilot --version
undefined

Before First Use

首次使用前准备

Requirements:
  • Active GitHub Copilot subscription (Plans)
  • Node.js 22+ (if installing via npm)
  • PowerShell v6+ (Windows users)
Authentication:
bash
undefined
要求
  • 有效的GitHub Copilot订阅(方案详情
  • Node.js 22+(若通过npm安装)
  • PowerShell v6+(Windows用户)
身份验证
bash
undefined

On first run, you'll be prompted to login

首次运行时,会提示你登录

copilot
copilot

Then: /login

然后输入:/login

OR set environment variable

或者设置环境变量

export GH_TOKEN="ghp_xxxxxxxxxxxx"
undefined
export GH_TOKEN="ghp_xxxxxxxxxxxx"
undefined

Essential Slash Commands

核心斜杠命令

CommandDescription
/help
Show all commands and shortcuts
/model
Select AI model (claude-sonnet-4-5, gpt-5, etc.)
/mcp
Manage MCP server configuration
/agent
Browse and select custom agents
/delegate
Hand off task to Copilot coding agent on GitHub
/compact
Reduce context window usage
/context
Show token usage visualization
/usage
Display session metrics
/diff
Review changes made in session
/share
Export session to file or gist
/skills
Manage skills for enhanced capabilities
命令描述
/help
显示所有命令和快捷键
/model
选择AI模型(claude-sonnet-4-5、gpt-5等)
/mcp
管理MCP服务器配置
/agent
浏览并选择自定义Agent
/delegate
将任务委托给GitHub上的Copilot编码Agent
/compact
减少上下文窗口占用
/context
查看Token使用情况可视化界面
/usage
显示会话统计数据
/diff
回顾会话中做出的更改
/share
将会话导出至文件或Gist
/skills
管理技能以增强功能

Keyboard Shortcuts

键盘快捷键

ShortcutAction
@file
Include file contents in context
!cmd
Execute shell command directly
Esc
Cancel operation / exit prompt
Ctrl+C
Cancel / clear / exit
Ctrl+L
Clear screen
Ctrl+O
Expand/collapse timeline
↑/↓
Navigate command history
快捷键操作说明
@file
将文件内容纳入上下文
!cmd
直接执行Shell命令
Esc
取消操作/退出提示
Ctrl+C
取消/清空/退出
Ctrl+L
清屏
Ctrl+O
展开/收起时间线
↑/↓
浏览命令历史

When to Use This Skill

何时使用本技能

Auto-triggers when user mentions:
  • "copilot cli", "github copilot", "install copilot"
  • "update copilot", "copilot version", "copilot commands"
  • "mcp server", "custom agents", "copilot skills"
Explicitly invoke via:
python
Skill(skill="github-copilot-cli-expert")
自动触发场景:当用户提及以下内容时
  • "copilot cli"、"github copilot"、"install copilot"
  • "update copilot"、"copilot version"、"copilot commands"
  • "mcp server"、"custom agents"、"copilot skills"
显式调用方式
python
Skill(skill="github-copilot-cli-expert")

Navigation Guide

导航指南

When to Read Supporting Files

何时阅读配套文件

reference.md - Read when you need:
  • Complete list of all slash commands with detailed options
  • All command-line flags and environment variables
  • Detailed security configuration (trusted directories, tool permissions)
  • Programmatic mode examples and scripting patterns
  • MCP server configuration JSON format
examples.md - Read when you need:
  • Step-by-step workflow examples (PR creation, code review)
  • Custom agent creation and invocation examples
  • GitHub integration use cases (issues, Actions, PRs)
  • Delegation to Copilot coding agent workflows
reference.md - 当你需要以下信息时阅读:
  • 所有斜杠命令的完整列表及详细选项
  • 所有命令行标志和环境变量
  • 详细的安全配置(可信目录、工具权限)
  • 程序化模式示例和脚本编写模式
  • MCP服务器配置的JSON格式
examples.md - 当你需要以下信息时阅读:
  • 分步工作流示例(PR创建、代码审查)
  • 自定义Agent创建和调用示例
  • GitHub集成用例(Issue、Actions、PR)
  • 委托给Copilot编码Agent的工作流

Core Capabilities

核心功能

1. Interactive vs Programmatic Mode

1. 交互式与程序化模式

Interactive (default):
bash
copilot
交互式(默认):
bash
copilot

Then type prompts naturally

然后自然输入提示语


**Programmatic** (scripting):

```bash
copilot -p "Summarize recent commits" --allow-tool 'shell(git)'

**程序化**(脚本化):

```bash
copilot -p "Summarize recent commits" --allow-tool 'shell(git)'

2. Custom Agents

2. 自定义Agent

Built-in agents:
explore
,
task
,
plan
,
code-review
Custom agent locations:
  • User-level:
    ~/.copilot/agents/
  • Repository:
    .github/agents/
  • Org/Enterprise:
    .github-private/agents/
内置Agent:
explore
task
plan
code-review
自定义Agent存储位置:
  • 用户级别:
    ~/.copilot/agents/
  • 仓库级别:
    .github/agents/
  • 组织/企业级别:
    .github-private/agents/

3. MCP Servers

3. MCP服务器

GitHub MCP server included by default. Add more:
bash
/mcp add
默认包含GitHub MCP服务器,可添加更多:
bash
/mcp add

Fill details, Ctrl+S to save

填写详情,按Ctrl+S保存


Config stored in: `~/.copilot/mcp-config.json`

配置文件存储于:`~/.copilot/mcp-config.json`

4. Security Model

4. 安全模型

  • Trusted directories: Confirmed on first launch
  • Tool approval: Required for file modifications
  • Path permissions: Current directory + temp by default
  • URL permissions: All URLs require approval
  • 可信目录:首次启动时确认
  • 工具审批:修改文件需经过审批
  • 路径权限:默认仅允许当前目录及临时目录
  • URL权限:所有URL均需审批

Common Patterns

常见使用模式

Include Files in Prompts

在提示中纳入文件

Explain @config/settings.yml
Fix the bug in @src/app.js
解释@config/settings.yml
修复@src/app.js中的bug

Delegate to GitHub Agent

委托给GitHub Agent

bash
/delegate complete the API tests and create a PR
bash
/delegate complete the API tests and create a PR

Resume Previous Session

恢复之前的会话

bash
copilot --resume    # Cycle through sessions
copilot --continue  # Resume most recent
bash
copilot --resume    # 循环切换会话
copilot --continue  # 恢复最近的会话

Allow Tools Without Prompts

无需提示即可使用工具

bash
copilot --allow-all-tools
copilot --allow-tool 'shell(git)'
copilot --deny-tool 'shell(rm)'
bash
copilot --allow-all-tools
copilot --allow-tool 'shell(git)'
copilot --deny-tool 'shell(rm)'

Version Information

版本信息

Current Version: Check with
copilot --version
Prerelease Channels:
bash
brew install copilot-cli@prerelease
npm install -g @github/copilot@prerelease
winget install GitHub.Copilot.Prerelease
当前版本:使用
copilot --version
查看
预发布通道
bash
brew install copilot-cli@prerelease
npm install -g @github/copilot@prerelease
winget install GitHub.Copilot.Prerelease

Troubleshooting

故障排除

Authentication Issues

身份验证问题

bash
/login              # In interactive mode
bash
/login              # 在交互式模式下执行

Or use PAT with GH_TOKEN/GITHUB_TOKEN env var

或者使用PAT设置GH_TOKEN/GITHUB_TOKEN环境变量

undefined
undefined

Context Window Full

上下文窗口已满

bash
/compact            # Summarize conversation
/context            # View token usage
bash
/compact            # 总结对话内容
/context            # 查看Token使用情况

MCP Server Not Loading

MCP服务器无法加载

bash
/mcp show           # List configured servers
/mcp edit [name]    # Edit configuration
bash
/mcp show           # 列出已配置的服务器
/mcp edit [name]    # 编辑配置

Tool Permission Denied

工具权限被拒绝

  • Check trusted directories:
    ~/.copilot/config.json
    trusted_folders
  • Use
    --allow-all-paths
    or
    --allow-all-urls
    flags
  • Approve tools individually when prompted
  • 检查可信目录:
    ~/.copilot/config.json
    trusted_folders
  • 使用
    --allow-all-paths
    --allow-all-urls
    标志
  • 提示时单独审批工具

First-Time Setup Issues

首次设置问题

"Copilot not found" after install:
  • Restart terminal after installation
  • Check PATH includes install location
  • Run
    which copilot
    (Unix) or
    where copilot
    (Windows)
"No subscription" error:
安装后提示"Copilot未找到"
  • 安装后重启终端
  • 检查PATH是否包含安装路径
  • 在Unix系统运行
    which copilot
    ,Windows系统运行
    where copilot
提示"无订阅"错误

Related Skills

相关技能

  • mcp-manager: Advanced MCP server configuration
  • agent-sdk: Building custom agents
  • documentation-writing: Clear documentation practices
  • mcp-manager:高级MCP服务器配置
  • agent-sdk:构建自定义Agent
  • documentation-writing:清晰的文档编写规范

Official Resources

官方资源