跳到正文
cccskills
免费在 GitHub 公开

pr-splitter

Split a large pull request into smaller, reviewable changes. Plan branch dependencies, extract related code, verify each part, and track review changes while preserving the intent of the original work.

中文简介正在准备中。当前显示英语简介。

原文查看原文说明

Use when breaking a large, complex, messy, or hard-to-review pull request into multiple smaller PRs; planning stacked PRs; extracting independent changes from a branch; splitting mixed refactor and behavior changes; managing drift after review feedback; rebasing follow-up PRs as earlier PRs change; or preserving original branch intent while shipping incrementally.

查看安装方法

适用场景

  • Split a large pull request into reviewable parts
  • Separate refactoring from behavior changes
  • Plan dependent pull requests
  • Update follow-up branches after review feedback

包含的文件(1)

  • SKILL.md5.7 KB

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

PR Splitter

Preserve the original PR as source material, build smaller reviewable PRs intentionally, and track drift locally as review feedback changes the stack.

Required workflow

  1. Snapshot before touching history

    • Check git status.
    • Create an immutable local reference to the original branch: git branch backup/original-large-pr.
    • Do not delete or rewrite the original branch until the split is complete.
  2. Inventory the original PR

    • Inspect git diff --stat <base>...HEAD, git diff --name-only <base>...HEAD, and git log --oneline <base>..HEAD.
    • Classify changes by review unit: prep/refactor, API/type changes, behavior, tests, docs, cleanup, generated/lock files.
  3. Create a local scratchpad

    • Write split notes to an uncommitted local file, preferably .notes/pr-split.md.
    • Ensure .notes/ is ignored or leave it untracked. Do not commit scratchpad notes unless the user explicitly asks.
    • Track: original branch, base branch, planned PRs, files/hunks extracted, verification per PR, remaining original diff, and intentional drift from review feedback.
  4. Choose the split shape

    • Use stacked PRs when later work depends on earlier work.
    • Use parallel PRs only when changes are truly independent.
    • Use foundation + parallel follow-ups when one shared prep change unlocks independent work.
  5. Extract changes safely

    • Prefer fresh branches from the correct base plus selective restore over rewriting messy history.
    • Use path-level extraction for clean file ownership: git checkout backup/original-large-pr -- path/to/file.
    • Use hunk-level extraction for mixed files: git restore -p --source backup/original-large-pr -- path/to/file.
    • Keep each PR independently buildable and reviewable.
  6. Verify each PR independently

    • Run the narrowest relevant build, typecheck, lint, and tests for that PR's scope.
    • Do not leave tests, docs, or generated files separated from the code they validate unless the split plan explicitly calls for it.
  7. Manage drift deliberately

    • Treat reviewer-approved changes as the new source of truth for the stack.
    • After changing an earlier PR, rebase dependent PRs onto it and resolve conflicts in favor of the reviewed direction, not blindly in favor of the original branch.
    • Compare the evolving stack against backup/original-large-pr to find remaining intent, not to force byte-for-byte equality.
    • Record intentional differences in .notes/pr-split.md.
  8. Use range-diff for rewritten stacks

    • Use git range-diff after rebases, conflict resolution, or force-pushes to understand what changed.
    • Summarize meaningful range-diff results for reviewers when updating a stacked PR.

PR description pattern

Keep PR descriptions concise and reviewer-facing:

## Summary

This is PR N of M split from a larger change.

## Scope

- ...

## Intentionally excluded

- Follow-up PR will handle ...

## Verification

- ...

Do not put the full split ledger in PR descriptions. Keep detailed extraction notes and drift tracking in .notes/pr-split.md.

Scratchpad template

# PR split scratchpad

Original branch: backup/original-large-pr
Base branch: main

## Planned PRs

1. branch-name
   - Scope:
   - Files/hunks extracted:
   - Verification:
   - Changeset: (package names, bump type, scoped message)
   - Status:

## Remaining original intent

- ...

## Drift notes

- Date / branch / reason:

Changesets

