Plan and manage fast, safe software delivery through small task slices, short-lived branches, PR sequencing, stacked PRs, feature flags, CI tiering, merge queues, and agent coordination. Use when Codex needs to split a feature into implementation tasks or PRs, design a Git/GitHub PR workflow, unblock dependent PRs, reduce CI wait time, handle merge conflicts, coordinate multiple coding agents, or answer Chinese/English questions about 任务拆解, PR 管理, stacked PR, merge queue, CI pipeline, or branch strategy.
Use this skill to turn a vague feature or delivery problem into a concrete PR flow. Optimize for small diffs, short-lived branches, stable main, fast feedback, and no hidden breakage.
Do not recommend bypassing review, tests, or CI as the speed solution. Make the work smaller and the validation smarter.
When to Use
Use this skill when the user needs to:
Turn a feature, bugfix batch, or vague delivery request into small PRs.
Decide whether work should be independent PRs, stacked PRs, or a mixed flow.
Sequence contract, implementation, integration, rollout, and cleanup work.
Reduce PR review size, CI wait time, merge conflicts, or stalled dependent PRs.
Coordinate multiple coding agents without overlapping hot files or shared contracts.
Explain or compare branch strategy, merge queue usage, CI tiering, or PR gating.
Do not use it as a shortcut around repository inspection, code review, tests, or CI. If the user asks for implementation, inspect the repo and implement the smallest safe first slice instead of planning a large speculative batch.
Core Rules
Keep main releasable.
Use one short-lived branch per task slice.
Keep each PR reviewable; target 300-500 effective changed lines unless the repo has a different norm.
Put incomplete user-facing behavior behind feature flags or disabled config.
Split contracts before implementations when work has dependencies.
Prefer merge queues for busy repos.
Keep stacked PRs shallow; 2-3 layers is the practical ceiling.
Isolate formatting, renames, migrations, and broad refactors into their own PRs.
Do not let multiple agents modify the same hot file, schema, or shared abstraction at the same time.
Workflow
1. Establish Boundaries
Determine:
Goal and non-goals.
Modules touched.
User-visible behavior.
Data/schema/API contracts.
Existing tests and CI tiers.
Risk: low, medium, or high.
If the request is only planning, do not edit files. If the request includes implementation, implement only the smallest valid first slice unless the user explicitly asks for more.
2. Build the Dependency Map
Classify each dependency:
Contract dependency: types, API shape, route, event, schema, interface.
Do not serialize independent work just because one large PR was written first.
3. Slice PRs
Create PR slices that can merge safely:
PR 1: contract/types/route skeleton/test fixture
PR 2: backend implementation behind flag
PR 3: frontend/client integration using contract or mock
PR 4: integration tests and wiring
PR 5: enable flag for limited scope
PR 6: remove old path after rollout
For each PR define:
Title.
Scope.
Base branch.
Files/modules expected to change.
Validation command.
Review owner if known.
Merge dependency.
Feature flag or rollback path if user-visible.
4. Choose Branch Topology
Use independent PRs when slices can merge independently:
main
├─ pr-a-contract
├─ pr-b-backend
└─ pr-c-ui
Use stacked PRs only when the diff must depend on unmerged code:
main
└─ pr-1-contract
└─ pr-2-backend
└─ pr-3-ui
After a lower PR merges, rebase the next PR onto updated main, retarget its base to main, then push with --force-with-lease.
Do not use a long-lived integration branch unless the team explicitly accepts delayed integration and extra conflict cost.
Aim for PR blocking CI in 5-10 minutes. If it takes 40 minutes, recommend affected-test selection, caching, parallelism, or moving slow jobs to merge queue/nightly.
6. Plan Agent Work
Assign agents by module boundary, not by vague feature name:
Agent 1: contract/types only
Agent 2: backend service only
Agent 3: frontend UI only
Agent 4: integration tests only
Agent 5: cleanup only
Each agent task must include:
Allowed paths.
Forbidden paths.
Expected tests.
PR title.
Maximum scope.
Whether behavior must stay behind a flag.
Reject tasks like "implement the whole feature" unless the feature is trivially small.
Conflict Control
Use these rules before coding:
Rebase from main before starting and before final push.
Avoid shared config churn.
Do not mix formatting with behavior changes.
Do not mix rename/move with logic changes.
Do not let generated files dominate review unless they are required.
Prefer stable public contracts over temporary cross-branch imports.
Use git push --force-with-lease, never plain --force, after rebasing a reviewed branch.
Security and Risk
For credentials, permissions, production data, deployment, or destructive Git operations:
Warn explicitly.
Prefer read-only or dry-run first.
Use least privilege.
Include rollback steps.
Do not hide risky changes inside a routine PR.
For experimental APIs or unstable tooling:
Label them experimental.
State instability risks: breaking changes, rate limits, missing guarantees.
Provide a fallback path.
Output Format
For planning tasks, output:
## Delivery Plan
### PR Slices
| PR | Base | Scope | Depends On | Validation | Risk |
|----|------|-------|------------|------------|------|
| 1 | main | ... | none | ... | low |
### Branch Strategy
Independent PRs / stacked PRs / mixed. Explain why in one sentence.
### CI Plan
- PR blocking:
- Merge queue:
- Nightly:
### Agent Allocation
- Agent/task:
- Allowed paths:
- Forbidden paths:
- Validation:
### Conflict Plan
- Rebase points:
- Files likely to conflict:
- Isolation rules:
For implementation tasks, also include changed files and validation results in the final response.
Common Pitfalls
Oversized PR slices. If a PR needs unrelated reviewers, touches unrelated modules, or cannot be summarized in one sentence, split it.
Deep stacks. More than 2-3 stacked PRs usually hides review state and increases rebase cost. Flatten independent work onto main instead.
Contract drift. Backend, frontend, tests, and generated clients must share the same contract source. Do not let each PR invent its own temporary shape.
Wrong merge gate. Do not treat a same-head push job, stale check, or unrelated lane as the authoritative PR gate. Identify the repository's real blocking checks.
Mixed refactor and behavior. Formatting, renames, migrations, and broad cleanup belong in separate PRs unless they are mechanically required for the slice.
Feature flag theater. A flag only helps if the incomplete path is truly unreachable by default and has a rollback or disable path.
Agent collision. Parallel agents must not edit the same hot file, schema, config, migration chain, or shared abstraction without an explicit owner.
Unverified dependency unblock. After a lower PR merges, rebase/retarget the dependent PR and rerun the relevant validation before calling it unblocked.
Verification Checklist
Before finalizing, verify:
Maintainability: each PR has one reason to exist and a reviewable diff size.
Dependency order: contracts, implementations, tests, rollout, and cleanup are sequenced correctly.
Branch topology: independent work is not unnecessarily stacked; required stacks are shallow and have rebase/retarget points.
CI plan: PR-blocking checks are fast and relevant; slow confidence checks are assigned to merge queue, nightly, or release lanes.
Conflict plan: hot files, schemas, generated files, migrations, and shared configs have clear ownership.
Security: risky operations are isolated, warned, dry-run where possible, and include rollback.
Style/consistency: branch names, PR titles, review owners, and validation commands match repo norms.
Backward compatibility: main remains releasable and unfinished user-visible behavior is hidden behind a real flag or disabled config.
1---2name: task-pr-flow3description: Plan and manage fast, safe software delivery through small task slices, short-lived branches, PR sequencing, stacked PRs, feature flags, CI tiering, merge queues, and agent coordination. Use when Codex needs to split a feature into implementation tasks or PRs, design a Git/GitHub PR workflow, unblock dependent PRs, reduce CI wait time, handle merge conflicts, coordinate multiple coding agents, or answer Chinese/English questions about 任务拆解, PR 管理, stacked PR, merge queue, CI pipeline, or branch strategy.4---56# Task PR Flow78## Overview910Use this skill to turn a vague feature or delivery problem into a concrete PR flow. Optimize for small diffs, short-lived branches, stable `main`, fast feedback, and no hidden breakage.1112Do not recommend bypassing review, tests, or CI as the speed solution. Make the work smaller and the validation smarter.1314## When to Use1516Use this skill when the user needs to:1718- Turn a feature, bugfix batch, or vague delivery request into small PRs.19- Decide whether work should be independent PRs, stacked PRs, or a mixed flow.20- Sequence contract, implementation, integration, rollout, and cleanup work.21- Reduce PR review size, CI wait time, merge conflicts, or stalled dependent PRs.22- Coordinate multiple coding agents without overlapping hot files or shared contracts.23- Explain or compare branch strategy, merge queue usage, CI tiering, or PR gating.2425Do not use it as a shortcut around repository inspection, code review, tests, or CI. If the user asks for implementation, inspect the repo and implement the smallest safe first slice instead of planning a large speculative batch.2627## Core Rules2829- Keep `main` releasable.30- Use one short-lived branch per task slice.31- Keep each PR reviewable; target 300-500 effective changed lines unless the repo has a different norm.32- Put incomplete user-facing behavior behind feature flags or disabled config.33- Split contracts before implementations when work has dependencies.34- Prefer merge queues for busy repos.35- Keep stacked PRs shallow; 2-3 layers is the practical ceiling.36- Isolate formatting, renames, migrations, and broad refactors into their own PRs.37- Do not let multiple agents modify the same hot file, schema, or shared abstraction at the same time.3839## Workflow4041### 1. Establish Boundaries4243Determine:4445- Goal and non-goals.46- Modules touched.47- User-visible behavior.48- Data/schema/API contracts.49- Existing tests and CI tiers.50- Risk: low, medium, or high.5152If the request is only planning, do not edit files. If the request includes implementation, implement only the smallest valid first slice unless the user explicitly asks for more.5354### 2. Build the Dependency Map5556Classify each dependency:5758- Contract dependency: types, API shape, route, event, schema, interface.59- Implementation dependency: backend logic, UI wiring, migration, worker, integration.60- Validation dependency: test fixture, mock, e2e path, CI job.61- Rollout dependency: feature flag, config, migration rollout, cleanup.6263Prefer this order:6465```text66contract -> parallel implementation -> integration -> rollout -> cleanup67```6869Do not serialize independent work just because one large PR was written first.7071### 3. Slice PRs7273Create PR slices that can merge safely:7475```text76PR 1: contract/types/route skeleton/test fixture77PR 2: backend implementation behind flag78PR 3: frontend/client integration using contract or mock79PR 4: integration tests and wiring80PR 5: enable flag for limited scope81PR 6: remove old path after rollout82```8384For each PR define:8586- Title.87- Scope.88- Base branch.89- Files/modules expected to change.90- Validation command.91- Review owner if known.92- Merge dependency.93- Feature flag or rollback path if user-visible.9495### 4. Choose Branch Topology9697Use independent PRs when slices can merge independently:9899```text100main101 ├─ pr-a-contract102 ├─ pr-b-backend103 └─ pr-c-ui104```105106Use stacked PRs only when the diff must depend on unmerged code:107108```text109main110 └─ pr-1-contract111 └─ pr-2-backend112 └─ pr-3-ui113```114115After a lower PR merges, rebase the next PR onto updated `main`, retarget its base to `main`, then push with `--force-with-lease`.116117Do not use a long-lived integration branch unless the team explicitly accepts delayed integration and extra conflict cost.118119### 5. Define CI Tiers120121Separate fast feedback from full confidence:122123```text124PR blocking CI:125 lint, typecheck, unit tests, affected package tests, touched package build126127Merge queue CI:128 integration tests, critical e2e, migration checks, compatibility checks129130Nightly CI:131 full e2e matrix, slow cross-platform jobs, stress/perf, flaky detection132133Release CI:134 full validation and deployment checks135```136137Aim for PR blocking CI in 5-10 minutes. If it takes 40 minutes, recommend affected-test selection, caching, parallelism, or moving slow jobs to merge queue/nightly.138139### 6. Plan Agent Work140141Assign agents by module boundary, not by vague feature name:142143```text144Agent 1: contract/types only145Agent 2: backend service only146Agent 3: frontend UI only147Agent 4: integration tests only148Agent 5: cleanup only149```150151Each agent task must include:152153- Allowed paths.154- Forbidden paths.155- Expected tests.156- PR title.157- Maximum scope.158- Whether behavior must stay behind a flag.159160Reject tasks like "implement the whole feature" unless the feature is trivially small.161162## Conflict Control163164Use these rules before coding:165166- Rebase from `main` before starting and before final push.167- Avoid shared config churn.168- Do not mix formatting with behavior changes.169- Do not mix rename/move with logic changes.170- Do not let generated files dominate review unless they are required.171- Prefer stable public contracts over temporary cross-branch imports.172- Use `git push --force-with-lease`, never plain `--force`, after rebasing a reviewed branch.173174## Security and Risk175176For credentials, permissions, production data, deployment, or destructive Git operations:177178- Warn explicitly.179- Prefer read-only or dry-run first.180- Use least privilege.181- Include rollback steps.182- Do not hide risky changes inside a routine PR.183184For experimental APIs or unstable tooling:185186- Label them experimental.187- State instability risks: breaking changes, rate limits, missing guarantees.188- Provide a fallback path.189190## Output Format191192For planning tasks, output:193194```md195## Delivery Plan196197### PR Slices198199| PR | Base | Scope | Depends On | Validation | Risk |200|----|------|-------|------------|------------|------|201| 1 | main | ... | none | ... | low |202203### Branch Strategy204205Independent PRs / stacked PRs / mixed. Explain why in one sentence.206207### CI Plan208209- PR blocking:210- Merge queue:211- Nightly:212213### Agent Allocation214215- Agent/task:216- Allowed paths:217- Forbidden paths:218- Validation:219220### Conflict Plan221222- Rebase points:223- Files likely to conflict:224- Isolation rules:225```226227For implementation tasks, also include changed files and validation results in the final response.228229## Common Pitfalls2302311. **Oversized PR slices.** If a PR needs unrelated reviewers, touches unrelated modules, or cannot be summarized in one sentence, split it.2322. **Deep stacks.** More than 2-3 stacked PRs usually hides review state and increases rebase cost. Flatten independent work onto `main` instead.2333. **Contract drift.** Backend, frontend, tests, and generated clients must share the same contract source. Do not let each PR invent its own temporary shape.2344. **Wrong merge gate.** Do not treat a same-head push job, stale check, or unrelated lane as the authoritative PR gate. Identify the repository's real blocking checks.2355. **Mixed refactor and behavior.** Formatting, renames, migrations, and broad cleanup belong in separate PRs unless they are mechanically required for the slice.2366. **Feature flag theater.** A flag only helps if the incomplete path is truly unreachable by default and has a rollback or disable path.2377. **Agent collision.** Parallel agents must not edit the same hot file, schema, config, migration chain, or shared abstraction without an explicit owner.2388. **Unverified dependency unblock.** After a lower PR merges, rebase/retarget the dependent PR and rerun the relevant validation before calling it unblocked.239240## Verification Checklist241242Before finalizing, verify:243244- [ ] Maintainability: each PR has one reason to exist and a reviewable diff size.245- [ ] Dependency order: contracts, implementations, tests, rollout, and cleanup are sequenced correctly.246- [ ] Branch topology: independent work is not unnecessarily stacked; required stacks are shallow and have rebase/retarget points.247- [ ] CI plan: PR-blocking checks are fast and relevant; slow confidence checks are assigned to merge queue, nightly, or release lanes.248- [ ] Conflict plan: hot files, schemas, generated files, migrations, and shared configs have clear ownership.249- [ ] Security: risky operations are isolated, warned, dry-run where possible, and include rollback.250- [ ] Style/consistency: branch names, PR titles, review owners, and validation commands match repo norms.251- [ ] Backward compatibility: `main` remains releasable and unfinished user-visible behavior is hidden behind a real flag or disabled config.
Run npx skillmds@latest add peterfile/task-pr-flow in your terminal (requires Node.js), paste this page's agent-chat prompt into Claude, Cursor, or any MCP-connected agent, or download the SKILL.md file and copy it into your agent's skills directory.
Plan and manage fast, safe software delivery through small task slices, short-lived branches, PR sequencing, stacked PRs, feature flags, CI tiering, merge queues, and agent coordination. Use when Codex needs to split a feature into implementation tasks or PRs, design a Git/GitHub PR workflow, unblock dependent PRs, reduce CI wait time, handle merge conflicts, coordinate multiple coding agents, or answer Chinese/English questions about 任务拆解, PR 管理, stacked PR, merge queue, CI pipeline, or branch strategy. It is listed under DevOps & Infra on SkillMD.
This skill has not completed SkillMD's automated safety review yet. Capability flags: docs only. SkillMD never runs a skill's scripts for you; review the SKILL.md before installing.
This skill is tagged as working with Claude Code, Claude.ai, OpenAI Codex. SKILL.md is an open format, so most agents that read a skills directory can load it too.
Yes. Installing skills from SkillMD is free, and the skill stays under its author's original license.
PeterFile (@peterfile) published this skill. Their other Agent Skills are listed on their SkillMD profile.