GitHub Copilot Coding Agent Cheatsheet
By IT-Journey Team
Quick reference for activating, configuring, and constraining the GitHub Copilot coding agent — including AGENTS.md structure, copilot-instructions.md, and permission scopes.
Estimated reading time: 2 minutes
Table of Contents
GitHub Copilot Coding Agent Cheatsheet
Activating the Coding Agent
- Assign an issue to
@copilot(or add thecopilotlabel — check your organisation settings) - Copilot creates a branch, opens a PR, and begins work
- Monitor in the “Copilot” tab of the issue/PR
AGENTS.md Structure
The AGENTS.md file in the repository root tells agents how to work in this repo.
# AGENTS.md
## Repository Context
[Brief description of the project purpose]
## Development Environment
[How to build and test locally]
## Conventions
[Code style, naming, commit format]
## Forbidden Actions
- Do not modify files in `infrastructure/`
- Do not push directly to `main`
- Do not delete any files without explicit instruction
- Do not store credentials in code
## Preferred Patterns
[Architecture patterns the agent should follow]
.github/copilot-instructions.md
Project-level instructions that Copilot reads for all interactions in this repository.
# Copilot Instructions
## Project Summary
[One paragraph describing the project]
## Coding Standards
- Language: [primary language]
- Style guide: [link]
- Testing: [framework and requirements]
## AI Collaboration Guidelines
- Prefer small, focused PRs
- Always include tests for new code
- Update documentation when changing interfaces
Workflow Permissions (Minimum for Coding Agent)
permissions:
contents: write # Create branches, commit files
pull-requests: write # Create and update PRs
issues: write # Comment on issues
Key GitHub Actions Contexts
| Context | Value |
|---|---|
github.actor |
Who triggered the run |
github.event_name |
Event type (push, issues, etc.) |
github.sha |
Current commit SHA |
github.ref |
Current branch/tag ref |
github.run_id |
Unique ID for this workflow run |
Environment Variables for Agent Context
GITHUB_REPOSITORY # owner/repo
GITHUB_WORKFLOW # workflow name
GITHUB_RUN_ID # unique run ID (use as correlation ID)
GITHUB_ACTOR # who triggered this run
GITHUB_EVENT_NAME # trigger event type
Part of: [[GH-600 Agentic AI Quick-Reference Notes]] · Hub: [[The Agentic Codex: GH-600 Study Hub]]