Developers work across many surfaces like the CLI, IDE, and GitHub. The terminal is often where they turn to move fast, automate tasks, or work directly with systems and scripts. Tools like the GitHub Copilot CLI already make this easier. You can generate commands, debug issues, and move quicker without leaving the terminal. However, like any environment, the CLI can still accumulate friction: re-running the same commands, re-explaining context, or translating logs for your team into something they can act on. These small steps add up, especially when every team’s stack and standards are a little different. But what if your terminal didn’t just run commands, it understood your stack, your tools, and your team’s standards? That’s where custom agents come in. Instead of starting from scratch each time, you can encode your team’s context into reusable workflows that go beyond one-off prompts. With custom agents in the CLI, you can turn repeated tasks and patterns into consistent, reviewable workflows that fit naturally alongside your other tools, further tailoring GitHub Copilot CLI with expertise for specific development tasks. What are custom agents? A custom agent is a Copilot agent that can be defined using a Markdown file. Instead of relying on generic behavior, you describe how the agent should operate, what tools it can use, what standards it should follow, and what outputs it should produce. The result: its behavior is consistent wherever it runs. Each coding agent you create can act as a specialized agent tailored for a specific task. For example, a generic coding agent might suggest how to clean up your code. But a custom agent can apply your formatting rules, tooling, accessibility standards, review requirements, and safety requirements every time it runs. Custom agents are defined using agent profiles, or files that live directly in your repository. Written in Markdown, these agent profiles let you specify: The agent’s role and area of expertise Which tools it can access Guardrails that keep outputs safe and consistent The snippet below shows the beginning of an agent profile that acts as an expert assistant for web accessibility: — description: ‘Expert assistant for web accessibility (WCAG 2.1/2.2), inclusive UX, and a11y testing’ name: ‘Accessibility Expert’ model: GPT-4.1 tools: [‘changes’, ‘codebase’, ‘edit/editFiles’, ‘extensions’, ‘web/fetch’, ‘findTestFiles’, ‘githubRepo’, ‘new’, ‘openSimpleBrowser’, ‘problems’, ‘runCommands’, ‘runTasks’, ‘runTests’, ‘search’, ‘searchResults’, ‘terminalLastCommand’, ‘terminalSelection’, ‘testFailure’, ‘usages’, ‘vscodeAPI’] # Accessibility Expert You are a world-class expert in web accessibility who translates standards into practical guidance for designers, developers, and QA. You ensure products are inclusive, usable, and aligned with WCAG 2.1/2.2 across A/AA/AAA. # Your Expertise **Standards & Policy**: WCAG 2.1/2.2 conformance, A/AA/AAA mapping, privacy/security aspects, regional policies Because the agent profile lives in your repository, your team can review it, version it, and share it so the same expectations follow the work from the CLI to the IDE and all the way into pull requests on GitHub. How custom agents work in GitHub Copilot CLI GitHub Copilot CLI is well suited for agent-driven work because it already runs scripts, calls APIs, and works directly with your repositories. Defining agents here lets you further tailor Copilot CLI by encoding execution-heavy workflows once, then invoking it from the terminal. The agent will execute your workflow the same way every time. To add a new custom agent for GitHub Copilot CLI, you’ll need to: Invoke the agent from Copilot CLI. From the terminal, run the Copilot CLI and use the /agentslash command. Select the custom agent you want to use. Create an agent profile in the .“github“/agents directory of your target repository. The agent profile is a Markdown file with YAML frontmatter that defines the agent’s role, scope, capabilities, and guardrails, so it behaves consistently in your workflows. The agent profile file ends with .agent.md – for example, accessibility.agent.md. Because the agent profile is a file in your repository, it can be reviewed, updated, and shared. Common workflows you can automate with custom agents The best place to start with custom agents is with tasks your team already repeats, many of which often begin in the terminal and continue in the IDE and on GitHub. Here are a few practical scenarios: Security audit agent Run your team’s standard security checks across your repositories, summarize findings by severity, and output a pull request-ready checklist with owners and next steps. # .github/agents/security-audit.md — name: Security audit description: Run our standard security checks across repositories and produce a PR-ready checklist grouped by severity. tools: # Keep this list aligned with what your team actually runs in CI. – gh – git – semgrep – trivy – gitleaks – jq — ## Instructions You are the **Security audit** agent for this organization. ### Goal For the repositories provided by the user, run the team’s standard security checks, summarize findings by **severity** (Critical, High, Medium, Low), and output a **pull request (PR)-ready** checklist with owners and next steps. ### Operating rules – Prefer the repo’s existing security tooling and config files (for example: `.semgrep.yml`, `.trivyignore`, `.gitleaks.toml`) when present. – If a tool is missing, note it as a **High** severity “coverage gap” instead of inventing results. – Don’t paste secrets or full vulnerable payloads into output. Redact tokens and credentials. – Use inclusive language (use allowlist/denylist). – When referencing dates, use the format “March 23, 2026”. ### Standard checks to run (per repository) 1. Secret scanning locally: – `gitleaks detect –redact –no-git –source .` (or use the repository’s preferred invocation) 2. Container scanning (if a container image or Dockerfile exists): – `trivy fs .` 3. SAST (if semgrep config exists): – `semgrep scan –config .semgrep.yml` 4. Dependency review (if GitHub workflow exists): – Use `gh` to confirm dependency review is enabled on pull requests, or record a gap. ### Ownership mapping (use these defaults if CODEOWNERS is missing) – `backend/**` -> @api-team – `frontend/**` -> @web-platform – `.github/workflows/**` -> @platform-eng – `terraform/**` -> @infra-oncall – Otherwise -> @security-champions ### Output format (copy/paste into a pull request description) Produce a single Markdown report with: – A short