breakup-pr
它能做什么
这项技能把一个大型代码改动拆分为纵向的功能切片,每个切片都作为一个堆叠的拉取请求提交。适合改动太大、难以审阅,并希望分步骤安全上线的开发者。
适用场景
- ✓当一个拉取请求太大,审阅者难以舒适地阅读时。
- ✓当你想把一个功能拆分为相互依赖的较小拉取请求时。
- ✓当你希望一个功能的所有部分通过同一个功能开关一起上线的时候。
技能链接
https://github.com/lightdash/lightdash/blob/main/.claude/skills/breakup-pr/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我的拉取请求同时修改了数据库、API 和前端。请把它拆分为可以逐个审阅的堆叠切片。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能会规划一组纵向切片,每个切片都是可以单独合并和检查的小改动。它使用堆叠工具创建这些堆叠拉取请求,所有切片都放在同一个共享功能开关之后。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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:
- Admin can verify/unverify a chart (migration + model + service + API + UI — but only for charts)
- Admin can verify/unverify a dashboard (extend to dashboards)
- Verified badge appears in search and content browser
- Editing content auto-removes verification
- 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
常见问题
什么是纵向切片?
它是功能中一个小而完整的部分,可以单独审阅和合并。
功能是分批上线的吗?
不是。所有切片都位于同一个共享功能开关之后,因此功能会同时开启。
用哪个工具创建堆叠?
这项技能使用 gh-stack 技能中的 gh stack 命令。
详情
作者的原始描述
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
热度
- GitHub 星标
- 6.2k
- 排名
- #14394
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
lightdash-agent-slack-messaging
6.2k帮你的智能体根据现有证据,为 Lightdash 管理员撰写简短、友好的维护与活动报告。
developing-in-lightdash
6.2k帮你的智能体以 JSON 形式读取、创建和编辑 Lightdash 仪表板与图表,包括每种图表类型的设置。
filter-expressions
6.2k帮你的智能体为 Lightdash 指标查询编写正确的筛选表达式,包括针对自定义指标的筛选。
mcp-artifact-integration
6.2k帮你的智能体在 HTML 或 React 产物中展示 Lightdash 查询结果,并处理加载、错误和空数据状态。