.github/hooks/hooks.jsonCopilot CLI loads hook configuration files from `.github/hooks/*.json` in the current working directory.
JSON snippets and commands for extending GitHub Copilot CLI with hooks, MCP servers, skills, and repository initialization.
Run custom commands at key agent lifecycle moments.
.github/hooks/hooks.jsonCopilot CLI loads hook configuration files from `.github/hooks/*.json` in the current working directory.
{
"version": 1,
"hooks": {
"preToolUse": [
{
"type": "command",
"bash": "./scripts/pre-tool.sh",
"powershell": "./scripts/pre-tool.ps1",
"cwd": "scripts",
"timeoutSec": 30
}
]
}
}The command-hook schema supports `bash`, `powershell`, `cwd`, `env`, and `timeoutSec`.
{
"type": "command",
"bash": "./scripts/session-start.sh",
"powershell": "./scripts/session-start.ps1",
"cwd": "scripts",
"timeoutSec": 30
}Session start hooks can log, bootstrap, or validate repo state before the agent proceeds.
{
"version": 1,
"hooks": {
"sessionStart": [
{
"type": "command",
"bash": "./scripts/audit-log.sh"
}
]
}
}A common enterprise pattern is logging sessions for compliance or internal review.
Add external tools and services to Copilot CLI.
copilot --additional-mcp-config=@./mcp-extra.jsonThis augments the persistent config in `~/.copilot/mcp-config.json`.
copilot --disable-builtin-mcpsUseful for locked-down or deterministic runs.
copilot --disable-mcp-server=github-mcp-serverHelpful when you want local code assistance without GitHub API access.
copilot --add-github-mcp-tool=search_issuesUse narrow tool grants to keep sessions focused and lower risk.
copilot --add-github-mcp-toolset=allUse `all` when you truly need the full GitHub MCP toolset.
~/.copilot/mcp-config.jsonPersistent MCP server definitions belong here, while session-only additions can use `--additional-mcp-config`.
{
"my-local-server": {
"type": "local",
"command": "node",
"args": ["./tools/mcp-server.js"],
"tools": ["*"]
}
}Local or stdio transport requires `command` and `args`, with `tools` defining what the server exposes.
Extend Copilot with reusable instructions and task-specific behavior.
.github/skills/Skills can also live in `.agents/skills/`, with first match winning on duplicate names.
---
name: repo-audit
description: Review a repository for risky shell scripts, weak CI defaults, and missing docs.
allowed-tools:
- shell(git:*)
user-invocable: true
---
Focus on reproducible, low-risk recommendations.A skill lives in its own directory and includes a `SKILL.md` file.
/skills listUse `/skills info NAME`, `/skills add`, `/skills remove`, or `/skills reload` as needed.
/initA fast way to scaffold Copilot instructions and related project-level features.
Run init without first entering a full session.
copilot initThis initializes Copilot custom instructions for the repository.