Repository navigation
Docs: Refine design system agent guidance #84007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
21b8e02
956d2c0
e68e6dc
1820aec
d839e1d
e556f0e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,55 +1,21 @@ | ||
| --- | ||
| name: design-system-code-review | ||
| description: Use when reviewing a Gutenberg change to a WordPress Design System package or its public contract, including `@wordpress/components`, `@wordpress/ui`, or `@wordpress/theme`; do not use to implement the change or review a consumer-only application. | ||
| description: Use when reviewing changes to @wordpress/components, @wordpress/ui, or @wordpress/theme and their public contracts. For application code that only consumes these packages, use design-system-ui-review. | ||
| --- | ||
|
|
||
| # Review a WordPress Design System contribution | ||
|
|
||
| ## Establish the review boundary | ||
| Read the affected package's `AGENTS.md` and [Working with WordPress Design System packages](../../../docs/contributors/design/design-system-packages.md#change-a-package-safely). Review the proposed source and the consumers it affects. For a mixed package-and-consumer change, also use [design-system-ui-review](../design-system-ui-review/SKILL.md) on the application code. | ||
|
|
||
| 1. Define the changed public surface and observable behaviour. | ||
| 2. Scan the complete diff once, then classify it as: | ||
| - **Internal:** no public contract or observable behaviour changes. | ||
| - **Public:** adds, removes, renames, or changes supported behaviour. | ||
| 3. Read [Working with WordPress Design System packages](../../../docs/contributors/design/design-system-packages.md) | ||
| and the applicable package source guidance. | ||
| 4. Apply the public guide's evidence precedence: the diff is the proposed | ||
| post-change state, target source is its baseline, and MCP is supplementary | ||
| current-design context. | ||
| ## What to look for | ||
|
|
||
| ## Review proportionally | ||
| 1. **Behaviour in the wrong package or duplicated implementation.** Keep product-specific behaviour in the consumer. Check whether existing components, helpers, or tokens already meet the need before adding another API or implementation. Use the MCP server's `get_components` and `get_component_details`, or the guide's [recommendation sources](../../../docs/contributors/design/design-system-packages.md#choose-a-recommended-component), when component selection matters; verify the result against the reviewed source. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a nit but also worth thinking about how we document for ourselves and AI: Should the spelling be the Americanized "behavior" and not "behaviour" (per documentation grammar guide)?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, switched to American English throughout the guidance changed by this PR and updated the affected anchor links. |
||
| 2. **Broken component composition.** Check changes to prop and ref forwarding, rendered elements, controlled and uncontrolled state, callback arguments, and default behaviour. Inspect affected wrappers and compound components. Test our changed integration where it introduces a meaningful risk; do not duplicate the underlying dependency's behaviour tests. | ||
| 3. **Incompatible public changes.** Use the guide's [contract comparison](../../../docs/contributors/design/design-system-packages.md#compare-contracts-before-replacing-an-api) for removed or changed props, exports, tokens, styling hooks, and extension points. Include external consumers; migrated Gutenberg callers do not prove plugin compatibility. Check that published types resolve through declared dependencies. | ||
| 4. **Styles that break composition or theming.** Look for inappropriate hard-coded values, tokens selected by value rather than purpose, lost consumer overrides, and declarations that depend on stylesheet order. Use `get_design_tokens` or the [token reference](../../../packages/theme/docs/tokens.md) for semantic choices, and the package's styling guidance for its CSS conventions. Check portal destinations and affected theme modes when the change can alter them. | ||
| 5. **Interaction or accessibility regressions.** Check the semantics, accessible names, keyboard paths, focus, and disabled states the change can affect. Use the guide's [verification guidance](../../../docs/contributors/design/design-system-packages.md#verify-the-affected-behaviour) for standards and browser evidence. Passing types or class assertions do not prove interaction or visual parity. | ||
| 6. **Public documentation or generated output left behind.** Check affected prop documentation, stories, component status and recommendation metadata, generated token assets, and required changelogs. Do not request new stories or documentation for an unchanged capability. | ||
|
|
||
| For an internal change, verify contract preservation and focused coverage, then | ||
| skip the public-only work below. For a public change: | ||
| Apply [package-runtime-compatibility](../package-runtime-compatibility/SKILL.md) only when the changed contract crosses independently updated package and WordPress versions. For an Emotion migration, use the [migration guide](../../../packages/components/emotion-to-scss-modules.md) to check cascade and consumer compatibility. | ||
|
|
||
| - assess Gutenberg and external package consumers separately; | ||
| - verify compatibility and migration rather than treating repository migration | ||
| as sufficient; | ||
| - before drafting findings for a removal, replacement, or rename, compare the | ||
| old and new accepted values, semantics, states, interaction, and styling in | ||
| a compact contract table; complete the comparison even after finding one | ||
| valid defect; | ||
|
|
||
| For either classification, use the public guide's | ||
| [package completion gate](../../../docs/contributors/design/design-system-packages.md#change-a-package-safely) | ||
| and inspect only the surfaces applicable to the change. | ||
|
|
||
| If a published package can run with a dependency supplied separately by WordPress, apply the [`package-runtime-compatibility`](../package-runtime-compatibility/SKILL.md) skill before concluding the review. | ||
|
|
||
| Use browser evidence when source or class assertions cannot establish visual, | ||
| focus, motion, or layout parity. | ||
|
|
||
| ## Finding evidence gate | ||
|
|
||
| Before reporting a finding, identify the exact changed line, affected public | ||
| contract or behaviour, target-source or consumer evidence, and concrete impact. | ||
| Treat incomplete diff context as a verification gap unless the complete patch | ||
| proves the defect. Apply the same evidence and precision standard even when | ||
| another valid defect already exists. | ||
|
|
||
| ## Output contract | ||
|
|
||
| Recheck every finding against the complete diff and source. Separate defects, | ||
| verification gaps, and optional follow-ups. Report material findings with | ||
| proportional severity and the smallest coherent direction; report no findings | ||
| when the evidence exposes none. | ||
| Keep findings tied to the change, including downstream effects. Missing tests alone are not a finding. Reuse existing coverage and request a new check only for a concrete, meaningful risk introduced by our code or integration. Combine concerns that have one coherent fix. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,60 +1,29 @@ | ||
| --- | ||
| name: design-system-contribution | ||
| description: Use when planning or implementing a safe `@wordpress/components`, `@wordpress/ui`, or `@wordpress/theme` change in a local Gutenberg checkout; do not use for consumer-only application changes or infer commit, push, or pull-request authority. | ||
| description: Use when planning or implementing changes to @wordpress/components, @wordpress/ui, or @wordpress/theme in a Gutenberg checkout. For application code that only consumes these packages, use design-system-ui-composition. | ||
| --- | ||
|
|
||
| # Contribute to the WordPress Design System | ||
|
|
||
| ## Classify the change | ||
| Read the affected package's `AGENTS.md` and the relevant [package contribution guidance](../../../docs/contributors/design/design-system-packages.md#change-a-package-safely). | ||
|
|
||
| 1. State the requested outcome and relevant package or consumers. | ||
| 2. Classify the change as internal or public: | ||
| - **Internal:** preserves the public contract and observable behaviour. | ||
| - **Public:** adds or changes supported behaviour. | ||
| 3. For a public change, state the missing behaviour and audit existing public | ||
| composition and similar components or tokens. | ||
| 4. If supported behaviour already meets the public need, recommend it and stop | ||
| unless the request establishes a distinct contract. | ||
| ## Choose the smallest change | ||
|
|
||
| Read the cross-package guide and the package-specific source guidance that | ||
| matches the change: | ||
| Start from the consumer's need. For a bug fix, reproduce the failure and identify the behaviour to restore. For a refactor, identify the behaviour to preserve. A new capability needs a concrete use case and an explanation of why existing public composition is insufficient. | ||
|
|
||
| - [`docs/contributors/design/design-system-packages.md`](../../../docs/contributors/design/design-system-packages.md) | ||
| - [`storybook/stories/design-system/contributing.md`](../../../storybook/stories/design-system/contributing.md) | ||
| for when to report instead of fix, and what a report contains | ||
| - [`packages/components/CONTRIBUTING.md`](../../../packages/components/CONTRIBUTING.md) | ||
| - [`packages/ui/CONTRIBUTING.md`](../../../packages/ui/CONTRIBUTING.md) | ||
| - [`packages/theme/README.md`](../../../packages/theme/README.md) | ||
| - [`packages/theme/tokens/README.md`](../../../packages/theme/tokens/README.md) | ||
| When choosing a component or token, use the MCP server's `get_components`, `get_component_details`, and `get_design_tokens` as appropriate, or the guide's [recommendation sources](../../../docs/contributors/design/design-system-packages.md#choose-a-recommended-component) and the [token reference](../../../packages/theme/docs/tokens.md). Check the current source before adding an API that appears to be missing. | ||
|
|
||
| Use an available WordPress Design System MCP server to learn current direction | ||
| when useful, but verify implementation and compatibility against this checkout. | ||
| Keep product-specific behaviour in the consuming package and use [design-system-ui-composition](../design-system-ui-composition/SKILL.md) for that work. For unresolved public design decisions, follow [Contributing to the Design System](../../../storybook/stories/design-system/contributing.md#fix-it-at-the-source) before implementation; continue work that does not depend on that decision. | ||
|
|
||
| ## Scale work to the contract | ||
| ## Preserve the affected contracts | ||
|
|
||
| - For an internal change, preserve the public contract and run focused checks. | ||
| - For a public change, define the contract and assess external consumers, | ||
| compatibility, migration, documentation, and generated output. | ||
| - For a replacement or rename, compare observable old and new values, states, | ||
| and interaction—not only types or class names. | ||
| - Follow the package's component, prop/ref, state, and styling conventions. Reuse existing composition and helpers instead of rebuilding behaviour already provided by a dependency. | ||
| - For removals, replacements, or behaviour changes, compare the affected old and new contracts using the [compatibility guidance](../../../docs/contributors/design/design-system-packages.md#compare-contracts-before-replacing-an-api). Include plugin and npm consumers, even when all Gutenberg callers have been migrated. | ||
| - For token changes, choose by semantic purpose and affected modes, then follow the [token source guide](../../../packages/theme/tokens/README.md) and [build procedure](../../../packages/theme/README.md#building). For Emotion migrations, use [emotion-to-scss-modules](../emotion-to-scss-modules/SKILL.md). | ||
| - Use [package-runtime-compatibility](../package-runtime-compatibility/SKILL.md) only when changing a contract between independently updated package and WordPress versions. | ||
|
|
||
| Follow current package precedents only where they apply. Do not add optional | ||
| stories, public documentation, release notes, or compatibility machinery for | ||
| an unchanged public capability. Still follow the repository's required package | ||
| changelog policy for production code changes. | ||
| ## Verify what changed | ||
|
|
||
| If a published package can run with a dependency supplied separately by WordPress, apply the [`package-runtime-compatibility`](../package-runtime-compatibility/SKILL.md) skill before implementation. | ||
| Start with existing tests and stories. Add coverage only for a concrete regression risk introduced by our code or integration that existing coverage does not address. Rely on dependency tests for behaviour the dependency owns; avoid speculative edge cases and exhaustive combinations. Use the guide's [verification choices](../../../docs/contributors/design/design-system-packages.md#verify-the-affected-behaviour) for checks that need a browser. | ||
|
|
||
| ## Finish | ||
|
|
||
| Use the public guide's | ||
| [package completion gate](../../../docs/contributors/design/design-system-packages.md#change-a-package-safely) | ||
| with the applicable package source guidance. Mark each relevant contract | ||
| surface complete, not applicable, or blocked. | ||
|
|
||
| Run focused tests and required lint, type, generation, or build checks. Verify | ||
| interaction or CSS behaviour where source-level tests cannot establish it. | ||
|
|
||
| Stop for product or design-system agreement when a public component, token, or | ||
| API lacks accepted behaviour. Include consumer evidence, alternatives, | ||
| compatibility impact, and the proposed contract. | ||
| Follow the [completion checks](../../../docs/contributors/design/design-system-packages.md#change-a-package-safely) for affected exports, documentation, generated files, and changelogs, along with the repository's required checks. State any material verification gap without claiming visual parity from snapshots or class assertions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doc is much improved 👍