npx skills add ...
npx skills add github/gh-aw --skill custom-agents
npx skills add github/gh-aw --skill custom-agents
Define and validate GitHub custom agent files, prompts, and examples.
Use this reference for the GitHub custom agent file format.
GitHub Copilot reads custom agent instructions from Markdown files with YAML frontmatter. Use them to define specialized behavior, tool access, and workflows for your repository.
Place custom agent files in these locations based on scope:
.github/copilot-instructions.md.github/instructions/*.instructions.md (e.g., frontend.instructions.md, backend.instructions.md)applyTo in frontmatter.github/agents/ or .github/copilot/instructions/AGENTS.md, *.md (e.g., readme-creator.md, test-writer.md)imports field in workflow frontmatter.github/agents/ directoryreadme-creator, test-writer)> or | syntax| (literal) or > (folded) for multi-line contentprompt and markdown body exist, they are typically combined["*"], agent has access to all available toolsGitHub Standard Tool Aliases:
GitHub Copilot defines a standardized set of tool aliases for custom agents:
read - Access and read contents of files or codeedit - Make changes in code files, apply edits or refactoringsearch - Search codebase for keywords, references, or patternspr - Create, manage, or update pull requestsissue - Create, manage, or update issuesLegacy Tool Names:
For backward compatibility, these legacy tool names are still supported:
createFile - Create new files (use edit instead)editFiles - Modify existing files (use edit instead)deleteFiles - Remove files (use edit instead)codeSearch - Semantic code search (use search instead)runCommand - Execute shell commandsgetFile - Read file contents (use read instead)listFiles - List directory contents (use read instead)MCP Server Tool Prefixes:
When using Model Context Protocol (MCP) servers, you can specify tools with server prefixes:
my-mcp-server/tool-namemy-mcp-server/*Examples:
.instructions.md files* (any characters), ** (any directories)Example:
Fields:
url (string): MCP server endpointapi-key (string): Authentication key (use GitHub secrets)Example:
File: .github/copilot-instructions.md
File: .github/instructions/frontend.instructions.md
File: .github/agents/readme-creator.md
File: .github/agents/test-writer.md
File: .github/workflows/code-review.md
File: .github/agents/code-reviewer.md
The gh-aw (GitHub Agentic Workflows) tool supports custom agent files through the imports field in workflow frontmatter. Any markdown files under the .github/agents/ directory are treated as custom agent files when imported.
Use the skills: frontmatter field as the preferred way to install external skills for workflow runs. This installs skills during activation and persists them correctly between jobs.
Use imports: for workflow prompt/context files (including local custom agent files), not as the primary skill installation path.
Custom agent files are supported by the following engines:
--agent <path> flag to load custom agent fileimports field.github/agents/ directorytools arrayapplyTo is only used in .instructions.md filesimports field.github/agents/ directoryThe gh-aw repository uses custom agent files for performance engineering guides:
.github/copilot/instructions/ci-performance.md - CI/CD optimization.github/copilot/instructions/workflow-performance.md - Workflow efficiency.github/copilot/instructions/build-performance.md - Build optimization.github/copilot/instructions/cli-performance.md - CLI performanceThese files provide specialized guidance for performance engineering tasks and demonstrate the custom agent file format in practice.**
# Using standard tool aliases
tools:
- read
- edit
- search
# Enable all tools with wildcard
tools: ["*"]
# Using legacy names (still supported)
tools:
- editFiles
- createFile
- search
# Mixed standard and MCP server tools
tools:
- read
- edit
- github-mcp/create_issue
- custom-mcp/*
# Empty list disables all tools
tools: []applyTo:
- "src/frontend/**/*.tsx"
- "src/frontend/**/*.ts"
- "components/**"mcp-server:
url: https://internal-tools.company.com/mcp
api-key: ${{ secrets.INTERNAL_MCP_KEY }}description: Repository-wide coding standards
# Coding Standards
## Style Guide
- Use single quotes in JavaScript/TypeScript
- Follow ESLint configuration in `.eslintrc.json`
- Maximum line length: 100 characters
## Security
- Always set `httpOnly` and `secure` flags for cookies
- Validate all user input
- Use parameterized queries for database access
## Testing
- All new code must include Jest tests
- Aim for >80% code coverage
- Test edge cases and error conditionsdescription: Frontend development guidelines
applyTo:
- "src/frontend/**"
- "components/**"
# Frontend Development Guidelines
## Component Structure
- Use React functional components with hooks
- Prefer composition over inheritance
- Keep components small and focused (< 150 lines)
## Styling
- Use CSS Modules for component styles
- Follow BEM naming convention
- Use Tailwind utility classes where appropriate
## State Management
- Use React Context for global state
- Keep local state in components when possible
- Use reducers for complex state logicname: readme-creator
description: Agent specializing in creating and improving README files
tools:
- read
- edit
- search
# README Creator Agent
You are a documentation specialist focused on creating clear, comprehensive README files.
## Responsibilities
- Create well-structured README.md files for projects
- Include all standard sections: Overview, Installation, Usage, Contributing
- Generate accurate code examples
- Ensure documentation is up-to-date with codebase
## Style Guidelines
- Use clear, concise language
- Include code examples with syntax highlighting
- Add badges for build status, coverage, version
- Organize with logical heading hierarchy
- Include a table of contents for long READMEs
## Quality Standards
- Verify all code examples are accurate
- Test installation instructions
- Ensure links are valid and working
- Check for proper Markdown formattingname: test-writer
description: Specialized agent for writing comprehensive test suites
tools:
- read
- edit
- search
# Test Writer Agent
You specialize in creating comprehensive, well-structured test suites.
## Testing Framework
- Use Jest for JavaScript/TypeScript
- Follow AAA pattern: Arrange, Act, Assert
- Use descriptive test names: "should [expected behavior] when [condition]"
## Test Coverage
- Write unit tests for all public functions
- Create integration tests for API endpoints
- Add edge case tests (null, undefined, empty, boundary values)
- Test error conditions and exception handling
## Test Organization
- Group related tests with `describe` blocks
- Use `beforeEach` and `afterEach` for setup/teardown
- Keep tests independent and isolated
- Mock external dependencies
## Best Practices
- One assertion per test when possible
- Use test data builders for complex objects
- Avoid test interdependence
- Keep tests fast (< 1 second each)on:
pull_request:
types: [opened, synchronize]
permissions:
contents: read
pull-requests: write
engine:
id: copilot
custom-agent: .github/agents/code-reviewer.md
# Automated Code Review
Review the pull request changes and provide constructive feedback.name: code-reviewer
description: Agent specialized in performing code reviews
tools:
- read
- search
# Code Review Agent
You are an experienced code reviewer focused on code quality, security, and best practices.
## Review Checklist
- Code follows repository style guidelines
- Proper error handling is implemented
- Security best practices are followed
- Tests are included for new functionality
- Documentation is updated where needed
- No unnecessary complexity
## Feedback Style
- Be constructive and specific
- Explain the reasoning behind suggestions
- Prioritize issues (critical, important, minor)
- Acknowledge good patterns and improvements
- Provide code examples for suggestionson: pull_request
engine:
id: copilot
skills:
- mattpocock/skills/tdd@801dca688564c529fa84f247f64472520d9ebe28
imports:
- .github/agents/code-reviewer.md
# Workflow prompton: issues
engine:
id: copilot
imports:
- .github/agents/my-agent.md
# My Workflow
Instructions for the workflow...on:
issues:
types: [opened]
permissions:
contents: read
issues: write
engine:
id: copilot
imports:
- .github/agents/issue-triager.md
tools:
github:
allowed:
- add_labels_to_issue
- create_issue_comment
# Issue Triage Workflow
Analyze the issue and categorize it appropriately.name: documentation-specialist
description: Creates and maintains technical documentation
tools: [read, edit, search]name: code-refactorer
description: Improves code quality and structure
tools: [read, edit, search]name: security-auditor
description: Reviews code for security vulnerabilities
tools: [read, search]name: migration-helper
description: Assists with framework or library migrations
tools: [read, edit, search]name: issue-manager
description: Manages GitHub issues and project tracking
tools: [read, issue]name: pr-assistant
description: Assists with pull request creation and management
tools: [read, edit, pr]