github-copilot-cli-expert
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitHub 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. Runin Copilot CLI for current options./help
全面了解GitHub Copilot CLI——这款原生终端AI编码助手。
注意:命令语法和模型可用性可能会变更。在Copilot CLI中运行获取当前可用选项。/help
Purpose
用途
This skill provides expert guidance on:
- Installing and updating GitHub Copilot CLI
- All slash commands and keyboard shortcuts
- Custom agents, skills, and MCP server configuration
- Security, permissions, and trusted directories
- Integration with GitHub workflows (PRs, issues, Actions)
- Programmatic and interactive usage modes
本技能提供以下方面的专业指导:
- GitHub Copilot CLI的安装与更新
- 所有斜杠命令及键盘快捷键
- 自定义Agent、技能及MCP服务器配置
- 安全、权限及可信目录设置
- 与GitHub工作流的集成(PR、Issue、Actions)
- 程序化与交互式使用模式
Quick Reference
快速参考
Installation (Pick One)
安装(任选其一)
bash
undefinedbash
undefinedHomebrew (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)
curl -fsSL https://gh.io/copilot-install | bash
undefinedcurl -fsSL https://gh.io/copilot-install | bash
undefinedUpdate to Latest Version
更新至最新版本
bash
undefinedbash
undefinedHomebrew
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
undefinedcopilot --version
undefinedBefore First Use
首次使用前准备
Requirements:
- Active GitHub Copilot subscription (Plans)
- Node.js 22+ (if installing via npm)
- PowerShell v6+ (Windows users)
Authentication:
bash
undefinedOn first run, you'll be prompted to login
首次运行时,会提示你登录
copilot
copilot
Then: /login
然后输入:/login
OR set environment variable
或者设置环境变量
export GH_TOKEN="ghp_xxxxxxxxxxxx"
undefinedexport GH_TOKEN="ghp_xxxxxxxxxxxx"
undefinedEssential Slash Commands
核心斜杠命令
| Command | Description |
|---|---|
| Show all commands and shortcuts |
| Select AI model (claude-sonnet-4-5, gpt-5, etc.) |
| Manage MCP server configuration |
| Browse and select custom agents |
| Hand off task to Copilot coding agent on GitHub |
| Reduce context window usage |
| Show token usage visualization |
| Display session metrics |
| Review changes made in session |
| Export session to file or gist |
| Manage skills for enhanced capabilities |
| 命令 | 描述 |
|---|---|
| 显示所有命令和快捷键 |
| 选择AI模型(claude-sonnet-4-5、gpt-5等) |
| 管理MCP服务器配置 |
| 浏览并选择自定义Agent |
| 将任务委托给GitHub上的Copilot编码Agent |
| 减少上下文窗口占用 |
| 查看Token使用情况可视化界面 |
| 显示会话统计数据 |
| 回顾会话中做出的更改 |
| 将会话导出至文件或Gist |
| 管理技能以增强功能 |
Keyboard Shortcuts
键盘快捷键
| Shortcut | Action |
|---|---|
| Include file contents in context |
| Execute shell command directly |
| Cancel operation / exit prompt |
| Cancel / clear / exit |
| Clear screen |
| Expand/collapse timeline |
| Navigate command history |
| 快捷键 | 操作说明 |
|---|---|
| 将文件内容纳入上下文 |
| 直接执行Shell命令 |
| 取消操作/退出提示 |
| 取消/清空/退出 |
| 清屏 |
| 展开/收起时间线 |
| 浏览命令历史 |
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
copilotThen 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: , , ,
exploretaskplancode-reviewCustom agent locations:
- User-level:
~/.copilot/agents/ - Repository:
.github/agents/ - Org/Enterprise:
.github-private/agents/
内置Agent:、、、
exploretaskplancode-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 addFill 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中的bugDelegate to GitHub Agent
委托给GitHub Agent
bash
/delegate complete the API tests and create a PRbash
/delegate complete the API tests and create a PRResume Previous Session
恢复之前的会话
bash
copilot --resume # Cycle through sessions
copilot --continue # Resume most recentbash
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 --versionPrerelease 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.PrereleaseTroubleshooting
故障排除
Authentication Issues
身份验证问题
bash
/login # In interactive modebash
/login # 在交互式模式下执行Or use PAT with GH_TOKEN/GITHUB_TOKEN env var
或者使用PAT设置GH_TOKEN/GITHUB_TOKEN环境变量
undefinedundefinedContext Window Full
上下文窗口已满
bash
/compact # Summarize conversation
/context # View token usagebash
/compact # 总结对话内容
/context # 查看Token使用情况MCP Server Not Loading
MCP服务器无法加载
bash
/mcp show # List configured servers
/mcp edit [name] # Edit configurationbash
/mcp show # 列出已配置的服务器
/mcp edit [name] # 编辑配置Tool Permission Denied
工具权限被拒绝
- Check trusted directories: →
~/.copilot/config.jsontrusted_folders - Use or
--allow-all-pathsflags--allow-all-urls - Approve tools individually when prompted
- 检查可信目录:→
~/.copilot/config.jsontrusted_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 (Unix) or
which copilot(Windows)where copilot
"No subscription" error:
- Verify at https://github.com/settings/copilot
- Ensure plan includes CLI access
- Try then
/logout/login
安装后提示"Copilot未找到":
- 安装后重启终端
- 检查PATH是否包含安装路径
- 在Unix系统运行,Windows系统运行
which copilotwhere copilot
提示"无订阅"错误:
- 在https://github.com/settings/copilot验证订阅状态
- 确认方案包含CLI访问权限
- 尝试执行然后
/logout重新登录/login
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
官方资源
- Docs: https://docs.github.com/copilot/concepts/agents/about-copilot-cli
- Usage Guide: https://docs.github.com/copilot/how-tos/use-copilot-agents/use-copilot-cli
- Installation: https://docs.github.com/copilot/how-tos/set-up/install-copilot-cli
- Releases: https://github.com/github/copilot-cli/releases/
- Feedback: Use command in CLI
/feedback