Each split PR must carry its own changeset scoped to the changes in that PR. Do not keep the original changeset from the source branch — it covers the full combined change and does not belong in any single split PR.

After extracting changes into a split branch:

  1. Delete any changeset files carried over from the original branch. These were written for the combined diff and will produce incorrect changelog entries.
  2. Create a new changeset for each PR using the CLI (see .mastracode/commands/changeset.md):
    pnpm changeset -s -m "your scoped message" (--major | --minor | --patch) pkg-name
    
  3. Scope the message to that PR's changes only. The changeset message should describe what this specific PR does, not the full original feature.
  4. Include only the packages actually changed in this PR. If the original changeset listed five packages but this PR only touches @mastra/core, the new changeset should only reference @mastra/core.
  5. Match the version bump type to the PR's scope. A prep/refactor PR is typically patch; a PR introducing new API surface is minor; a PR with breaking changes is major.

Add changeset creation to the scratchpad template under each planned PR's verification checklist so it is not forgotten.

Common failure modes

Avoid splitting by file when behavior spans files, extracting tests without code, leaving follow-up PRs uncompilable, force-pushing without a reviewer summary, deleting the original branch early, reverting review feedback while resolving stack conflicts, and keeping the original branch's changeset in every split PR instead of creating scoped changesets per PR.

Default output

When asked to split a PR, produce:

  1. proposed PR sequence,
  2. branch strategy,
  3. scratchpad path and initial contents,
  4. extraction commands,
  5. verification plan for each PR,
  6. drift-management plan.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Design and audit an agent's system prompt, the instructions that guide its work. Define a concrete outcome, starting input, available tools, completion checks, fallback behavior, and final report so the prompt describes a complete run.

中文简介正在准备中。当前显示英语简介。

  • Designing the core instructions for a new agent
  • Auditing a prompt before saving it
  • Defining behavior when tools or permissions are missing
mastra-ai/mastra2.9万2026年10月22日 更新

Create a dedicated test project linked to the current worktree and check Agent Builder through APIs and browser interactions. It covers agent and skill management, permissions, defaults, and related features, with selectable test sections.

中文简介正在准备中。当前显示英语简介。

  • Validate an Agent Builder feature branch before review
  • Check role-based permissions and authentication
  • Test agent and skill management through APIs and the UI
mastra-ai/mastra2.9万2026年10月22日 更新

Reviews pull requests for bugs, error handling, code quality, and style consistency. Organizes feedback into an overview, must-fix issues with file locations, improvement suggestions, and positive notes so reviewers can distinguish urgent problems from refinements.

中文简介正在准备中。当前显示英语简介。

  • Finding bugs that must be fixed before merging
  • Reviewing TypeScript types and asynchronous code
  • Checking naming, imports, and leftover debug statements
mastra-ai/mastra2.9万2026年10月22日 更新

Design instructions for agents that write, fix, review, or refactor code. Define behavior based on file access, select suitable tools, and set clear verification and completion rules for repository changes or copyable code output.

中文简介正在准备中。当前显示英语简介。

  • Designing an agent for repository bug fixes
  • Defining a pull request review agent
  • Creating a code generator without workspace access
mastra-ai/mastra2.9万2026年10月22日 更新

Configure Factory board behavior and GitHub or Linear event handlers in deployment code. Adjust stage transitions, phase meanings, and tool-result handling, then check the changes with focused tests and versioned audit records.

中文简介正在准备中。当前显示英语简介。

  • Add approval requirements to board transitions
  • Change GitHub or Linear event handling
  • Define custom board phases and tool-result rules
mastra-ai/mastra2.9万2026年10月22日 更新

Design agents that draft blog posts, social posts, newsletters, and marketing copy. Define the audience, brand voice, length, and required output so each agent delivers a complete draft with a headline and supporting notes.

中文简介正在准备中。当前显示英语简介。

  • Build a blog writing agent with a consistent brand voice
  • Design an agent for LinkedIn product posts
  • Define delivery rules for newsletter drafts
mastra-ai/mastra2.9万2026年10月22日 更新

查看 mastra-ai 的全部技能

报告此技能的问题