Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 10, 2025

Plan: Split Copilot Instructions for Coding Agent and Code Review Agent

  • Analyze existing copilot-instructions.md content to identify what should go where
  • Keep .github/copilot-instructions.md (coding agent instructions) with existing content
    • Contains building, testing, and coding style guidelines
    • Focuses on how to write and validate code changes
    • Added excludeAgent: code-review-agent frontmatter
  • Create .github/code-review-instructions.md (code review agent instructions) focused on:
    • Security concerns (injection, crypto, authentication, etc.)
    • Performance issues (algorithmic complexity, allocations, etc.)
    • Backwards compatibility (API changes, serialization, etc.)
    • Cross-component interactions (runtime/library boundaries, platform differences)
    • Correctness and edge cases
    • Design and architecture quality
    • Testing adequacy
    • Documentation clarity
    • Explicitly excludes stylistic/compiler issues (handled by CI)
    • Added excludeAgent: coding-agent frontmatter
  • Address review feedback:
    • Changed excludeAgent: coding to excludeAgent: coding-agent
    • Changed excludeAgent: code-review to excludeAgent: code-review-agent
    • Clarified XML documentation requirement: only NEW public APIs need comments
    • Updated comment guidance: explain "why" not "how"
    • Removed performance characteristics documentation line (line 107)
    • Enhanced review approach: consider relevant code from containing project and repo-wide usage for public APIs
  • Verify the files are properly formatted with no trailing whitespace
  • Validate the changes are complete and meet requirements

Summary

Successfully split the Copilot instructions into two specialized files with proper agent exclusion:

  1. .github/copilot-instructions.md - Coding Agent Instructions (excludes code-review-agent)

    • YAML frontmatter: excludeAgent: code-review-agent
    • 323 lines focused on how to implement changes correctly
  2. .github/code-review-instructions.md - Code Review Agent Instructions (excludes coding-agent)

    • YAML frontmatter: excludeAgent: coding-agent
    • 129 lines focused on expert-level review priorities
    • Clarified to focus on NEW public APIs for documentation
    • Emphasizes "why" comments over "how" comments
    • Enhanced to consider broader code context in reviews

Each agent now only sees the instructions relevant to its role.

Original prompt

Following the guidance / feature announcement at https://github.blog/changelog/2025-11-12-copilot-code-review-and-coding-agent-now-support-agent-specific-instructions/, please split this repo's copilot-instructions.md into one for coding agent and one for the code review agent. It's expected that most of the existing instructions should remain in the coding agent instructions. Author the code review agent instructions file on the core things relevant to this repo. The compiler and static analyzers run on every PR, so we don't want or need copilot commenting about stylistic issues or about things it thinks the compiler won't accept. Instead, we want it to focus on things that expert .NET reviewers will be paying attention to: security, performance, backwards compatibility, how the change interacts with other components, etc. https://github.blog/ai-and-ml/unlocking-the-full-power-of-copilot-code-review-master-your-instructions-files/ provides general guidance on authoring review instructions (use that for guidance on what can be done but don't use the examples there as the actual instructions as that's not relevant to this repo).


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copilot AI changed the title [WIP] Split copilot instructions into two files Split Copilot instructions into agent-specific files Dec 10, 2025
Copilot AI requested a review from stephentoub December 10, 2025 22:33
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
@stephentoub stephentoub marked this pull request as ready for review December 11, 2025 15:56
Copilot AI review requested due to automatic review settings December 11, 2025 15:56
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR successfully splits the Copilot instructions into two agent-specific files following GitHub's new feature for targeting different AI agents. The coding agent will focus on implementing changes correctly, while the code review agent will focus on expert-level review concerns.

Key Changes:

  • Added YAML frontmatter to both files to exclude the non-relevant agent
  • Kept existing comprehensive build/test/coding guidelines in the coding agent instructions
  • Created focused code review instructions emphasizing security, performance, compatibility, and design over style

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
.github/copilot-instructions.md Added YAML frontmatter with excludeAgent: code-review-agent to target only the coding agent, keeping all existing build, test, and coding style guidelines
.github/code-review-instructions.md New file with excludeAgent: coding-agent targeting the code review agent, containing comprehensive review priorities for security, performance, backwards compatibility, cross-component interactions, correctness, design, testing, and documentation

The changes are well-structured and align with the repository's needs. The code review instructions appropriately focus on expert judgment areas (security, performance, compatibility) while explicitly excluding automated tooling concerns (formatting, syntax). Both files follow proper YAML frontmatter syntax and markdown formatting without trailing whitespace issues.

@stephentoub
Copy link
Member

/ba-g markdown only

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to see examples code-review feedback improved by this prompt? Or is the "production" only reasonable way to see how this prompt is going to work in practive?

@stephentoub
Copy link
Member

Is it possible to see examples code-review feedback improved by this prompt?

Unfortunately, not to my knowledge. I've shared such feedback that there needs to be a tighter inner loop on iterating on these.

@stephentoub
Copy link
Member

/ba-g markdown only

@stephentoub stephentoub merged commit 0b3f3ab into main Dec 12, 2025
15 of 16 checks passed
@stephentoub stephentoub deleted the copilot/split-copilot-instructions branch December 12, 2025 14:15
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants