shepherd-prs

作者: flutter

自动化管理、更新和落地你在flutter/flutter仓库中的个人开源PR以及已批准的第三方贡献者PR。使用场景:-…

npx skills add https://github.com/flutter/flutter --skill shepherd-prs

Shepherding Pull Requests Skill (flutter/flutter)

This skill defines the canonical runbook for shepherding pull requests in the flutter/flutter repository using native GitHub CLI (gh) commands.

1. Checking PR Status

When the user asks for the status of open or approved PRs:

  1. List Your Own Open PRs:
    gh pr list --repo flutter/flutter --author <username> --state open --json number,title,url,mergeable,reviewDecision
    
  2. List Shepherded / Reviewed Third-Party PRs:
    gh pr list --repo flutter/flutter --search "reviewed-by:<username> -author:<username> is:open" --json number,title,url,mergeable,reviewDecision
    
  3. Inspect Detailed PR Checks:
    gh pr checks <number> --repo flutter/flutter
    
  4. Inspect Reviews, Labels, and Comments:
    gh pr view <number> --repo flutter/flutter --json labels,reviewDecision,reviews,comments
    

2. Pre-Autosubmit Verification Rules

Before applying or re-applying the autosubmit label (gh pr edit <number> --repo flutter/flutter --add-label autosubmit), always perform the following pre-flight verification checks to ensure the autosubmit bot will not reject or strip the label:

  1. Check Previous autosubmit Removal History in Comments:

    • Always check if the autosubmit label was previously removed by the auto-submit bot by checking PR comments:
      gh pr view <number> --repo flutter/flutter --json comments
      
    • Look for messages from auto-submit such as "autosubmit label was removed...".
    • If the label was previously removed, identify the exact reason stated by the bot (e.g., failing CI checks, insufficient approvals, merge conflicts, or stale branch) and confirm that the underlying issue has been resolved before re-applying autosubmit.
  2. Verify Freshness of Base Commit (>7 Days Old):

    • Check whether the PR's base commit is stale (>7 days old).
    • If the base commit is more than 7 days old, always instruct running or execute a branch update before attempting to add autosubmit:
      gh pr update-branch <number> --repo flutter/flutter
      
    • Do not apply autosubmit until the branch update is complete and CI checks on the updated branch succeed.
  3. Strictly Verify Required Reviewer Approvals:

    • Strictly verify that third-party contributor PRs (CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, NONE) have at least 2 team member approvals (MEMBER or OWNER) before adding autosubmit so the bot doesn't remove it again.
    • Check reviews in gh pr view <number> --repo flutter/flutter --json reviews to confirm the number of approvals from Flutter team members.
  4. Verify All Status Checks Are 100% Passing:

    • The Flutter autosubmit bot automatically strips the autosubmit label whenever any CI check fails.
    • Verify that all status checks are passing (SUCCESS/pass).
    • If any check is flaky, failing, or pending a retry:
      1. Do NOT apply the autosubmit label immediately.
      2. Inform the user of the failing check and instruct them to retry it first.
      3. Only apply the autosubmit label after all retried checks complete successfully:
        gh pr edit <number> --repo flutter/flutter --add-label autosubmit
        

3. Third-Party Contributor PRs (2-Reviewer Requirement)

  • Pull requests authored by third-party contributors (CONTRIBUTOR, FIRST_TIME_CONTRIBUTOR, NONE) require two explicit approvals from Flutter team members (MEMBER or OWNER) before the autosubmit bot will merge them.
  • If only one team member has approved a third-party PR and the autosubmit label is applied, the autosubmit bot will remove the label.
  • Action: Strictly verify via gh pr view <number> --repo flutter/flutter --json reviews that at least 2 team member approvals are present before adding autosubmit so the bot doesn't remove it again. If only 1 approval exists, remind the user to request a second reviewer before applying the label.

4. Failed Checks & Manual LUCI Re-runs

  • Due to GitHub App permission policies, third-party check runs (such as LUCI checks created by flutter-dashboard) cannot be re-run via the GitHub API.
  • Action:
    1. Print the exact LUCI Buildbucket link (e.g., https://cr-buildbucket.appspot.com/build/<build_id>) for the failing check.
    2. Instruct the user to open the URL and click Retry Build on the LUCI page.
    3. If a check continues to fail after manual retries, inspect the failure logs (gh pr view <number> --repo flutter/flutter or flutter-pr-checks-finder) and summarize the failure for the user.

5. Stale Branch Updates, CICD Label & Token Scope

  • If a PR branch is out of date with master (including when the base commit is >7 days old):
    • Always update the branch using gh pr update-branch <number> --repo flutter/flutter before attempting to add autosubmit.
  • Re-applying the CICD Label:
    • After updating a branch with gh pr update-branch (or when shepherding a PR that has not run CI), the CICD label is often stripped or required to start the CI checks on the updated commit.
    • Always check if the CICD label is present after a branch update, and re-apply it if missing:
      gh pr edit <number> --repo flutter/flutter --add-label CICD
      
  • Stale Token Scope Error: If updating fails due to workflow file permissions (ERROR: ... lacks the "workflow" scope), instruct the user to refresh their CLI scope:
    gh auth refresh -h github.com -s workflow
    

6. Target Branch Correction & Merge Conflicts

  • Dismissed Reviews Warning: Changing the target branch of a PR often causes GitHub to automatically dismiss existing approvals. Alert the user if the target branch changed so they can re-approve on GitHub.
  • Merge Conflicts: If a PR has conflicts (MERGEABLE is CONFLICTING), notify the user so the author can resolve them.

来自 flutter 的更多技能

dart-modern-features
flutter
为了找到现代化的候选方案:
flutter-fix-layout-issues
flutter
使用Dart和Flutter MCP工具修复Flutter布局错误(溢出、无界约束)。适用于处理“RenderFlex溢出”、“垂直…
adding-release-notes
flutter
在 DevTools 发布说明中添加面向用户的变更描述。用于在 NEXT_RELEASE_NOTES.md 文件中记录改进、修复或新功能。
reviewing-devtools-prs
flutter
DevTools 仓库专属的PR审查工作流程,执行DevTools风格指南和常见审查模式。在审查……中的拉取请求时使用。
dart-use-primary-constructors
flutter
帮助用户在Dart中编写语法和语义正确的主构造函数,并迁移/使用新的构造函数语法、空体分号语法等。
code-documentation
flutter
编写有效代码文档的指南,包括docstrings、JSDoc、dartdoc和实现注释。在编写新代码、添加…时使用此技能。
api-review
flutter
对照规范的API设计指南审查指定代码。当用户要求进行API审查或根据API设计规范检查代码时,请使用此技能…
flutter-accessibility
flutter
在Flutter应用中实现WCAG 2和EN 301 549无障碍标准及自适应布局。在移动端、网页端和桌面端强制实施语义标注、点击目标尺寸(最小48x48 dp)和文本对比度(小文本4.5:1,大文本3:1)。提供网页语义初始化、交互式组件包裹、基于屏幕尺寸的布局切换以及键盘/鼠标输入处理的决策逻辑。包含通过FocusTraversalGroup实现的焦点遍历管理,以及...