name: "cherry-pick-port"
description: "Use to safely cherry-pick or backport selected commits across branches with duplicate detection and conflict routing."
maturity-level: "L4"
risk-scope: "R0-R4"
version: "1.0.0"
Cherry Pick Port
Core Question
Should this commit be cherry-picked or backported to the target branch, and how can it be done safely?
When To Use
Use this skill when:
- the user asks to cherry-pick a commit
- the user asks to backport a fix to another branch
- a release branch needs selected commits from another branch
- the user asks whether a patch is already applied
When Not To Use
Do not use this skill when:
- syncing a whole branch
- applying raw patch files
- resolving conflicts after cherry-pick
- pushing the result by default
Route to:
- branch update routes to
sync-branch - conflicts route to
resolve-conflicts - abort/recovery routes to
undo-recover - push routes to
branch-workflow
Required Evidence
Before action, inspect or establish:
- source commit SHA and diff
- target branch and current state
- clean target worktree
- duplicate detection such as patch-id or equivalent diff evidence
- project backport policy including
-x if available - tests relevant to the change
No-evidence rule:
- Do not make strong claims without observed evidence.
- State assumptions when proceeding under incomplete evidence.
- Stop when missing evidence affects safety, correctness, user work, remote state, or irreversible action.
Operating Contract
You MAY:
- inspect relevant repository state and project files.
- generate a plan, report, or local artifact within the declared risk scope.
- route to another skill when the requested action is outside this skill's owner boundary.
You MUST:
- inspect before acting.
- keep the task within the declared owner boundary.
- classify state and risk before any meaningful action.
- preserve unrelated user work.
- verify outcomes proportional to risk.
- report evidence, assumptions, actions, verification, and residual risk.
You MUST NOT:
- invent project policy.
- expose secrets or sensitive values.
- mutate unrelated files or refs.
- perform destructive, remote, shared, history-rewriting, or irreversible actions without explicit action-specific confirmation.
- continue after unexpected destructive output.
State / Risk Table
| State | Evidence | Risk | Default Action | Confirmation | Verification |
|---|
| Plan cherry-pick | commit and target identified | R1 | Show plan and duplicate check | no | plan summary |
| Clean target and explicit request | target branch clean | R2/R3 | Cherry-pick selected commit narrowly | yes if ambiguous | status and resulting commit |
| Patch already applied | duplicate evidence | R1 | Do not cherry-pick; report duplicate | no | duplicate evidence |
| Conflict after cherry-pick | unmerged paths | R3 | Stop and route to resolve-conflicts | yes for continue later | status shows conflicts |
| Push backport branch | remote mutation requested | R4 | Route push gate to branch-workflow | yes | remote ref verification |
Workflow
- Identify the user goal and current owner boundary.
- Inspect required evidence.
- Classify repository/task state.
- Classify risk using the declared scope.
- Choose the minimal sufficient action or route.
- Execute only allowed actions, if any.
- Verify outcome or self-check the artifact.
- Report result, evidence, verification, assumptions, and residual risk.
Decision Rules
- Do not cherry-pick onto dirty target worktree.
- Check whether equivalent change is already present before applying.
- Follow project policy for
-x; if unknown, ask when it matters. - Do not push after cherry-pick unless explicitly requested and gated.
- May inspect commits, branches, patch-id, and diffs.
- May run local cherry-pick only with explicit target and clean state.
- Must not resolve conflicts or push from this skill.
Verification
Minimum verification:
- Verify resulting status and commit metadata.
- Verify duplicate check result is reported.
- If conflict occurs, verify operation state and route.
Risk-based floor:
- R0-R1: evidence inspected and output self-checked.
- R2: inspect resulting diff or local state.
- R3: verify local state and report recovery limits.
- R4-R5: require explicit confirmation, preflight evidence, and post-action verification where this skill owns the action.
Output Contract
Final response must include:
## Result
- Decision, action, or artifact produced.
## Evidence
- Files, commands, diffs, refs, or assumptions used.
## Verification
- Checks performed and their result.
## Risks / Limitations
- Remaining uncertainty, blocked actions, or routed next steps.
Stop / Confirmation Rules
Stop when the repository state is dirty, conflicted, diverged, missing required evidence, or ambiguous in a way that could overwrite user work, invalidate the requested scope, or require a gated action.
Require explicit action-specific confirmation for:
- destructive local mutation.
- remote/shared mutation.
- history rewriting.
- security/secret/data impact.
- irreversible or hard-to-recover operation.
Broad approval such as "do whatever" is not enough for R4-R5 actions.
Lazy-load References
Load references/backport-policy.md when:
- the task needs the detailed guidance described by the file name.
- the state/risk table identifies an ambiguous or high-risk path.
Load references/duplicate-detection.md when:
- the task needs the detailed guidance described by the file name.
- the state/risk table identifies an ambiguous or high-risk path.
Load references/cherry-pick-conflicts.md when:
- the task needs the detailed guidance described by the file name.
- the state/risk table identifies an ambiguous or high-risk path.