Skip to content

Add copilot-instructions.md file#78584

Open
mikachan wants to merge 1 commit into
trunkfrom
add/copilot-instructions
Open

Add copilot-instructions.md file#78584
mikachan wants to merge 1 commit into
trunkfrom
add/copilot-instructions

Conversation

@mikachan
Copy link
Copy Markdown
Member

What?

Adds a .github/copilot-instructions.md file to guide GitHub Copilot's PR review behaviour repo-wide.

The file is split into three short sections:

  • PR review guidelines: how Copilot should review (short comments, no top-level summary, no style nits as these are caught by lint and PHPCS).
  • What not to flag: calibration rules to suppress recurring false positives (hallucinated APIs, refactor requests for inherited duplication, theoretical edge cases).
  • Gutenberg-specific context: small set of guardrails against Copilot second-guessing intentional WordPress patterns (@wordpress/data, __()/_x()/_n(), the block-editoreditoredit-post package layering rule).

Why?

Copilot's default PR review in this repo tends toward long summary restatement and style observations that lint already covers, while occasionally producing comments based on hallucinated or unverified WordPress core APIs.

I sampled 50 recent Copilot reviews in this repo to form these rules:

  • Already strong (so don't duplicate): cross-file consistency, hook deps, duplication detection, doc/code drift, numeric edge cases.
  • Recurring pushback themes from PR authors: hallucinated WordPress core APIs / strings, requests to refactor pre-existing inherited duplication, over-cautious "what about this edge case" comments with no real-world impact.

How?

GitHub Copilot reads .github/copilot-instructions.md and merges its contents into every PR review in the repo.

If this works well and folks agree, we could extend this to include further instruction files for more specific things, like code changes in specific packages having an additional set of guidance. I'm not sure how far we need to take this for it to be as helpful as possible.

Testing Instructions

Let's see if this improves the quality of Copilot's reviews once it's merged.

Use of AI Tools

I used Claude Code to sample the recent Copilot reviews and draft the instructions.

@mikachan mikachan requested a review from desrosj as a code owner May 22, 2026 16:11
@mikachan mikachan added the [Type] Enhancement A suggestion for improvement. label May 22, 2026
@aduth
Copy link
Copy Markdown
Member

aduth commented May 22, 2026

Let's see if this improves the quality of Copilot's reviews once it's merged.

Would it apply if we asked for Copilot's review here? 😄 (Maybe with some sample code changes if needed)

I'm particularly interested in the point about "NEVER produce a review body". Will it abide that? Is it actually desirable? I mean, if a human would have reasons to leave a top-level review comment, why wouldn't the same apply to an AI agent?

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: mikachan <mikachan@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Enhancement A suggestion for improvement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants