From 9ee8622cff360873b56323fc69d4cfb33a293270 Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Fri, 22 May 2026 15:58:50 +0200 Subject: [PATCH] Add copilot-instructions.md file --- .github/copilot-instructions.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 00000000000000..a8c3d1e55b0308 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,23 @@ +## PR review guidelines + +When reviewing pull requests: + +- Only comment on semantically meaningful issues: bugs, incorrect logic, security problems, accessibility regressions, or API contract violations. +- Skip style, formatting, naming, and whitespace observations — these are enforced by lint and PHPCS. +- Keep each comment short — one or two sentences maximum. +- Do not write long descriptions or summaries of what the code does. +- Do not suggest refactors or improvements unrelated to the PR's stated goal. +- NEVER produce a review body or top-level PR overview comment. The review body MUST be empty. Put findings only in inline comments on specific lines. + +## What not to flag + +- **Do not speculate about external code.** Verify WordPress, PHP, and Node APIs, function signatures, and version constraints against the diff or repo files (`composer.json`, `package.json`, etc.) before flagging compatibility or contract issues. Do not invent strings, error messages, or behaviour in linked codebases such as WordPress core. If a claim cannot be verified from the diff or repository, do not include it. +- **Do not request refactor of inherited duplication.** If a pattern already exists in the codebase before this PR, do not ask the author to extract a helper or deduplicate. Flag it at most once for awareness. +- **Calibrate edge-case warnings.** Do not flag theoretical edge cases (`Number.MAX_VALUE`, subnormals, inputs that cannot occur given current callers). Flag edge cases only when they correspond to inputs that can plausibly reach the code. +- **Do not request tests** when the surrounding test files are out of scope for the PR. Flag missing tests only when the new behaviour is risky and adding a test fits the diff naturally. + +## Gutenberg-specific context + +- Do not suggest replacing `@wordpress/data` selectors / actions with local React state — this is the project's intentional state pattern. +- Do not suggest replacing `__()` / `_x()` / `_n()` calls with template literals — these are WordPress i18n functions. +- Do not suggest moving code between `block-editor`, `editor`, and `edit-post` packages without considering the layering rule (`block-editor` is WordPress-agnostic; lower layers must not depend on higher ones).