Chuyển đến nội dung
Skillpedia
Lập trình chung6.2k · #14394

breakup-pr

Skill này làm gì

Skill này chia một thay đổi code lớn thành các lát tính năng theo chiều dọc, mỗi lát được đưa lên như một pull request xếp chồng. Skill dành cho lập trình viên có thay đổi quá lớn để review và muốn đưa lên từng bước an toàn.

Khi nào nên dùng

  • ✓Khi một pull request quá lớn để người review đọc thoải mái.
  • ✓Khi bạn muốn tách một tính năng thành nhiều pull request nhỏ, phụ thuộc lẫn nhau.
  • ✓Khi bạn muốn mọi phần của một tính năng được đưa lên cùng nhau sau một feature flag.

Liên kết skill

https://github.com/lightdash/lightdash/blob/main/.claude/skills/breakup-pr/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/lightdash/lightdash/blob/main/.claude/skills/breakup-pr/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 của tôi thay đổi cơ sở dữ liệu, API và giao diện. Hãy tách nó thành các lát xếp chồng để tôi có thể review từng phần.”

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

Cách hoạt động

Skill lên kế hoạch cho một loạt lát theo chiều dọc, mỗi lát là một thay đổi nhỏ có thể gộp và kiểm tra riêng. Skill tạo các pull request xếp chồng bằng công cụ stacking, và tất cả các lát đều nằm sau một feature flag chung.

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.

Break Up PR into Vertical Feature Slices

You are splitting a large PR into vertical feature slices — each slice is an independently mergeable, CI-green stacked PR delivered via gh stack (see the /gh-stack skill for commands).

All slices are gated behind a single shared feature flag so the feature ships atomically when the flag is enabled.

Why Vertical Slices?

Large PRs are hard to review, hard to reason about, and risky to merge. Vertical slicing solves this by breaking work into small, focused changes that are easier to understand and safer to ship.

Easier code review:

  • Reviewers can focus on one concern at a time (e.g., "just the migration" or "just the API")
  • Each PR tells a clear story — what changed and why is obvious from the diff
  • Smaller diffs mean faster reviews and higher-quality feedback
  • Comments and discussions stay focused instead of sprawling across unrelated changes

Iterative improvement:

  • Each slice can be reviewed, refined, and merged independently
  • Feedback on early slices (e.g., schema design) can inform later slices before they're written
  • If a later slice needs rework, earlier slices are already safely merged
  • The stack shows a natural progression — reviewers understand the "journey" of the feature

Safer delivery:

  • Smaller changes = smaller blast radius if something goes wrong
  • Issues are easier to bisect — you know exactly which slice introduced a problem
  • Rollback is surgical: revert one slice, not the whole feature
  • CI catches issues earlier in the stack, before dependent code is written

Better collaboration:

  • Multiple people can review different slices in parallel
  • Stack structure makes dependencies explicit — no guessing what to review first
  • Merge conflicts are localized to individual slices
  • Progress is visible: "3 of 5 PRs merged" is clearer than "PR still in review"

The feature flag unifies it all: Even though slices merge incrementally, the feature flag keeps everything hidden until you're ready to ship. Merge with confidence, ship when ready.

Process

Step 1: Analyze the PR

If given a PR URL, fetch and analyze the diff:

gh pr diff <PR_NUMBER>

If on a branch, analyze the diff against main:

git diff main...HEAD

Understand:

  • What files are changed and why
  • The dependency graph between changes (schema → backend → frontend)
  • What constitutes a "vertical" — an independently testable slice of functionality

Step 2: Identify the Feature Flag

Determine the feature flag name for this feature:

  • Check if the PR already uses a feature flag — if so, reuse it
  • If not, create one following the naming convention: kebab-case (e.g., my-new-feature)

The feature flag goes in packages/common/src/types/featureFlags.ts:

export enum FeatureFlags {
    // ... existing flags
    MyNewFeature = 'my-new-feature',
}

CRITICAL: The same feature flag is used for ALL vertical slices. This ensures the entire feature is gated atomically.

Step 3: Plan the Vertical Slices

Break the PR into vertical slices ordered by dependency (bottom of stack = first to merge):

What is a vertical slice? A vertical slice is a thin, end-to-end piece of user-facing functionality that cuts through all architectural layers (migration + types + backend + API + frontend). Each slice delivers something a user could test or demo, even if it's narrow.

How to identify slices: Think about the feature from the user's perspective. Ask: "What are the distinct things a user can do with this feature?" Each answer is a candidate slice.

For example, a "content verification" feature might slice as:

  1. Admin can verify/unverify a chart (migration + model + service + API + UI — but only for charts)
  2. Admin can verify/unverify a dashboard (extend to dashboards)
  3. Verified badge appears in search and content browser
  4. Editing content auto-removes verification
  5. Admin settings panel to view all verified content

Each slice touches every layer it needs — that's what makes it vertical.

Anti-pattern: horizontal/layer slicing Do NOT slice by architectural layer (e.g., "PR 1: migration", "PR 2: backend types", "PR 3: API", "PR 4: frontend"). This produces PRs that aren't independently testable and forces reviewers to hold the whole feature in their head across multiple PRs.

Slicing guidelines:

  • Start with the narrowest end-to-end path — the simplest user action that exe
Câu hỏi thường gặp

Lát theo chiều dọc là gì?

Đó là một phần nhỏ nhưng đầy đủ của tính năng, có thể được review và gộp riêng.

Tính năng có được đưa lên từng phần không?

Không. Tất cả các lát nằm sau cùng một feature flag, nên tính năng được bật cùng lúc.

Công cụ nào tạo ra chuỗi pull request xếp chồng?

Skill dùng các lệnh gh stack từ skill gh-stack.

Chi tiết

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

Break up a large PR into vertical feature slices delivered incrementally as stacked PRs via `gh stack`. All verticals share a single feature flag so the entire feature ships atomically. Use when: splitting a large PR, breaking up a diff, vertical slicing, incremental delivery, phased rollout, or when a PR is too large to review.

repo: lightdash/lightdash

Độ phổ biến

Sao GitHub
6.2k
Vị trí xếp hạng
#14394
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ự