[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71ST80AZ2RCSEF7HX9MQXQP":3,"skill-same:01M71ST80AZ2RCSEF7HX9MQXQP":75},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":45,"commitSha":46,"skillDirectory":47,"forksCount":48,"repositoryHtmlUrl":49,"repositoryHomepageUrl":50,"ownerHtmlUrl":51,"ownerBlogUrl":52,"ownerDescription":53,"updatedAt":54,"install":55,"resources":68},"01M71ST80AZ2RCSEF7HX9MQXQP","stack-pr",null,"Use when breaking a too-big branch into a stack of smaller chained PRs — commit-based default, --smart agent-reshape, gh-stack detection, cross-links. Invoked by \u002Forc:stack-pr and \u002Forc:ship's size gate.","HigorAlves\u002Forc","HigorAlves","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11262976?v=4","01M71S79EZEMHZ8PQSV0XQJHYY","Higor Alves","01M71S79FKKTCHCN1EDR8DSTWQ",7,"MIT","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fstack-pr\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39],"stack","pr","stack pr","branch","default","when","commit","ship","links","prs","gh","use","size","stack detection","gate","detection","2026-11-10 13:02:02",false,"---\nname: stack-pr\ndescription: \"Use when breaking a too-big branch into a stack of smaller chained PRs — commit-based default, --smart agent-reshape, gh-stack detection, cross-links. Invoked by \u002Forc:stack-pr and \u002Forc:ship's size gate.\"\n---\n\n# Stack PR\n\n## Overview\n\nA stack is N chained PRs where each branch's base is the previous branch (not `main`). Reviewers approve incrementally, merging bottom-up. orc supports two construction strategies and one tool integration:\n\n- **Strategy A — commit-based (default)** — every commit on the branch becomes one PR. Requires clean Conventional Commits.\n- **Strategy B — smart (`--smart`)** — an analyzer agent reads the diff, proposes logical slices, and emits a non-interactive rebase plan. Higher risk, requires backup branch.\n- **Tooling** — `github\u002Fgh-stack` `gh` extension if installed; otherwise a plain-`gh` fallback that does the same chaining manually.\n\n**Announce at start:** \"I'm using the stack-pr skill to construct a stacked PR group.\"\n\n## Preconditions (both strategies)\n\n1. **Tests pass** — invoke `orc:verification-before-completion` first.\n2. **Clean working tree** — `git status --porcelain` must be empty.\n3. **No merge commits** on `base..HEAD` — `git rev-list --merges base..HEAD` must be empty. Stacks fall apart through merges.\n4. **At least 2 commits** on `base..HEAD`. A single commit isn't a stack — use `\u002Forc:ship`.\n5. **Branch is pushed-clean** — local matches `origin` (no unpushed work the rebase could lose).\n\nIf any precondition fails, surface a **⚠️ Caution** callout naming the failed precondition and **stop**. Don't try to \"fix it for them\" — these are user decisions.\n\n## Strategy A — commit-based (default)\n\n### Validate Conventional Commits\n\nEach commit subject MUST match:\n\n```\n^(feat|fix|refactor|chore|test|docs|perf|build|ci|style)(\\([^)]+\\))?!?: .+\n```\n\nIf any commit fails the regex, surface the offenders and `AskUserQuestion`:\n\n1. **Reword via reword-only rebase** — non-interactive (`GIT_SEQUENCE_EDITOR` writes a todo of `reword` lines; user is prompted for each subject one by one outside the rebase).\n2. **Switch to `--smart`** — the analyzer agent doesn't care about commit subjects; it works from the diff.\n3. **Cancel.**\n\n### Build the stack\n\nFor each commit `Cᵢ` on `base..HEAD` in chronological order:\n\n```bash\nslug_i=$(echo \"$subject\" | sed 's\u002F^[a-z]*([^)]*): *\u002F\u002F' | tr ' ' '-' | tr -cd '[:alnum:]-' | tr A-Z a-z | cut -c1-40)\nbranch_i=\"${original_branch}\u002F$(printf '%02d' $i)-${slug_i}\"\n```\n\nBranch naming: zero-padded position keeps `git branch` output sortable. Suffix is the slugified subject — readable at a glance.\n\nReshape:\n\n```bash\n# Backup first (cheap, life-saving)\ngit branch \"${original_branch}-pre-stack-backup\"\n\n# Reset to base, then replay commits onto sequentially-stacked branches\ngit checkout \"$base\"\ngit checkout -b \"$branch_1\"\ngit cherry-pick \"$C1\"\n# C1 is now on branch_1 atop base\n\ngit checkout -b \"$branch_2\"   # branches off branch_1 (current HEAD)\ngit cherry-pick \"$C2\"\n# ... and so on\n```\n\nThe original branch is preserved as the backup. Caller may delete or keep it.\n\n### Push & open PRs\n\nIf `gh-stack` is installed (see \"Tooling detection\"):\n\n```bash\ngs push                                          # pushes every layer\ngs submit --base \"$original_base\"                # creates the chained PRs\n```\n\nOtherwise, plain-`gh` fallback (per-branch loop):\n\n```bash\nfor i in 1..N; do\n  prev_branch=$([ $i -eq 1 ] && echo \"$original_base\" || echo \"$branch_$((i-1))\")\n  git push -u origin \"$branch_$i\"\n  pr_url=$(gh pr create \\\n    --base \"$prev_branch\" \\\n    --head \"$branch_$i\" \\\n    --title \"[$i\u002F$N] $subject_i\" \\\n    --body \"$body_i_placeholder\")\n  echo \"$pr_url\" >> \u002Ftmp\u002Forc-stack-urls.$$\ndone\n```\n\n### Two-pass body decoration\n\nPR #1 cannot reference PR #2's URL at creation time (#2 doesn't exist yet). So all bodies are written with a placeholder, then rewritten in pass 2 once every URL is known.\n\nDefault (terse) block:\n\n```\n## Stack ({i}\u002F{N}, id: {stackId})\n1 api#311 · 2 api#312 (this) · 3 ui#447\norder: bottom-up\n```\n\n`--verbose` variant (only when the caller shipped with `--verbose` bodies):\n\n```markdown\n## Stacked PR ({i}\u002F{N})\n\nStack: `{stackId}`\nMerge bottom-up — each merge retargets the next PR's base. See [references\u002FSTACKED-PRS.md](references\u002FSTACKED-PRS.md).\n\n| # | Subject | PR | Status |\n|---|---------|----|--------|\n| 1 | feat(api): add row stream  | org\u002Fapi#311 | parent |\n| 2 | feat(api): wire export job | org\u002Fapi#312 | **this** |\n| 3 | feat(ui): download button  | org\u002Fui#447  | child |\n```\n\nUpdate each PR via `gh pr edit \u003Curl> --body \"\u003Crewritten>\"`.\n\n### Metadata writeback\n\nAppend entries to the active session's `linkedPRs[]` in `${ORC_STATE_DIR}\u002Forc.json`:\n\n```json\n{\n  \"repo\": \"api\",\n  \"url\": \"https:\u002F\u002Fgithub.com\u002Facme\u002Fapi\u002Fpull\u002F311\",\n  \"stackId\": \"\u003CsessionId>-api\",\n  \"stackPosition\": 1,\n  \"stackedOn\": null\n}\n```\n\n`stackedOn` for position 1 is `null` (it's stacked on the base branch, not on another PR). For positions 2..N, it's the URL of position N-1.\n\n`stackId = \u003CsessionId>-\u003Crepo>` in workspace mode; `\u003CsessionId>` alone in single-repo. Stable across reshape — re-stacking the same branch reuses the same `stackId`.\n\n## Strategy B — `--smart`\n\nUse when commits are messy (multiple WIP commits, fixups, no clean Conventional Commits) but the diff still has natural seams (refactor → schema → API → UI).\n\n### Backup is non-negotiable\n\n```bash\ngit branch \"${original_branch}-pre-stack-backup\"\n```\n\nThe skill MUST refuse to proceed without this branch existing. On any error, surface the recovery command in a **🛑** danger callout (see \"Recovery\" below).\n\n### Dispatch the analyzer\n\n```\nAgent: orc-stack-analyzer\nInputs:\n  branch:    \u003Coriginal_branch>\n  base:      \u003Cbase>\n  diff:      `git diff base...HEAD`\n  log:       `git log --reverse --format='%h %s%n%b' base..HEAD`\n  numstat:   `git diff --numstat base...HEAD`\n```\n\nExpected JSON output (analyzer never runs anything destructive):\n\n```json\n{\n  \"slices\": [\n    {\n      \"position\": 1,\n      \"name\": \"Refactor: extract row-stream interface\",\n      \"rationale\": \"Pure refactor with no behavior change. Lands first to keep API slice small.\",\n      \"files\": [\"api\u002Fsrc\u002Fstream\u002FRowStream.ts\", \"api\u002Fsrc\u002Fstream\u002Findex.ts\"],\n      \"est_loc\": 80,\n      \"commits_to_include\": [\"a1b2c3d\", \"e4f5g6h\"]\n    },\n    {\n      \"position\": 2,\n      \"name\": \"feat: stream export job through new interface\",\n      \"files\": [\"api\u002Fsrc\u002Fjobs\u002FExportJob.ts\", \"api\u002Ftest\u002FExportJob.test.ts\"],\n      \"est_loc\": 140,\n      \"commits_to_include\": [\"i7j8k9l\"]\n    }\n  ],\n  \"rebase_plan\": [\n    { \"branch\": \"feat\u002Fx\u002F01-refactor-extract-row-stream\", \"base_ref\": \"\u003Cbase>\", \"cherry_pick\": [\"a1b2c3d\", \"e4f5g6h\"] },\n    { \"branch\": \"feat\u002Fx\u002F02-feat-stream-export-job\",      \"base_ref\": \"feat\u002Fx\u002F01-refactor-extract-row-stream\", \"cherry_pick\": [\"i7j8k9l\"] }\n  ],\n  \"warnings\": [\n    \"Commit `e4f5g6h` touches files in slice 2 — moving the slice-2 lines via interactive rebase is recommended.\"\n  ]\n}\n```\n\n### Preview & confirm\n\nRender the preview headline and any analyzer warnings as a separate **⚠️ Caution** callout, then ask with the slice table + rebase plan as the **Apply** option's `preview` (`orc:gates` §3; never inside the callout):\n\n```markdown\n> **📋 Preview — stack plan**\n>\n> \u003CN> slices from \u003CM> commits; est. \u003Ctotal> LOC across the stack.\n```\n\n`AskUserQuestion` (header `Stack plan`):\n\n1. **Apply (Recommended)** — execute the rebase plan exactly as proposed. `preview`: the slice table + rebase plan.\n2. **Edit** — open the JSON in `$EDITOR` for manual tweaks; re-validate.\n3. **Cancel.**\n\n### Execute the rebase plan\n\nFor each entry in `rebase_plan`:\n\n```bash\ngit checkout \"$base_ref\"\ngit checkout -b \"$branch\"\nfor sha in \"${cherry_pick[@]}\"; do\n  git cherry-pick --no-edit \"$sha\" || exit 1\ndone\n```\n\nOn cherry-pick failure, surface the danger callout with the abort commands fenced below (same shape as `\u002Forc:stack-pr`'s Strategy-A failure path):\n\n```markdown\n> **🛑 Cherry-pick of \u003Csha> failed**\n>\n> Your original branch is safe in `${original_branch}-pre-stack-backup`.\n```\n\n```\ngit cherry-pick --abort && git reset --hard ${original_branch}-pre-stack-backup\n```\n\n**Never** use `git rebase -i` — only the non-interactive composition above. The analyzer is responsible for ordering commits to minimize conflicts; on any conflict, abort and surface the recovery callout.\n\nAfter the reshape, push + open PRs identically to Strategy A (Pass 1, then Pass 2 body rewrite).\n\n## Tooling detection\n\n```bash\nif command -v gh-stack >\u002Fdev\u002Fnull 2>&1; then\n  USE_GHSTACK=1\nelif gh stack --help >\u002Fdev\u002Fnull 2>&1; then\n  # Installed as a gh extension; invoke via `gh stack` (or the `gs` alias if configured).\n  USE_GHSTACK=1\n  GHSTACK_CMD=(gh stack)\nelse\n  USE_GHSTACK=0\nfi\n```\n\nIf absent, `AskUserQuestion`:\n\n1. **Install** — `gh extension install github\u002Fgh-stack`. Run, then continue.\n2. **Use plain-gh fallback** — chain via `gh pr create --base \u003Cprev-branch>`. No extension needed; works everywhere `gh` works.\n3. **Cancel.**\n\n**Never auto-install.** Tools that mutate the user's environment require explicit consent every time.\n\n## Recovery (always print on error)\n\nIf any step fails after the backup branch exists, print the danger callout, then the recovery commands in a fence:\n\n```markdown\n> **🛑 Stack construction failed at \u003Cstep>**\n>\n> Your original branch is safe in `${original_branch}-pre-stack-backup`. Recover with the commands below.\n```\n\n```\ngit checkout \"${original_branch}-pre-stack-backup\"\ngit branch -D \"${original_branch}\"\ngit branch -m \"${original_branch}-pre-stack-backup\" \"${original_branch}\"\n# then delete any partial stack branches:\ngit branch | grep \"^  ${original_branch}\u002F\" | xargs -r git branch -D\n```\n\nEcho the partial state too: which branches were created, which PRs were opened. The user shouldn't have to dig through `git reflog` to figure out what happened.\n\n## Workspace mode\n\nPer-repo. Each repo's stack is independent. `stackId = \u003CsessionId>-\u003Crepo>` keeps stacks segregated in `linkedPRs[]`. `\u002Forc:cleanup` groups by `stackId` and enforces bottom-up ordering within each group.\n\n## When NOT to stack\n\n- **Single commit on the branch** — there's nothing to stack. Use `\u002Forc:ship`.\n- **Tightly-coupled changes** — if every commit references symbols defined in every other commit, splitting buys nothing because reviewers must read the whole stack to understand any one PR. Open big-with-reason instead.\n- **Hot-fix in production-incident scope** — stacking adds review cycles. Open big-with-reason `Hot-fix incident #N` and rotate later.\n- **Generated\u002Fvendored bulk** — auto-generated migrations, lockfile bumps, vendor updates. Excluded from LOC by default; gate won't fire.\n","# Stack PR\n\n## Overview\n\nA stack is N chained PRs where each branch's base is the previous branch (not `main`). Reviewers approve incrementally, merging bottom-up. orc supports two construction strategies and one tool integration:\n\n- **Strategy A — commit-based (default)** — every commit on the branch becomes one PR. Requires clean Conventional Commits.\n- **Strategy B — smart (`--smart`)** — an analyzer agent reads the diff, proposes logical slices, and emits a non-interactive rebase plan. Higher risk, requires backup branch.\n- **Tooling** — `github\u002Fgh-stack` `gh` extension if installed; otherwise a plain-`gh` fallback that does the same chaining manually.\n\n**Announce at start:** \"I'm using the stack-pr skill to construct a stacked PR group.\"\n\n## Preconditions (both strategies)\n\n1. **Tests pass** — invoke `orc:verification-before-completion` first.\n2. **Clean working tree** — `git status --porcelain` must be empty.\n3. **No merge commits** on `base..HEAD` — `git rev-list --merges base..HEAD` must be empty. Stacks fall apart through merges.\n4. **At least 2 commits** on `base..HEAD`. A single commit isn't a stack — use `\u002Forc:ship`.\n5. **Branch is pushed-clean** — local matches `origin` (no unpushed work the rebase could lose).\n\nIf any precondition fails, surface a **⚠️ Caution** callout naming the failed precondition and **stop**. Don't try to \"fix it for them\" — these are user decisions.\n\n## Strategy A — commit-based (default)\n\n### Validate Conventional Commits\n\nEach commit subject MUST match:\n\n```\n^(feat|fix|refactor|chore|test|docs|perf|build|ci|style)(\\([^)]+\\))?!?: .+\n```\n\nIf any commit fails the regex, surface the offenders and `AskUserQuestion`:\n\n1. **Reword via reword-only rebase** — non-interactive (`GIT_SEQUENCE_EDITOR` writes a todo of `reword` lines; user is prompted for each subject one by one outside the rebase).\n2. **Switch to `--smart`** — the analyzer agent doesn't care about commit subjects; it works from the diff.\n3. **Cancel.**\n\n### Build the stack\n\nFor each commit `Cᵢ` on `base..HEAD` in chronological order:\n\n```bash\nslug_i=$(echo \"$subject\" | sed 's\u002F^[a-z]*([^)]*): *\u002F\u002F' | tr ' ' '-' | tr -cd '[:alnum:]-' | tr A-Z a-z | cut -c1-40)\nbranch_i=\"${original_branch}\u002F$(printf '%02d' $i)-${slug_i}\"\n```\n\nBranch naming: zero-padded position keeps `git branch` output sortable. Suffix is the slugified subject — readable at a glance.\n\nReshape:\n\n```bash\n# Backup first (cheap, life-saving)\ngit branch \"${original_branch}-pre-stack-backup\"\n\n# Reset to base, then replay commits onto sequentially-stacked branches\ngit checkout \"$base\"\ngit checkout -b \"$branch_1\"\ngit cherry-pick \"$C1\"\n# C1 is now on branch_1 atop base\n\ngit checkout -b \"$branch_2\"   # branches off branch_1 (current HEAD)\ngit cherry-pick \"$C2\"\n# ... and so on\n```\n\nThe original branch is preserved as the backup. Caller may delete or keep it.\n\n### Push & open PRs\n\nIf `gh-stack` is installed (see \"Tooling detection\"):\n\n```bash\ngs push                                          # pushes every layer\ngs submit --base \"$original_base\"                # creates the chained PRs\n```\n\nOtherwise, plain-`gh` fallback (per-branch loop):\n\n```bash\nfor i in 1..N; do\n  prev_branch=$([ $i -eq 1 ] && echo \"$original_base\" || echo \"$branch_$((i-1))\")\n  git push -u origin \"$branch_$i\"\n  pr_url=$(gh pr create \\\n    --base \"$prev_branch\" \\\n    --head \"$branch_$i\" \\\n    --title \"[$i\u002F$N] $subject_i\" \\\n    --body \"$body_i_placeholder\")\n  echo \"$pr_url\" >> \u002Ftmp\u002Forc-stack-urls.$$\ndone\n```\n\n### Two-pass body decoration\n\nPR #1 cannot reference PR #2's URL at creation time (#2 doesn't exist yet). So all bodies are written with a placeholder, then rewritten in pass 2 once every URL is known.\n\nDefault (terse) block:\n\n```\n## Stack ({i}\u002F{N}, id: {stackId})\n1 api#311 · 2 api#312 (this) · 3 ui#447\norder: bottom-up\n```\n\n`--verbose` variant (only when the caller shipped with `--verbose` bodies):\n\n```markdown\n## Stacked PR ({i}\u002F{N})\n\nStack: `{stackId}`\nMerge bottom-up — each merge retargets the next PR's base. See [references\u002FSTACKED-PRS.md](references\u002FSTACKED-PRS.md).\n\n| # | Subject | PR | Status |\n|---|---------|----|--------|\n| 1 | feat(api): add row stream  | org\u002Fapi#311 | parent |\n| 2 | feat(api): wire export job | org\u002Fapi#312 | **this** |\n| 3 | feat(ui): download button  | org\u002Fui#447  | child |\n```\n\nUpdate each PR via `gh pr edit \u003Curl> --body \"\u003Crewritten>\"`.\n\n### Metadata writeback\n\nAppend entries to the active session's `linkedPRs[]` in `${ORC_STATE_DIR}\u002Forc.json`:\n\n```json\n{\n  \"repo\": \"api\",\n  \"url\": \"https:\u002F\u002Fgithub.com\u002Facme\u002Fapi\u002Fpull\u002F311\",\n  \"stackId\": \"\u003CsessionId>-api\",\n  \"stackPosition\": 1,\n  \"stackedOn\": null\n}\n```\n\n`stackedOn` for position 1 is `null` (it's stacked on the base branch, not on another PR). For positions 2..N, it's the URL of position N-1.\n\n`stackId = \u003CsessionId>-\u003Crepo>` in workspace mode; `\u003CsessionId>` alone in single-repo. Stable across reshape — re-stacking the same branch reuses the same `stackId`.\n\n## Strategy B — `--smart`\n\nUse when commits are messy (multiple WIP commits, fixups, no clean Conventional Commits) but the diff still has natural seams (refactor → schema → API → UI).\n\n### Backup is non-negotiable\n\n```bash\ngit branch \"${original_branch}-pre-stack-backup\"\n```\n\nThe skill MUST refuse to proceed without this branch existing. On any error, surface the recovery command in a **🛑** danger callout (see \"Recovery\" below).\n\n### Dispatch the analyzer\n\n```\nAgent: orc-stack-analyzer\nInputs:\n  branch:    \u003Coriginal_branch>\n  base:      \u003Cbase>\n  diff:      `git diff base...HEAD`\n  log:       `git log --reverse --format='%h %s%n%b' base..HEAD`\n  numstat:   `git diff --numstat base...HEAD`\n```\n\nExpected JSON output (analyzer never runs anything destructive):\n\n```json\n{\n  \"slices\": [\n    {\n      \"position\": 1,\n      \"name\": \"Refactor: extract row-stream interface\",\n      \"rationale\": \"Pure refactor with no behavior change. Lands first to keep API slice small.\",\n      \"files\": [\"api\u002Fsrc\u002Fstream\u002FRowStream.ts\", \"api\u002Fsrc\u002Fstream\u002Findex.ts\"],\n      \"est_loc\": 80,\n      \"commits_to_include\": [\"a1b2c3d\", \"e4f5g6h\"]\n    },\n    {\n      \"position\": 2,\n      \"name\": \"feat: stream export job through new interface\",\n      \"files\": [\"api\u002Fsrc\u002Fjobs\u002FExportJob.ts\", \"api\u002Ftest\u002FExportJob.test.ts\"],\n      \"est_loc\": 140,\n      \"commits_to_include\": [\"i7j8k9l\"]\n    }\n  ],\n  \"rebase_plan\": [\n    { \"branch\": \"feat\u002Fx\u002F01-refactor-extract-row-stream\", \"base_ref\": \"\u003Cbase>\", \"cherry_pick\": [\"a1b2c3d\", \"e4f5g6h\"] },\n    { \"branch\": \"feat\u002Fx\u002F02-feat-stream-export-job\",      \"base_ref\": \"feat\u002Fx\u002F01-refactor-extract-row-stream\", \"cherry_pick\": [\"i7j8k9l\"] }\n  ],\n  \"warnings\": [\n    \"Commit `e4f5g6h` touches files in slice 2 — moving the slice-2 lines via interactive rebase is recommended.\"\n  ]\n}\n```\n\n### Preview & confirm\n\nRender the preview headline and any analyzer warnings as a separate **⚠️ Caution** callout, then ask with the slice table + rebase plan as the **Apply** option's `preview` (`orc:gates` §3; never inside the callout):\n\n```markdown\n> **📋 Preview — stack plan**\n>\n> \u003CN> slices from \u003CM> commits; est. \u003Ctotal> LOC across the stack.\n```\n\n`AskUserQuestion` (header `Stack plan`):\n\n1. **Apply (Recommended)** — execute the rebase plan exactly as proposed. `preview`: the slice table + rebase plan.\n2. **Edit** — open the JSON in `$EDITOR` for manual tweaks; re-validate.\n3. **Cancel.**\n\n### Execute the rebase plan\n\nFor each entry in `rebase_plan`:\n\n```bash\ngit checkout \"$base_ref\"\ngit checkout -b \"$branch\"\nfor sha in \"${cherry_pick[@]}\"; do\n  git cherry-pick --no-edit \"$sha\" || exit 1\ndone\n```\n\nOn cherry-pick failure, surface the danger callout with the abort commands fenced below (same shape as `\u002Forc:stack-pr`'s Strategy-A failure path):\n\n```markdown\n> **🛑 Cherry-pick of \u003Csha> failed**\n>\n> Your original branch is safe in `${original_branch}-pre-stack-backup`.\n```\n\n```\ngit cherry-pick --abort && git reset --hard ${original_branch}-pre-stack-backup\n```\n\n**Never** use `git rebase -i` — only the non-interactive composition above. The analyzer is responsible for ordering commits to minimize conflicts; on any conflict, abort and surface the recovery callout.\n\nAfter the reshape, push + open PRs identically to Strategy A (Pass 1, then Pass 2 body rewrite).\n\n## Tooling detection\n\n```bash\nif command -v gh-stack >\u002Fdev\u002Fnull 2>&1; then\n  USE_GHSTACK=1\nelif gh stack --help >\u002Fdev\u002Fnull 2>&1; then\n  # Installed as a gh extension; invoke via `gh stack` (or the `gs` alias if configured).\n  USE_GHSTACK=1\n  GHSTACK_CMD=(gh stack)\nelse\n  USE_GHSTACK=0\nfi\n```\n\nIf absent, `AskUserQuestion`:\n\n1. **Install** — `gh extension install github\u002Fgh-stack`. Run, then continue.\n2. **Use plain-gh fallback** — chain via `gh pr create --base \u003Cprev-branch>`. No extension needed; works everywhere `gh` works.\n3. **Cancel.**\n\n**Never auto-install.** Tools that mutate the user's environment require explicit consent every time.\n\n## Recovery (always print on error)\n\nIf any step fails after the backup branch exists, print the danger callout, then the recovery commands in a fence:\n\n```markdown\n> **🛑 Stack construction failed at \u003Cstep>**\n>\n> Your original branch is safe in `${original_branch}-pre-stack-backup`. Recover with the commands below.\n```\n\n```\ngit checkout \"${original_branch}-pre-stack-backup\"\ngit branch -D \"${original_branch}\"\ngit branch -m \"${original_branch}-pre-stack-backup\" \"${original_branch}\"\n# then delete any partial stack branches:\ngit branch | grep \"^  ${original_branch}\u002F\" | xargs -r git branch -D\n```\n\nEcho the partial state too: which branches were created, which PRs were opened. The user shouldn't have to dig through `git reflog` to figure out what happened.\n\n## Workspace mode\n\nPer-repo. Each repo's stack is independent. `stackId = \u003CsessionId>-\u003Crepo>` keeps stacks segregated in `linkedPRs[]`. `\u002Forc:cleanup` groups by `stackId` and enforces bottom-up ordering within each group.\n\n## When NOT to stack\n\n- **Single commit on the branch** — there's nothing to stack. Use `\u002Forc:ship`.\n- **Tightly-coupled changes** — if every commit references symbols defined in every other commit, splitting buys nothing because reviewers must read the whole stack to understand any one PR. Open big-with-reason instead.\n- **Hot-fix in production-incident scope** — stacking adds review cycles. Open big-with-reason `Hot-fix incident #N` and rotate later.\n- **Generated\u002Fvendored bulk** — auto-generated migrations, lockfile bumps, vendor updates. Excluded from LOC by default; gate won't fire.\n",{"name":5,"description":7},"main","7522fd7266944e30052204c2f6df287d8b5516be","orc\u002Fskills\u002Fstack-pr",0,"https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc","https:\u002F\u002Forc.novacstack.com\u002F","https:\u002F\u002Fgithub.com\u002FHigorAlves","higoralves.dev","Software Engineering","2026-11-07 07:26:38",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add HigorAlves\u002Forc --skill stack-pr",{"tool":61,"command":62},"bunx","bunx skills add HigorAlves\u002Forc --skill stack-pr",{"tool":64,"command":65},"pnpm","pnpm dlx skills add HigorAlves\u002Forc --skill stack-pr","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fstack-pr\u002FSKILL.md",true,[69],{"path":70,"resourceType":71,"resourceTypeDesc":72,"sizeBytes":73,"sourceHtmlUrl":74},"references\u002FSTACKED-PRS.md","REFERENCE","参考文档",4855,"https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fstack-pr\u002Freferences\u002FSTACKED-PRS.md",[76,112,136,155,177,197],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":93,"publishedAt":40},"01M71SW40F9TAAEDKBYYBCM814","writing-plans","Write a comprehensive implementation plan of bite-sized TDD tasks that an engineer with zero codebase context could execute — exact files, code, tests, and verification steps","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[82,85,90],{"categoryNo":83,"categoryName":84,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":86,"categoryName":87,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":91,"categoryName":92,"taxonomyType":88,"taxonomyTypeDesc":89},"01JBSEEDCAT000000000000036","内容创作者",[94,95,96,97,98,99,100,29,101,102,103,104,105,106,107,108,109,110,111,35],"writing","writing plans","plans","engineer","superpowers","implementation plan","files","you","code","tasks","verification","plan","write","steps","context","ZeRO","for","tests",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":121,"publishedAt":40},"01M71SW15KHE4MHJW9NEXV65X2","writing-for-agents","orc's doctrine layer for writing any document an agent consumes — skills, AGENTS.md\u002FCLAUDE.md, reference docs","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[118,119,120],{"categoryNo":83,"categoryName":84,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":91,"categoryName":92,"taxonomyType":88,"taxonomyTypeDesc":89},[122,94,110,123,29,124,125,126,127,128,129,130,35,131,132,133,134,135],"writing for agents","matt pocock","inline","tuning","a skill","layer","doctrine","push","editing","document","github","https","reference","docs",{"skillNo":137,"name":138,"nameZh":6,"description":139,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":140,"categories":141,"keywords":143,"publishedAt":40},"01M71SVYQKXT743HHHWGHT3G13","workspace-mode","Use when cwd is a parent dir holding multiple sibling git repos — defines repo auto-detection, --repos\u002F--repo\u002F--all-repos\u002F--this-repo precedence, per-repo dispatch, and linked-PR mechanics.","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fworkspace-mode\u002FSKILL.md",[142],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[144,145,146,147,148,29,149,150,25,151,35,152,153,39,154],"workspace mode","mode","workspace","mechanics","auto","repos","git","repo","dispatch","auto-detection","parent",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":162,"publishedAt":40},"01M71SVVP3BXS06G9395P2K0RH","wizard","Generate an interactive bash wizard walking a human through work only they can perform — credentials, secrets, one-off migrations","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fwizard\u002FSKILL.md",[161],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[157,163,164,165,166,123,29,167,168,169,170,171,172,107,173,174,110,35,175,176],"condition","never","provisioning infrastructure","only","Bash","work","credentials","generate","human","secrets","infrastructure","do","one","interactive",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":40},"01M71SVT4AR6NKAM5B077E7QSJ","wait-what","Stop and re-pitch — the last message did not land; say it again simply, in the project's own vocabulary.","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fwait-what\u002FSKILL.md",[],[184,185,186,187,188,123,189,190,191,192,132,133,193,194,195,196],"wait what","wait","project","re","true","pitch","last","say","message","land","it","stop","vocabulary",{"skillNo":198,"name":199,"nameZh":6,"description":200,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":201,"categories":202,"keywords":207,"publishedAt":40},"01M71SVQVYRA9QBQ6G8MWR8G6F","vitest","Vitest fast unit testing framework powered by Vite with Jest-compatible API","https:\u002F\u002Fgithub.com\u002FHigorAlves\u002Forc\u002Fblob\u002Fmain\u002Forc\u002Fskills\u002Fvitest\u002FSKILL.md",[203,206],{"categoryNo":204,"categoryName":205,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":86,"categoryName":87,"taxonomyType":88,"taxonomyTypeDesc":89},[199,208,209,210,211,212,94,29,213,214,215,216,217,218,219,220,221,222,111,223],"coverage","unit","testing","testing framework","generated","api","jest","2026","at","scripts","unit testing","antfu","framework","vite","mocking","dev"]