docs: Add release workflow cursor rule and PR template#976
Conversation
Added comprehensive release workflow documentation for AI agents and human maintainers: - Created .cursor/rules/release-workflow.md with: - Step-by-step release creation workflow - Changelog quality standards (Keep a Changelog format) - MIGRATION.md documentation patterns for breaking changes - PR template usage and structure - Verification checklists - Anti-patterns and golden path examples - Created .github/PULL_REQUEST_TEMPLATE/release.md: - Standardized release PR template based on recent releases - Structured sections for package versions, changes, breaking changes - Pre-filled checklist for release verification - Updated CLAUDE.md to reference new release workflow rule This addresses the gap in MIGRATION.md documentation guidance and provides AI-first release process documentation.
📖 Storybook Preview |
Reduced from 597 to 327 lines by: - Removing full PR template example (just reference template file) - Condensing anti-patterns section - Focusing on MIGRATION.md guidance (key gap identified) - More bullets, less narrative - Referencing existing docs instead of duplicating Maintains effectiveness while following Layer 2 format (200-400 lines, checklists not novels).
📖 Storybook Preview |
Addressed all review comments from PR #976: 1. Release strategy: Added guidance to isolate large breaking changes to single releases 2. Command: Changed npx to yarn create-release-branch (documented in contributing.md) 3. Changelog quality: Added rule to remove dev dependencies and developer-only changes 4. Peer deps: Added critical warning not to manually update peer deps (causes build errors) 5. Golden paths: Added both React and React Native MIGRATION.md references 6. Trimmed: Reduced from 327 to 244 lines (within 200-400 target) 7. Removed editorial: Removed '(Critical Gap)' from MIGRATION.md heading Also updated docs/reviewing-release-prs.md: - Added new section 7: Review MIGRATION.md for breaking changes - Updated tl;dr checklist to include MIGRATION.md verification - Cross-referenced .cursor/rules/release-workflow.md for detailed examples
📖 Storybook Preview |
| - ✅ **Include PR references** `([#123](...))` | ||
| - ✅ **Link to MIGRATION.md** for breaking changes | ||
|
|
||
| ### MIGRATION.md Documentation |
There was a problem hiding this comment.
This section addresses a critical documentation gap. Previously, there was no guidance on WHEN to update MIGRATION.md or HOW to structure migration documentation. This led to:
- Inconsistent breaking change documentation across releases
- Missing migration examples for consumers
- Placeholder examples ("0x123") instead of realistic addresses
The structured pattern (What Changed → Migration → Impact) ensures consumers can upgrade confidently.
| yarn constraints --fix && yarn && yarn dedupe | ||
| ``` | ||
|
|
||
| **CRITICAL:** Do NOT manually update peer dependencies - yarn workspaces handles this automatically. Manual updates cause build errors. |
There was a problem hiding this comment.
Why peer dependency warning is critical:
Manual peer dependency updates cause build errors. Yarn Workspaces and npm's publish process automatically manage peer dependency relationships. When publishing, npm ensures peer dependencies stay in sync across the monorepo.
Manual edits to peerDependencies in package.json files create conflicts with this automation, leading to:
- Type mismatches between packages
- Build failures in CI
- Incorrect dependency resolution
Examples
- https://github.com/MetaMask/metamask-design-system/actions/runs/22415427643/job/64899934423
- https://github.com/MetaMask/metamask-design-system/actions/runs/22198282954/job/64204490405
The yarn constraints --fix && yarn dedupe command handles workspace: protocol dependencies and deduplication, but peer dependencies are managed by the publish process. This anti-pattern was observed in previous releases and needs explicit documentation to prevent recurrence.
| ### Step 3: Update Changelogs | ||
|
|
||
| Transform auto-generated entries into consumer-facing descriptions. | ||
|
|
There was a problem hiding this comment.
Changelog entries should focus on consumer-facing changes - what developers using the design system packages need to know when upgrading.
Dev dependencies (prettier, eslint, typescript, testing tools) are:
- Internal to the design system development workflow
- Not published in the npm packages
- Invisible to package consumers
- Not relevant to upgrade decisions
Including them creates noise that obscures the actual API changes, bug fixes, and new features that matter to consumers. This distinction aligns with Keep a Changelog best practices.
| ### Release Strategy | ||
|
|
||
| - ✅ **Release often** for non-breaking changes | ||
| - ✅ **Isolate large breaking changes** to single releases (design tokens, major component API changes) |
There was a problem hiding this comment.
Large breaking changes (design tokens, major component API overhauls) require significant consumer effort to adopt. Isolating them to dedicated releases:
- Reduces upgrade friction: Consumers can adopt smaller non-breaking releases frequently without blocking on large migrations
- Clearer communication: Release notes clearly signal "this is a major migration" vs "safe upgrade"
- Better testing: Consumers can test large changes in isolation without other API changes interfering
- Simplified rollback: If issues arise, consumers can rollback a focused change rather than a mixed release
Examples of large breaking changes that warrant isolation: design token system overhauls, ButtonIcon variant prop migration, Input controlled-only requirement.
| Therefore, review the [changes committed since the previous release](#review-changes) and look for changed versions of workspace dependencies. If any are missing from changelogs, notify the creator of the release PR so that they can add them, offering a suggestion as appropriate. | ||
|
|
||
| ## 7. Approve the release | ||
| ## 7. Review MIGRATION.md for breaking changes |
There was a problem hiding this comment.
Section 7 addresses a critical gap in the reviewer checklist. Previously, reviewers had no guidance on verifying MIGRATION.md documentation for breaking changes, leading to:
- Incomplete migration documentation reaching production
- Consumers struggling with breaking changes due to missing examples
- Inconsistent MIGRATION.md quality across releases
This section provides reviewers with a systematic checklist to verify:
- Version section exists and is properly formatted
- Table of contents is updated
- Documentation includes What Changed/Migration/Impact structure
- Examples are realistic (not placeholders)
- Cross-platform consistency when changes affect both platforms
Cross-references .cursor/rules/release-workflow.md for detailed MIGRATION.md structure patterns, maintaining the three-layer documentation architecture (Layer 2 cursor rules ↔ Layer 3 reviewer docs).
| Or use the default PR template and manually copy this structure. | ||
| --> | ||
|
|
||
| ## Release VERSION |
There was a problem hiding this comment.
This template is based on previous release PRs e.g. #972 (release v25.0.0), which demonstrated:
- Clear package version summary at the top
- Platform-organized sections (Shared, React Web, React Native)
- Dedicated breaking changes section with migration examples
- Comprehensive checklist for both authors and reviewers
| - @.cursor/rules/component-enum-union-migration.md | ||
| - @.cursor/rules/component-migration.md | ||
| - @.cursor/rules/figma-integration.md | ||
| - @.cursor/rules/release-workflow.md |
There was a problem hiding this comment.
CLAUDE.md is the Layer 1 entry point that Claude Code reads at session start. Adding this reference ensures:
- AI agents are aware of release workflow patterns when creating or reviewing release PRs
- Maintains consistency with the three-layer documentation architecture (see @docs/ai-agents.md):
- Layer 1: CLAUDE.md (entry point, references Layer 2 rules)
- Layer 2: .cursor/rules/ (focused actionable rules, 200-400 lines)
- Layer 3: docs/ (comprehensive human guides)
The release workflow rule fills a critical documentation gap - without it, AI agents had no guidance on MIGRATION.md structure, changelog quality standards, or release strategy. This reference makes the workflow discoverable and actionable for AI-assisted development.
Add design-tokens package MIGRATION.md as first example in golden paths section. This file demonstrates excellent breaking change documentation with comprehensive version-to-version migration guidance, realistic token examples, and proper structure.
|
|
||
| **Migration docs:** | ||
|
|
||
| - @packages/design-tokens/MIGRATION.md |
There was a problem hiding this comment.
The design-tokens package MIGRATION.md demonstrates exemplary breaking change documentation:
- Comprehensive version history: Documents migrations from v2.1.1 → v8.0.0, showing how to maintain long-term migration guidance
- Clear structure: Each version section follows the "What Changed → Migration Steps → Impact" pattern this rule teaches
- Realistic examples: Uses actual CSS variables (
--color-background-section) and JS tokens (colors.background.section), not placeholders - Before/after comparisons: Shows exact token replacements with context
- Cross-platform guidance: Covers both web (CSS) and React Native (JS) token usage
This file serves as the gold standard for MIGRATION.md structure and should be referenced when documenting breaking changes in component packages.
📖 Storybook Preview |
📖 Storybook Preview |
## **Description** This PR adds comprehensive release workflow documentation for AI agents and human maintainers, addressing a critical gap in MIGRATION.md documentation guidance. **What changed:** 1. **Created `.cursor/rules/release-workflow.md`** (244 lines - Layer 2 cursor rule): - Step-by-step release creation workflow (`yarn create-release-branch`) - Release strategy guidance (release often, isolate large breaking changes) - Changelog quality standards with **explicit rules to remove dev dependencies** - **MIGRATION.md documentation patterns** (structure, critical rules, examples) - NEW - **Peer dependency warning** - do NOT manually update (causes build errors) - PR template usage and release PR structure - Verification checklists for release quality - Anti-patterns with before/after examples 2. **Updated `docs/reviewing-release-prs.md`**: - Added new **Section 7: Review MIGRATION.md for breaking changes** - Updated tl;dr checklist to include MIGRATION.md verification - Cross-references `.cursor/rules/release-workflow.md` for detailed examples 3. **Created `.github/PULL_REQUEST_TEMPLATE/release.md`**: - Standardized release PR template based on recent releases (PR #972) - Structured sections: package versions, categorized changes, breaking changes - Pre-filled verification checklist - Usage: append `?template=release.md` to PR compare URL 4. **Updated `CLAUDE.md`**: - Added reference to new release-workflow rule **Why these changes:** During the v25 release, we identified that there was no guidance on: - How to write MIGRATION.md documentation for breaking changes - When to update MIGRATION.md (any breaking change) - What structure/examples to use in migration sections - Critical rules (realistic examples, table of contents updates, before/after code) - **What to exclude from changelogs** (dev dependencies, internal tooling) - **Peer dependency management** (automated by yarn workspaces) This PR fills those gaps with AI-first documentation following our three-layer strategy (see docs/ai-agents.md): - Layer 1 (CLAUDE.md): References new rule - Layer 2 (.cursor/rules/): Actionable checklist-based workflow (200-400 lines) - Layer 3 (docs/): Human-focused reviewer guide now includes MIGRATION.md verification **Key improvements from review feedback:** 1. ✅ Release strategy: Isolate large breaking changes to single releases 2. ✅ Command corrected: `yarn create-release-branch` (not npx) 3. ✅ Changelog quality: Remove dev dependencies and developer-only changes 4. ✅ Peer deps: Critical warning not to manually update (causes errors) 5. ✅ Golden paths: Both React and React Native MIGRATION.md references 6. ✅ Trimmed: 244 lines (within 200-400 target range) 7. ✅ Removed editorial: "(Critical Gap)" from heading **MIGRATION.md structure documented:** \`\`\`markdown ## From version 0.X.0 to 0.Y.0 ### Component Breaking Change **What Changed:** - Old vs new API - Rationale **Migration:** \\\`\\\`\\\`tsx // Before (0.X.0) import { Component } from '@metamask/design-system-react'; <Component oldProp={value} /> // After (0.Y.0) import { Component, NewEnum } from '@metamask/design-system-react'; <Component newProp={NewEnum.Value} /> \\\`\\\`\\\` **Impact:** - Who is affected - What breaks \`\`\` ## **Related issues** Fixes: N/A (Documentation improvement identified during v25 release) ## **Manual testing steps** 1. Review \`.cursor/rules/release-workflow.md\` for completeness 2. Check MIGRATION.md guidance section matches recent v25 patterns 3. Verify release PR template structure matches PR #972 4. Confirm CLAUDE.md correctly references new rule 5. Review \`docs/reviewing-release-prs.md\` new section 7 ## **Screenshots/Recordings** N/A - Documentation only ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) - [x] I've completed the PR template to the best of my ability - [x] I've included tests if applicable (N/A - documentation) - [x] I've documented my code using [JSDoc](https://jsdoc.app/) format if applicable (N/A - markdown docs) - [ ] I've applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation/template additions only; no runtime or build logic changes, so risk is limited to process adoption/accuracy. > > **Overview** > Adds an AI-focused release workflow rule (`.cursor/rules/release-workflow.md`) that standardizes release branch creation, dependency update commands, changelog quality expectations, and required `MIGRATION.md` documentation for breaking changes (including anti-pattern callouts). > > Introduces a dedicated release PR template (`.github/PULL_REQUEST_TEMPLATE/release.md`) with sections for package/version listings, platform-specific changes, explicit breaking-change migration guidance, and pre-merge checklists; updates `docs/reviewing-release-prs.md` to require reviewing `MIGRATION.md` for breaking changes and links this guidance from `CLAUDE.md`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e648a38. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Description
This PR adds comprehensive release workflow documentation for AI agents and human maintainers, addressing a critical gap in MIGRATION.md documentation guidance.
What changed:
Created
.cursor/rules/release-workflow.md(244 lines - Layer 2 cursor rule):yarn create-release-branch)Updated
docs/reviewing-release-prs.md:.cursor/rules/release-workflow.mdfor detailed examplesCreated
.github/PULL_REQUEST_TEMPLATE/release.md:?template=release.mdto PR compare URLUpdated
CLAUDE.md:Why these changes:
During the v25 release, we identified that there was no guidance on:
This PR fills those gaps with AI-first documentation following our three-layer strategy (see docs/ai-agents.md):
Key improvements from review feedback:
yarn create-release-branch(not npx)MIGRATION.md structure documented:
```markdown
From version 0.X.0 to 0.Y.0
Component Breaking Change
What Changed:
Migration:
\`\`\`tsx
// Before (0.X.0)
import { Component } from '@metamask/design-system-react';
// After (0.Y.0)
import { Component, NewEnum } from '@metamask/design-system-react';
\`\`\`
Impact:
```
Related issues
Fixes: N/A (Documentation improvement identified during v25 release)
Manual testing steps
Screenshots/Recordings
N/A - Documentation only
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Documentation-only changes that standardize the release process; no runtime code, build, or dependency behavior is modified.
Overview
Adds a new AI-focused release workflow cursor rule (
.cursor/rules/release-workflow.md) that standardizes how to cut releases, write consumer-facing changelogs, and document breaking changes inMIGRATION.md(including explicit anti-patterns like dev-deps in changelogs and manual peer dep edits).Introduces a dedicated release PR template (
.github/PULL_REQUEST_TEMPLATE/release.md) with structured sections for package versions, categorized changes, breaking-change migration guidance, and author/reviewer checklists.Updates
docs/reviewing-release-prs.mdto require explicitMIGRATION.mdreview for breaking changes, and links the new rule fromCLAUDE.md.Written by Cursor Bugbot for commit 223d172. This will update automatically on new commits. Configure here.