Chuyển đến nội dung
Skillpedia
Lập trình chung29k · #9363

pr-splitter

Skill này làm gì

Skill này lên kế hoạch chia một thay đổi mã lớn thành nhiều pull request nhỏ hơn. Nó giữ bản sao lưu của nhánh gốc và theo dõi từng phần để không mất gì.

Khi nào nên dùng

  • ✓Khi một pull request quá lớn hoặc quá lẫn lộn để review tốt.
  • ✓Khi bạn muốn lên kế hoạch các pull request xếp chồng hoặc song song từ một nhánh.
  • ✓Khi phản hồi review làm thay đổi một phần của chuỗi và các phần sau cần cập nhật.

Liên kết skill

https://github.com/mastra-ai/mastra/blob/main/.claude/skills/pr-splitter/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/mastra-ai/mastra/blob/main/.claude/skills/pr-splitter/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Pull request này trộn lẫn việc tái cấu trúc và hành vi mới. Hãy giúp tôi chia nó thành các pull request nhỏ hơn.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent lưu bản sao lưu nhánh gốc, liệt kê các file đã thay đổi, rồi nhóm chúng thành các đơn vị review. Sau đó nó lập kế hoạch chuỗi, tách từng phần và kiểm tra từng phần trước khi chuyển sang phần tiếp theo.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

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 `@ma
Câu hỏi thường gặp

Nhánh gốc có bị xóa không?

Không. Skill tạo bản sao lưu và giữ nhánh gốc cho đến khi việc chia xong.

Có hỗ trợ cả pull request xếp chồng và song song không?

Có. Nó chọn xếp chồng khi công việc sau phụ thuộc vào công việc trước, và song song khi các thay đổi độc lập.

Ghi chú lập kế hoạch có được chia sẻ không?

Không. Ghi chú được giữ trong một file cục bộ, không commit trừ khi bạn yêu cầu.

Chi tiết

Mô tả gốc của tác giả

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.

repo: mastra-ai/mastra

Độ phổ biến

Sao GitHub
29k
Vị trí xếp hạng
#9363
Giấy phép
—
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự