
Github Copilot Cli Expert
- 125 installs
- 70 repo stars
- Updated July 26, 2026
- rysweet/amplihack
Configure, prompt, and troubleshoot GitHub Copilot CLI for repo-aware coding tasks, shell workflows, and agent-style automation inside terminal-driven development.
About
The github-copilot-cli-expert skill from amplihack teaches practitioners how to wield GitHub Copilot CLI effectively for terminal-first development and light agent automation. It covers configuration, prompting tactics, repository context, and troubleshooting so Copilot suggestions stay relevant across edits, scripts, and multi-step tasks. Teams in active build phases use it to reduce friction when pairing human direction with CLI copilots instead of fighting opaque errors or shallow completions.
- Guides Copilot CLI setup and auth patterns
- Shares effective prompt and context strategies
- Covers repo-scoped coding and shell workflows
- Helps debug failed or noisy CLI copilot runs
- Bridges terminal agents with everyday dev tasks
Github Copilot Cli Expert by the numbers
- 125 all-time installs (skills.sh)
- +1 installs in the week ending Jul 26, 2026 (Skillselion tracking)
- Ranked #3,686 of 16,556 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/rysweet/amplihack --skill github-copilot-cli-expertAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 125 |
|---|---|
| repo stars | ★ 70 |
| Last updated | July 26, 2026 |
| Repository | rysweet/amplihack ↗ |
What it does
Configure, prompt, and troubleshoot GitHub Copilot CLI for repo-aware coding tasks, shell workflows, and agent-style automation inside terminal-driven development.
Files
GitHub Copilot CLI Expert
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.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
Quick Reference
Installation (Pick One)
# Homebrew (macOS/Linux) - Recommended
brew install copilot-cli
# npm (all platforms, requires Node.js 22+)
npm install -g @github/copilot
# WinGet (Windows)
winget install GitHub.Copilot
# Install script (macOS/Linux)
curl -fsSL https://gh.io/copilot-install | bashUpdate to Latest Version
# Homebrew
brew upgrade copilot-cli
# npm
npm update -g @github/copilot
# WinGet
winget upgrade GitHub.Copilot
# Check version
copilot --versionBefore First Use
Requirements:
- Active GitHub Copilot subscription (Plans)
- Node.js 22+ (if installing via npm)
- PowerShell v6+ (Windows users)
Authentication:
# On first run, you'll be prompted to login
copilot
# Then: /login
# OR set environment variable
export GH_TOKEN="ghp_xxxxxxxxxxxx"Essential Slash Commands
| Command | Description |
|---|---|
/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 |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
@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 |
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:
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
Core Capabilities
1. Interactive vs Programmatic Mode
Interactive (default):
copilot
# Then type prompts naturallyProgrammatic (scripting):
copilot -p "Summarize recent commits" --allow-tool 'shell(git)'2. Custom Agents
Built-in agents: explore, task, plan, code-review
Custom agent locations:
- User-level:
~/.copilot/agents/ - Repository:
.github/agents/ - Org/Enterprise:
.github-private/agents/
3. MCP Servers
GitHub MCP server included by default. Add more:
/mcp add
# Fill details, Ctrl+S to saveConfig stored in: ~/.copilot/mcp-config.json
4. Security Model
- 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
Common Patterns
Include Files in Prompts
Explain @config/settings.yml
Fix the bug in @src/app.jsDelegate to GitHub Agent
/delegate complete the API tests and create a PRResume Previous Session
copilot --resume # Cycle through sessions
copilot --continue # Resume most recentAllow Tools Without Prompts
copilot --allow-all-tools
copilot --allow-tool 'shell(git)'
copilot --deny-tool 'shell(rm)'Version Information
Current Version: Check with copilot --version
Prerelease Channels:
brew install copilot-cli@prerelease
npm install -g @github/copilot@prerelease
winget install GitHub.Copilot.PrereleaseReleases: https://github.com/github/copilot-cli/releases/
Troubleshooting
Authentication Issues
/login # In interactive mode
# Or use PAT with GH_TOKEN/GITHUB_TOKEN env varContext Window Full
/compact # Summarize conversation
/context # View token usageMCP Server Not Loading
/mcp show # List configured servers
/mcp edit [name] # Edit configurationTool Permission Denied
- Check trusted directories:
~/.copilot/config.json→trusted_folders - Use
--allow-all-pathsor--allow-all-urlsflags - Approve tools individually when prompted
First-Time Setup Issues
"Copilot not found" after install:
- Restart terminal after installation
- Check PATH includes install location
- Run
which copilot(Unix) orwhere copilot(Windows)
"No subscription" error:
- Verify at https://github.com/settings/copilot
- Ensure plan includes CLI access
- Try
/logoutthen/login
Related Skills
- mcp-manager: Advanced MCP server configuration
- agent-sdk: Building custom agents
- documentation-writing: Clear documentation practices
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
/feedbackcommand in CLI
GitHub Copilot CLI Examples
Practical examples and workflows for GitHub Copilot CLI.
Local Development Workflows
Example 1: Code Understanding
Scenario: Understand a new codebase
# Start Copilot in your project
cd /path/to/project
copilot
# Ask about the project
What does this codebase do?
# Explore specific files
Explain @src/main.py
# Understand dependencies
What libraries does this project use and why?
# Find patterns
Show me how authentication is handled in this codebaseExample 2: Bug Fixing
Scenario: Debug and fix an issue
copilot
# Describe the problem
The API returns 500 error when users submit forms with empty fields
# Let Copilot investigate
Show me the form validation logic in @src/api/forms.py
# Get fix suggestions
Fix the validation to properly handle empty fields
# Review the changes before committing
/diffExample 3: Feature Implementation
Scenario: Add a new feature
copilot
# Describe the feature
Add a rate limiting middleware that limits requests to 100 per minute per IP
# Get implementation plan first
/plan implement rate limiting for the API
# Implement with guidance
Create the rate limiter following the plan
# Test it
Run the tests and show me the resultsGitHub Integration Workflows
Example 4: Creating Pull Requests
Scenario: Make changes and create a PR
copilot
# Make code changes
Add input validation to the user registration endpoint
# Review what changed
/diff
# Create PR directly on GitHub
Create a pull request for these changes with a descriptive title and bodyExpected: Copilot creates a PR on GitHub with you as the author.
Example 5: Working with Issues
Scenario: Address an assigned issue
copilot
# Start from an issue
I've been assigned issue https://github.com/myorg/myrepo/issues/42
Start working on this in a new branch
# Copilot will:
# 1. Create a branch
# 2. Read the issue
# 3. Start implementingExample 6: Code Review
Scenario: Review a PR for issues
copilot
# Review a specific PR
Check the changes in PR https://github.com/myorg/myrepo/pull/123
Report any bugs, security issues, or code quality problems
# Get summary of findings
Copilot provides inline analysis of the PR changesExample 7: Managing PRs
Scenario: Merge or close PRs
copilot
# Merge approved PRs
Merge all approved PRs I've created in myorg/myrepo
# Close a specific PR
Close PR #45 on myorg/myrepo with a comment explaining whyDelegation Workflows
Example 8: Delegate to Copilot Agent
Scenario: Hand off work to run in background on GitHub
copilot
# Start with some local context
I've been working on the authentication refactor
# Delegate remaining work
/delegate complete the password reset flow and fix the test failures
# Copilot will:
# 1. Create a checkpoint commit
# 2. Push to a new branch
# 3. Open a draft PR
# 4. Run Copilot coding agent in background
# 5. Provide link to PR and agent sessionExample 9: Resume Remote Session
Scenario: Bring GitHub agent work back locally
# List available sessions
copilot --resume
# Select the session from the delegation
# Now you can continue the work locallyCustom Agent Workflows
Example 10: Using Built-in Agents
Scenario: Quick codebase exploration
copilot
# Use explore agent (doesn't add to main context)
Use the explore agent to find all API endpoints in this project
# Use plan agent for complex tasks
Use the plan agent to create an implementation plan for adding OAuth support
# Use code-review agent
Use the code-review agent to review the changes in the staging branchExample 11: Creating Custom Agents
Step 1: Create agent file at ~/.copilot/agents/security-checker.md:
# Security Checker Agent
You are a security-focused code reviewer. When reviewing code:
1. Check for SQL injection vulnerabilities
2. Look for XSS vulnerabilities
3. Identify authentication/authorization issues
4. Flag sensitive data exposure
5. Check for insecure dependencies
Always provide severity ratings (Critical/High/Medium/Low) and
remediation suggestions.Step 2: Use the agent:
copilot --agent=security-checker
Review @src/api/ for security issuesExample 12: Repository-Level Agents
Create .github/agents/frontend-expert.md in your repo:
# Frontend Expert
You specialize in React and TypeScript development for this project.
Follow these conventions:
- Use functional components with hooks
- Prefer TypeScript strict mode
- Use our component library from @/components
- Follow accessibility best practicesThen use it:
copilot
Use the frontend-expert agent to create a new dashboard componentMCP Server Workflows
Example 13: Adding MCP Servers
Add filesystem access to additional directories:
copilot
/mcp add
# Fill in:
# Name: my-docs
# Command: npx
# Args: -y @modelcontextprotocol/server-filesystem /path/to/docs
# Press Ctrl+S to saveExample 14: Using GitHub MCP Server
The GitHub MCP server is included by default:
copilot
# Search issues
Use the GitHub MCP server to find good first issues in octocat/hello-world
# List workflow runs
Show me the recent GitHub Actions runs for this repo
# Manage labels
Add the "needs-review" label to issue #42Programmatic Workflows
Example 15: CI/CD Integration
In your GitHub Actions workflow:
- name: Generate Docs
run: |
copilot -p "Generate API documentation for src/api/" \
--allow-tool 'write' \
--allow-tool 'shell(npm)'Example 16: Scripted Code Generation
#!/bin/bash
# generate-tests.sh
copilot -p "Generate unit tests for $1" \
--allow-tool 'write' \
--allow-tool 'shell(npm test)'Usage:
./generate-tests.sh src/utils/validator.tsExample 17: Batch Operations
# Fix linting in all files, auto-approve common tools
copilot -p "Fix all ESLint errors in src/" \
--allow-all-tools \
--deny-tool 'shell(rm)' \
--deny-tool 'shell(git push)'Context Management
Example 18: Managing Large Sessions
copilot
# Work on a complex feature...
# (many prompts later)
# Check context usage
/context
# If approaching limit, summarize
/compact
# View session statistics
/usageExample 19: Session Persistence
# End session, then later:
copilot --continue # Resume last session
# Or pick from list
copilot --resume # Shows all sessionsExample 20: Sharing Sessions
copilot
# After a productive session, share it:
# Export to file
/share file ./session-notes.md
# Or share as gist
/share gistGitHub Actions Workflows
Example 21: Create Workflow
copilot
Create a GitHub Actions workflow that:
1. Runs on pull requests to main
2. Runs ESLint on changed files
3. Shows errors as PR annotations
4. Fails the check if there are errors
5. Push the workflow file and create a PRExample 22: Debug Failing Actions
copilot
The CI pipeline is failing. Check the workflow file at .github/workflows/ci.yml
and the recent run logs to diagnose the issue.
# Copilot can access GitHub Actions data via MCPSecurity-Conscious Workflows
Example 23: Restricted Automation
# Allow git read-only, deny destructive commands
copilot -p "Analyze the git history and summarize changes" \
--allow-tool 'shell(git log)' \
--allow-tool 'shell(git show)' \
--allow-tool 'shell(git diff)' \
--deny-tool 'shell(git push)' \
--deny-tool 'shell(git reset)' \
--deny-tool 'shell(rm)'Example 24: Read-Only Analysis
# Deny all write operations
copilot -p "Audit this codebase for security issues" \
--deny-tool 'write' \
--deny-tool 'shell'Tips & Best Practices
Effective Prompts
Good prompts are specific:
# Instead of:
Fix the bug
# Say:
Fix the TypeError in @src/api/users.py line 42 where user.email
is accessed before checking if user existsUsing File References
# Reference multiple files
Explain the relationship between @src/models/user.py and @src/api/auth.py
# Reference directories
Review all files in @tests/ for test coverage gapsIterative Development
# Build incrementally
Create the data model for a blog post
# Then extend
Add validation to the BlogPost model
# Then integrate
Create an API endpoint to create blog posts
# Review everything
/diffWorking with Large Codebases
# Use explore agent to keep main context clean
Use explore agent: How is caching implemented?
# Then focus on specific areas
Show me @src/cache/redis.py in detailGitHub Copilot CLI Reference
Complete reference documentation for GitHub Copilot CLI.
All Slash Commands
Session Management
| Command | Arguments | Description |
|---|---|---|
/clear, /new | - | Clear conversation history |
/compact | - | Summarize conversation to reduce context |
/context | - | Show token usage visualization |
/usage | - | Display session metrics and statistics |
/exit, /quit | - | Exit the CLI |
/session | `[checkpoints [n]\ | files\ |
/rename | <name> | Rename current session |
/resume | [sessionId] | Switch to different session |
/share | `[file\ | gist] [path]` |
Configuration & Tools
| Command | Arguments | Description |
|---|---|---|
/model, /models | [model] | Select AI model |
/mcp | `[show\ | add\ |
/agent | - | Browse and select available agents |
/skills | `[list\ | info\ |
/theme | `[show\ | set\ |
/terminal-setup | - | Configure multiline input support |
/reset-allowed-tools | - | Reset tool permissions |
File & Directory Access
| Command | Arguments | Description |
|---|---|---|
/add-dir | <directory> | Add directory to allowed list |
/list-dirs | - | Display all allowed directories |
/cwd, /cd | [directory] | Change or show working directory |
/diff | - | Review changes made in current directory |
Authentication & User
| Command | Arguments | Description |
|---|---|---|
/login | - | Log in to Copilot |
/logout | - | Log out of Copilot |
/user | `[show\ | list\ |
Task Delegation
| Command | Arguments | Description |
|---|---|---|
/delegate | <prompt> | Push session to Copilot coding agent on GitHub |
/plan | [prompt] | Create implementation plan before coding |
/review | [prompt] | Run code review agent |
Help & Feedback
| Command | Arguments | Description |
|---|---|---|
/help | - | Show help for interactive commands |
/feedback | - | Submit feedback, bug reports, feature requests |
/ide | - | Connect to an IDE workspace |
Command-Line Options
Basic Options
copilot [options]
Options:
-p, --prompt <text> Run with single prompt (programmatic mode)
--resume Cycle through and resume sessions
--continue Resume most recent session
--agent <name> Specify custom agent to use
--banner Show animated banner
--version Show version number
--help Show helpTool Approval Options
--allow-all-tools Allow all tools without approval
--allow-tool <spec> Allow specific tool (repeatable)
--deny-tool <spec> Deny specific tool (repeatable)Tool Specification Formats:
'shell'- All shell commands'shell(git)'- Specific command'shell(git push)'- Command with subcommand'write'- File modification tools'MCP_SERVER_NAME'- All tools from MCP server'MCP_SERVER_NAME(tool_name)'- Specific MCP tool
Path & URL Options
--allow-all-paths Disable path verification
--allow-all-urls Disable URL verification
--allow-url <domain> Pre-approve specific domainEnvironment Variables
| Variable | Description |
|---|---|
GH_TOKEN | GitHub personal access token (highest priority) |
GITHUB_TOKEN | GitHub personal access token (fallback) |
XDG_CONFIG_HOME | Override config directory (default: ~/.copilot) |
HOME | User home directory |
TMPDIR | Temporary directory |
PWD | Current working directory |
Configuration Files
Main Configuration
Location: ~/.copilot/config.json
{
"trusted_folders": ["/path/to/trusted/project1", "/path/to/trusted/project2"],
"theme": "auto",
"model": "claude-sonnet-4-5"
}MCP Server Configuration
Location: ~/.copilot/mcp-config.json
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "${GH_TOKEN}"
}
},
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
}
}
}Custom Instructions Locations
Copilot CLI reads instructions from (in order):
1. CLAUDE.md (in git root & cwd) 2. GEMINI.md (in git root & cwd) 3. AGENTS.md (in git root & cwd) 4. .github/instructions/**/*.instructions.md (in git root & cwd) 5. .github/copilot-instructions.md 6. $HOME/.copilot/copilot-instructions.md 7. COPILOT_CUSTOM_INSTRUCTIONS_DIRS (additional directories via env var)
Custom Agents
Built-in Agents
| Agent | Description |
|---|---|
explore | Fast codebase analysis, answering questions without adding to context |
task | Execute commands (tests, builds), brief on success, full output on failure |
plan | Create implementation plans before coding |
code-review | Review changes, surface only genuine issues |
Agent Loading Locations
| Priority | Location | Scope |
|---|---|---|
| 1 (highest) | ~/.copilot/agents/ | User-level (all projects) |
| 2 | .github/agents/ | Repository-level |
| 3 (lowest) | .github-private/agents/ | Organization/Enterprise |
Invoking Custom Agents
# Interactive - select from list
/agent
# In prompt - auto-infer
Use the refactoring agent to clean up this code
# Command-line - explicit
copilot --agent=my-agent --prompt "Do the thing"Security Model
Trusted Directories
On first launch, you're asked to trust the current directory:
1. Yes, proceed - Trust for this session only 2. Yes, and remember - Trust for all future sessions 3. No, exit - Cancel session
Edit permanently: ~/.copilot/config.json → trusted_folders array
Tool Approval Flow
When Copilot needs to use a potentially dangerous tool:
1. Yes - Allow this time only 2. Yes, approve for session - Allow all uses of this tool type in session 3. No (Esc) - Cancel and provide different instruction
Permission Scopes
Path Permissions:
- Default: Current directory, subdirectories, system temp
- Limitations: Custom env vars not expanded, symlinks resolved only for existing files
URL Permissions:
- Default: All URLs require approval
- Limitations: URLs in files/configs not detected, obfuscated URLs may bypass
Risk Mitigation
For automated workflows with --allow-all-tools:
- Use in VMs, containers, or isolated environments
- Restrict network access
- Use specific
--deny-toolfor dangerous commands
Models
Available Models
Use /model to see current options. Typical choices:
- Claude Sonnet 4.5 (1x) - Default
- Claude Sonnet 4 (1x)
- GPT-5 (varies)
- Additional models based on subscription
Premium Request Multipliers
Each prompt costs premium requests × model multiplier. Check /model for current multipliers.
Help Commands (Terminal)
copilot help # General help
copilot help config # Configuration settings
copilot help environment # Environment variables
copilot help logging # Logging levels
copilot help permissions # Tool permissionsProgrammatic Mode Examples
Simple Query
copilot -p "What does this repo do?"With Tool Approval
copilot -p "Run the tests" --allow-tool 'shell(npm)'Full Automation
copilot -p "Fix linting errors and commit" \
--allow-all-tools \
--deny-tool 'shell(git push)' \
--deny-tool 'shell(rm)'Piping Input
echo "Explain this code" | copilot
cat script.sh | copilot -p "What does this do?"Prerequisites
- Active Copilot subscription (Plans)
- Windows: PowerShell v6+
- npm install: Node.js 22+
Version Management
Check Version
copilot --versionUpgrade Commands
# Homebrew
brew upgrade copilot-cli
# npm
npm update -g @github/copilot
# WinGet
winget upgrade GitHub.Copilot
# Install script (reinstall latest)
curl -fsSL https://gh.io/copilot-install | bashInstall Specific Version
# npm
npm install -g @github/copilot@0.0.393
# Install script
curl -fsSL https://gh.io/copilot-install | VERSION="v0.0.393" bashPrerelease Channel
brew install copilot-cli@prerelease
npm install -g @github/copilot@prerelease
winget install GitHub.Copilot.PrereleaseDirect Download
Executables available at: https://github.com/github/copilot-cli/releases/
Troubleshooting
"Copilot not found"
Ensure installation path is in $PATH:
- Homebrew:
/opt/homebrew/binor/usr/local/bin - npm: Global npm bin directory
- Script:
$HOME/.local/binor/usr/local/bin
"Not logged in"
# In interactive mode
/login
# Or set environment variable
export GH_TOKEN="ghp_xxxxxxxxxxxx""Tool permission denied"
- Add directory to trusted:
/add-dir /path - Or restart with
--allow-all-paths
"Context window full"
/compact # Summarize and free space
/clear # Start fresh (loses context)MCP Server Errors
/mcp show # Check status
/mcp edit <name> # Fix configuration
/mcp disable <name> # Temporarily disable