[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MQXHSDNFXSN7TT5FFWPF3X":3,"skill-same:01M6MQXHSDNFXSN7TT5FFWPF3X":79},{"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":45,"linkOnly":46,"markdownContent":47,"markdownBody":48,"frontMatter":49,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":55,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":58,"install":59,"resources":72},"01M6MQXHSDNFXSN7TT5FFWPF3X","stack-test",null,"Use when you need to run tests or formatters across commits in a stack. Use INSTEAD of manual git test run or looping git checkout + test. Prevents: testing every commit when only the tip has to pass, unbounded parallel jobs exhausting memory, cache misunderstandings.","higherorderfunctor\u002Fnix-agentic-tools","higherorderfunctor","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F34926636?v=4","01M6MQT3TQS16N1CBRZJYR2EMB","Christopher Aubut","01M6MQT419AF9ERC87M87NRXQV",2,"Unlicense","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-test\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],"test","stack test","stack","fix","when","manual","you","checkout","false","tests","across","only","use","testing","command","parallel","commits","TIP","cache","commit","memory","2026-11-10 10:12:30",false,"---\nname: stack-test\ndescription: >-\n  Use when you need to run tests or formatters across commits in a stack. Use\n  INSTEAD of manual git test run or looping git checkout + test. Prevents:\n  testing every commit when only the tip has to pass, unbounded parallel jobs\n  exhausting memory, cache misunderstandings.\nargument-hint: \"\u003Ccommand> [--fix] [--stack|--tip] [--jobs N] [revset]\"\ndisable-model-invocation: false\ncompatibility: \"Requires git-branchless\"\n---\n\nRun a test command or formatter across commits in the current stack.\n\n## Pre-flight\n\n1. **Load references** — read `references\u002Fgit-branchless.md` (relative to this\n   skill's directory) before proceeding. The sections **Choosing the test\n   revset** and **Sizing `--jobs` — by memory, not by cores** are the rules this\n   skill applies; the rest of this file is how to apply them.\n\n2. **Confirm repository initialization.** A devenv project with\n   `git.branchless.enable` runs `git branchless init` on every shell entry.\n   Anywhere else, check and stop if it is missing:\n\n   ```bash\n   git config --get branchless.core.mainBranch >\u002Fdev\u002Fnull ||\n     echo \"not initialized: ask the user to run git branchless init\"\n   ```\n\n   Do not run `git branchless init` yourself: it rewrites the repository's\n   shared configuration and hooks for every worktree.\n\n## Arguments\n\n- First argument: the command to run (optional — auto-detected if omitted)\n- `--fix`: use fix mode (apply changes per commit, e.g., formatters)\n- `--stack`: test **every** commit — for a stack of independent PRs\u002FMRs\n- `--tip`: test only the stack tip — for one PR\u002FMR with several commits\n- `--jobs N`: parallelism override for run mode. **Never `0`** (see step 5). Fix\n  mode always runs `--jobs 1` (see Fix Mode)\n- Remaining args: an explicit revset, which overrides `--stack` \u002F `--tip`\n\n## Steps\n\n1. **Parse `$ARGUMENTS`**. If no command is provided, detect from the project:\n   - `package.json` → `npm test` or `pnpm test`\n   - `Cargo.toml` → `cargo test`\n   - `Makefile` → `make test`\n   - `flake.nix` → `nix flake check`\n   - Otherwise, ask the user.\n\n2. **Determine mode**. If `--fix` is in arguments, use fix mode. Otherwise use\n   run mode.\n\n3. **Determine the target revset.** This is a coverage decision — get it right\n   before worrying about speed.\n\n   **Select this worktree's own stack first**, and use `$STACK` wherever this\n   skill says \"the stack\" — the table below, fix mode, and every revset you\n   pass:\n\n   ```bash\n   main_branch=\"$(git config branchless.core.mainBranch || echo main)\"\n   remote=\"$(git config \"branch.${main_branch}.remote\" || echo origin)\"\n   base=\"$(git rev-parse --abbrev-ref \"${main_branch}@{upstream}\" 2>\u002Fdev\u002Fnull \\\n     || echo \"${remote}\u002F${main_branch}\")\"\n   git rev-parse --verify -q \"${base}^{commit}\" >\u002Fdev\u002Fnull || base=\"$main_branch\"\n   STACK=\"descendants(roots((stack() & ::HEAD) - ::$base)) - ::$base\"\n   ```\n\n   Plain `stack()` is not your stack whenever local `main` is behind its\n   upstream, the normal state when worktrees branch from `origin\u002Fmain`: the\n   upstream commits count as draft, so `stack()` holds them and every stack that\n   another worktree branched from them. `git test run` then tests other agents'\n   work, and `git test fix` **rewrites** it, including a forged copy of an\n   upstream commit under your own stack. `$STACK` stops at `$base` and at HEAD's\n   own line, so neither can happen. The one exception is a worktree stacked on\n   yours, which the fix-mode checks below catch; see **Selecting your own\n   stack** in `references\u002Fgit-branchless.md`. This does not fetch; the last\n   fetched `$base` is enough to tell your commits from upstream ones. With no\n   upstream ref (no remote, or a remote with no main branch yet), `$base` falls\n   back to local `main`.\n\n   Precedence, highest first: an explicit revset argument, then `--stack` \u002F\n   `--tip`, then the mode default. **The mode default differs**: run mode\n   defaults to the tip (the table below), fix mode defaults to `$STACK` (see Fix\n   Mode, step 6). So in `--fix` the table below does not apply unless `--tip` or\n   an explicit revset was given.\n\n   **Fix mode rewrites every commit it selects and moves the branches on them,\n   so check before running:**\n\n   ```bash\n   : \"${STACK:?run the selection block first}\"\n   stack_commits=\"$(git query -r \"$STACK\")\" || exit 1\n   test -n \"$stack_commits\" || { echo \"empty stack selection\" >&2; exit 1; }\n   outside=\"$(git query -r \"(\u003Crevset>) - ($STACK)\")\" || exit 1\n   test -z \"$outside\" || { printf '%s\\n' \"$outside\"; exit 1; }\n   current_worktree=\"$(git rev-parse --show-toplevel)\" || exit 1\n   other_heads=\"$(git worktree list --porcelain | awk -v current=\"$current_worktree\" '\n     $1 == \"worktree\" {\n       if (path != \"\" && path != current && head != \"\") print head\n       path = substr($0, 10); head = \"\"\n     }\n     $1 == \"HEAD\" { head = $2 }\n     END { if (path != \"\" && path != current && head != \"\") print head }\n   ')\" || exit 1\n   selected_commits=\"$(git query -r \"\u003Crevset>\")\" || exit 1\n   test -n \"$selected_commits\" || { echo \"empty fix selection\" >&2; exit 1; }\n   overlap=\"\"\n   for other_head in $other_heads; do\n     for selected_commit in $selected_commits; do\n       if git merge-base --is-ancestor \"$selected_commit\" \"$other_head\"; then\n         overlap=\"${overlap}${overlap:+ }${other_head}\"\n       fi\n     done\n   done\n   test -z \"$overlap\" || { printf '%s\\n' \"$overlap\"; exit 1; }\n   ```\n\n   - **The query prints commits:** stop and show them. The revset reaches\n     another worktree's stack or upstream commits (`draft()` and `stack()` both\n     can). Run mode only reads, so an explicit revset may reach further there;\n     say so in the report.\n   - **The worktree check prints a commit:** another worktree, including a\n     detached one, has its HEAD inside your stack. Stop and ask. Fixing would\n     rewrite or abandon the commit under that worktree.\n\n   Every guard must print nothing and exit 0. Re-run the selection block and\n   this guard in the same shell before fix mode.\n\n   With no revset and no flag, read the structure of the work — every PR\u002FMR\n   needs its own branch, so branch refs inside the stack count the PRs:\n\n   ```bash\n   git query \"$STACK\" | wc -l                # commits in the stack\n   git query --branches \"$STACK\"             # and their branches\n   ```\n\n   | Branches in stack | Situation                                 | Revset          |\n   | ----------------- | ----------------------------------------- | --------------- |\n   | `$STACK` is empty | No commits of your own — on main or fresh | `@`             |\n   | 0 or 1            | One PR\u002FMR, several WIP commits            | `heads($STACK)` |\n   | 2+                | A stack of independent PRs\u002FMRs            | `$STACK`        |\n\n   Check the empty case first and mechanically — on `main`, `heads($STACK)`\n   resolves to zero commits and would test nothing at all.\n\n   Use `heads($STACK)` rather than `@` for the tip: it stays correct when the\n   user has navigated back with `git prev`, where `@` is a middle commit.\n\n   **When the count is 2+, name the branches you found in your report.** The\n   count cannot tell a real PR stack from one PR plus a stale branch left over\n   from earlier work — both look like 2. Over-testing is the safe direction, so\n   still default to `$STACK`, but listing the names lets the user spot a stale\n   branch immediately instead of wondering why seven commits are being tested.\n\n   **Why the tip is the default.** In a single PR only the merged result ships:\n   the tip is what reviewers read and what CI gates, and the commits underneath\n   are checkpoints. Testing all seven commits of a seven-commit PR runs six\n   evaluations that buy nothing. Small, frequent commits inside one PR are a\n   deliberate, good habit — **never** discourage them, and never read them as N\n   things to validate.\n\n   **Say which revset you chose and why, before running.** Widening and\n   narrowing are both coverage changes, and a silent one is a bug.\n\n4. **Reject `nix` per-commit testing.** If the command is a Nix command\n   (`nix flake check`, `nix build`, …) _and_ the revset covers more than one\n   commit, stop and tell the user the cost before running:\n\n   > Per-commit testing does not fit Nix at any `--jobs` value. Each job is a\n   > multi-GB evaluator in its own worktree with no shared eval cache, so at\n   > `--jobs 0` this fans out until it exhausts RAM (7 commits measured ~24 GB,\n   > OOM-killing a 30 GB workstation), and at `--jobs 1` it is N sequential full\n   > evaluations.\n\n   Then confirm the user really wants every commit evaluated. If not, use\n   `heads($STACK)`.\n\n5. **Size `--jobs` by memory, not by cores.** Each job runs in its own worktree\n   with no shared cache, so peak usage is `jobs x per-job footprint`.\n\n   Use an explicit `--jobs N` on **every** invocation. Never pass `--jobs 0`: it\n   means _one job per physical CPU_, and it overrides whatever bound the\n   machine's config had set. Omitting the flag inherits `branchless.test.jobs`,\n   which is only safe if you know what it says — this repo's own preset shipped\n   `0` for a while, so do not rely on it.\n\n   Derive the number with the snippet under **Sizing `--jobs`** in\n   `references\u002Fgit-branchless.md`. It already clamps by CPUs and by commit\n   count; the one value you must supply is `footprint_mb`, taken from that\n   section's table **for the command you detected in step 1** — not the Nix\n   default. Leaving it at Nix's ~3500 for `cargo test` or `npm test` would\n   serialize a run that could safely use every core.\n\n   When the revset resolves to a single commit, `--jobs 1` is the whole answer\n   and no arithmetic is needed. Fix mode is always `--jobs 1`; skip this step\n   there.\n\n### Run Mode (testing)\n\n6. **Run tests**:\n\n   ```bash\n   git test run -x '\u003Ccommand>' --jobs \u003CN> '\u003Crevset>'\n   ```\n\n7. **Report results**:\n   - State the revset and job count used, and why.\n   - If all pass: confirm with commit count.\n   - If some fail: list which commits failed with their hashes and messages.\n   - Suggest `git test run -x '\u003Ccommand>' --jobs 1 --search binary` to bisect if\n     the failure pattern is unclear.\n\n### Fix Mode (formatting)\n\n6. **Apply formatter across the stack**:\n\n   ```bash\n   git test fix --strategy working-copy --jobs 1 --no-cache -x '\u003Ccommand>' '\u003Crevset>'\n   ```\n\n   Always pass `--strategy working-copy --jobs 1 --no-cache`. With the\n   `worktree` strategy (this repo's git preset), `git test fix` silently fixes\n   nothing: it reports `No commits to fix`. A cached result from any earlier\n   worktree-strategy run has the same effect, and a `--jobs` above 1 selects\n   `worktree` too. See **`git test fix`** in `references\u002Fgit-branchless.md`.\n\n   `working-copy` checks each commit out in this worktree, so it needs a clean\n   working tree. If tracked files have changes, it exits 1 and changes nothing;\n   ask the user to commit them first.\n\n   Fix mode replaces tree OIDs directly and never produces merge conflicts.\n\n   Formatters are the one case where the tip is _not_ enough: an unformatted\n   intermediate commit stays unformatted forever. Default to `$STACK` here even\n   for a single PR.\n\n7. **Verify** with `git sl` to show any commits that were modified.\n\n8. **Optionally re-run tests** to confirm the formatting didn't break anything:\n\n   ```bash\n   git test run -x '\u003Ctest-command>' --jobs \u003CN> '\u003Crevset>'\n   ```\n\n## Examples\n\n```\n\u002Fstack-test \"npm test\"                          # tip only, auto-sized jobs\n\u002Fstack-test \"nix flake check\"                   # tip only — see step 4\n\u002Fstack-test \"cargo test\" --stack                # every commit: a PR stack\n\u002Fstack-test \"cargo fmt --all\" --fix             # every commit (formatter)\n\u002Fstack-test \"prettier --write .\" --fix '@'      # fix one commit\n\u002Fstack-test \"make lint\" '@'                     # explicit revset wins\n\u002Fstack-test \"npm test\" --jobs 4 'draft()'       # run mode only: every worktree's drafts\n```\n\n## Notes\n\n- Test results are cached by command + tree ID, under\n  `.git\u002Fbranchless\u002Ftest\u002F\u003Ctree-oid>\u002F`. Use `--no-cache` to bypass the cache for\n  one run without clearing stored results (useful after environment changes).\n- Cache cleanup affects the common Git directory shared by every worktree. Stop\n  and ask before clearing cached test results.\n- `strategy = worktree` (set by this repo's git preset; upstream defaults to\n  `working-copy`) is what makes parallelism possible at all. In run mode it also\n  means `--jobs 1` still runs in an isolated worktree, so a dirty working copy\n  is fine. Fix mode overrides it with `--strategy working-copy` (step 6).\n- `--jobs N` on the command line overrides `branchless.test.jobs` in **both**\n  directions: it lowers a configured `0` and raises a configured `1`.\n- The `BRANCHLESS_TEST_COMMIT` env var is available inside the test command.\n","Run a test command or formatter across commits in the current stack.\n\n## Pre-flight\n\n1. **Load references** — read `references\u002Fgit-branchless.md` (relative to this\n   skill's directory) before proceeding. The sections **Choosing the test\n   revset** and **Sizing `--jobs` — by memory, not by cores** are the rules this\n   skill applies; the rest of this file is how to apply them.\n\n2. **Confirm repository initialization.** A devenv project with\n   `git.branchless.enable` runs `git branchless init` on every shell entry.\n   Anywhere else, check and stop if it is missing:\n\n   ```bash\n   git config --get branchless.core.mainBranch >\u002Fdev\u002Fnull ||\n     echo \"not initialized: ask the user to run git branchless init\"\n   ```\n\n   Do not run `git branchless init` yourself: it rewrites the repository's\n   shared configuration and hooks for every worktree.\n\n## Arguments\n\n- First argument: the command to run (optional — auto-detected if omitted)\n- `--fix`: use fix mode (apply changes per commit, e.g., formatters)\n- `--stack`: test **every** commit — for a stack of independent PRs\u002FMRs\n- `--tip`: test only the stack tip — for one PR\u002FMR with several commits\n- `--jobs N`: parallelism override for run mode. **Never `0`** (see step 5). Fix\n  mode always runs `--jobs 1` (see Fix Mode)\n- Remaining args: an explicit revset, which overrides `--stack` \u002F `--tip`\n\n## Steps\n\n1. **Parse `$ARGUMENTS`**. If no command is provided, detect from the project:\n   - `package.json` → `npm test` or `pnpm test`\n   - `Cargo.toml` → `cargo test`\n   - `Makefile` → `make test`\n   - `flake.nix` → `nix flake check`\n   - Otherwise, ask the user.\n\n2. **Determine mode**. If `--fix` is in arguments, use fix mode. Otherwise use\n   run mode.\n\n3. **Determine the target revset.** This is a coverage decision — get it right\n   before worrying about speed.\n\n   **Select this worktree's own stack first**, and use `$STACK` wherever this\n   skill says \"the stack\" — the table below, fix mode, and every revset you\n   pass:\n\n   ```bash\n   main_branch=\"$(git config branchless.core.mainBranch || echo main)\"\n   remote=\"$(git config \"branch.${main_branch}.remote\" || echo origin)\"\n   base=\"$(git rev-parse --abbrev-ref \"${main_branch}@{upstream}\" 2>\u002Fdev\u002Fnull \\\n     || echo \"${remote}\u002F${main_branch}\")\"\n   git rev-parse --verify -q \"${base}^{commit}\" >\u002Fdev\u002Fnull || base=\"$main_branch\"\n   STACK=\"descendants(roots((stack() & ::HEAD) - ::$base)) - ::$base\"\n   ```\n\n   Plain `stack()` is not your stack whenever local `main` is behind its\n   upstream, the normal state when worktrees branch from `origin\u002Fmain`: the\n   upstream commits count as draft, so `stack()` holds them and every stack that\n   another worktree branched from them. `git test run` then tests other agents'\n   work, and `git test fix` **rewrites** it, including a forged copy of an\n   upstream commit under your own stack. `$STACK` stops at `$base` and at HEAD's\n   own line, so neither can happen. The one exception is a worktree stacked on\n   yours, which the fix-mode checks below catch; see **Selecting your own\n   stack** in `references\u002Fgit-branchless.md`. This does not fetch; the last\n   fetched `$base` is enough to tell your commits from upstream ones. With no\n   upstream ref (no remote, or a remote with no main branch yet), `$base` falls\n   back to local `main`.\n\n   Precedence, highest first: an explicit revset argument, then `--stack` \u002F\n   `--tip`, then the mode default. **The mode default differs**: run mode\n   defaults to the tip (the table below), fix mode defaults to `$STACK` (see Fix\n   Mode, step 6). So in `--fix` the table below does not apply unless `--tip` or\n   an explicit revset was given.\n\n   **Fix mode rewrites every commit it selects and moves the branches on them,\n   so check before running:**\n\n   ```bash\n   : \"${STACK:?run the selection block first}\"\n   stack_commits=\"$(git query -r \"$STACK\")\" || exit 1\n   test -n \"$stack_commits\" || { echo \"empty stack selection\" >&2; exit 1; }\n   outside=\"$(git query -r \"(\u003Crevset>) - ($STACK)\")\" || exit 1\n   test -z \"$outside\" || { printf '%s\\n' \"$outside\"; exit 1; }\n   current_worktree=\"$(git rev-parse --show-toplevel)\" || exit 1\n   other_heads=\"$(git worktree list --porcelain | awk -v current=\"$current_worktree\" '\n     $1 == \"worktree\" {\n       if (path != \"\" && path != current && head != \"\") print head\n       path = substr($0, 10); head = \"\"\n     }\n     $1 == \"HEAD\" { head = $2 }\n     END { if (path != \"\" && path != current && head != \"\") print head }\n   ')\" || exit 1\n   selected_commits=\"$(git query -r \"\u003Crevset>\")\" || exit 1\n   test -n \"$selected_commits\" || { echo \"empty fix selection\" >&2; exit 1; }\n   overlap=\"\"\n   for other_head in $other_heads; do\n     for selected_commit in $selected_commits; do\n       if git merge-base --is-ancestor \"$selected_commit\" \"$other_head\"; then\n         overlap=\"${overlap}${overlap:+ }${other_head}\"\n       fi\n     done\n   done\n   test -z \"$overlap\" || { printf '%s\\n' \"$overlap\"; exit 1; }\n   ```\n\n   - **The query prints commits:** stop and show them. The revset reaches\n     another worktree's stack or upstream commits (`draft()` and `stack()` both\n     can). Run mode only reads, so an explicit revset may reach further there;\n     say so in the report.\n   - **The worktree check prints a commit:** another worktree, including a\n     detached one, has its HEAD inside your stack. Stop and ask. Fixing would\n     rewrite or abandon the commit under that worktree.\n\n   Every guard must print nothing and exit 0. Re-run the selection block and\n   this guard in the same shell before fix mode.\n\n   With no revset and no flag, read the structure of the work — every PR\u002FMR\n   needs its own branch, so branch refs inside the stack count the PRs:\n\n   ```bash\n   git query \"$STACK\" | wc -l                # commits in the stack\n   git query --branches \"$STACK\"             # and their branches\n   ```\n\n   | Branches in stack | Situation                                 | Revset          |\n   | ----------------- | ----------------------------------------- | --------------- |\n   | `$STACK` is empty | No commits of your own — on main or fresh | `@`             |\n   | 0 or 1            | One PR\u002FMR, several WIP commits            | `heads($STACK)` |\n   | 2+                | A stack of independent PRs\u002FMRs            | `$STACK`        |\n\n   Check the empty case first and mechanically — on `main`, `heads($STACK)`\n   resolves to zero commits and would test nothing at all.\n\n   Use `heads($STACK)` rather than `@` for the tip: it stays correct when the\n   user has navigated back with `git prev`, where `@` is a middle commit.\n\n   **When the count is 2+, name the branches you found in your report.** The\n   count cannot tell a real PR stack from one PR plus a stale branch left over\n   from earlier work — both look like 2. Over-testing is the safe direction, so\n   still default to `$STACK`, but listing the names lets the user spot a stale\n   branch immediately instead of wondering why seven commits are being tested.\n\n   **Why the tip is the default.** In a single PR only the merged result ships:\n   the tip is what reviewers read and what CI gates, and the commits underneath\n   are checkpoints. Testing all seven commits of a seven-commit PR runs six\n   evaluations that buy nothing. Small, frequent commits inside one PR are a\n   deliberate, good habit — **never** discourage them, and never read them as N\n   things to validate.\n\n   **Say which revset you chose and why, before running.** Widening and\n   narrowing are both coverage changes, and a silent one is a bug.\n\n4. **Reject `nix` per-commit testing.** If the command is a Nix command\n   (`nix flake check`, `nix build`, …) _and_ the revset covers more than one\n   commit, stop and tell the user the cost before running:\n\n   > Per-commit testing does not fit Nix at any `--jobs` value. Each job is a\n   > multi-GB evaluator in its own worktree with no shared eval cache, so at\n   > `--jobs 0` this fans out until it exhausts RAM (7 commits measured ~24 GB,\n   > OOM-killing a 30 GB workstation), and at `--jobs 1` it is N sequential full\n   > evaluations.\n\n   Then confirm the user really wants every commit evaluated. If not, use\n   `heads($STACK)`.\n\n5. **Size `--jobs` by memory, not by cores.** Each job runs in its own worktree\n   with no shared cache, so peak usage is `jobs x per-job footprint`.\n\n   Use an explicit `--jobs N` on **every** invocation. Never pass `--jobs 0`: it\n   means _one job per physical CPU_, and it overrides whatever bound the\n   machine's config had set. Omitting the flag inherits `branchless.test.jobs`,\n   which is only safe if you know what it says — this repo's own preset shipped\n   `0` for a while, so do not rely on it.\n\n   Derive the number with the snippet under **Sizing `--jobs`** in\n   `references\u002Fgit-branchless.md`. It already clamps by CPUs and by commit\n   count; the one value you must supply is `footprint_mb`, taken from that\n   section's table **for the command you detected in step 1** — not the Nix\n   default. Leaving it at Nix's ~3500 for `cargo test` or `npm test` would\n   serialize a run that could safely use every core.\n\n   When the revset resolves to a single commit, `--jobs 1` is the whole answer\n   and no arithmetic is needed. Fix mode is always `--jobs 1`; skip this step\n   there.\n\n### Run Mode (testing)\n\n6. **Run tests**:\n\n   ```bash\n   git test run -x '\u003Ccommand>' --jobs \u003CN> '\u003Crevset>'\n   ```\n\n7. **Report results**:\n   - State the revset and job count used, and why.\n   - If all pass: confirm with commit count.\n   - If some fail: list which commits failed with their hashes and messages.\n   - Suggest `git test run -x '\u003Ccommand>' --jobs 1 --search binary` to bisect if\n     the failure pattern is unclear.\n\n### Fix Mode (formatting)\n\n6. **Apply formatter across the stack**:\n\n   ```bash\n   git test fix --strategy working-copy --jobs 1 --no-cache -x '\u003Ccommand>' '\u003Crevset>'\n   ```\n\n   Always pass `--strategy working-copy --jobs 1 --no-cache`. With the\n   `worktree` strategy (this repo's git preset), `git test fix` silently fixes\n   nothing: it reports `No commits to fix`. A cached result from any earlier\n   worktree-strategy run has the same effect, and a `--jobs` above 1 selects\n   `worktree` too. See **`git test fix`** in `references\u002Fgit-branchless.md`.\n\n   `working-copy` checks each commit out in this worktree, so it needs a clean\n   working tree. If tracked files have changes, it exits 1 and changes nothing;\n   ask the user to commit them first.\n\n   Fix mode replaces tree OIDs directly and never produces merge conflicts.\n\n   Formatters are the one case where the tip is _not_ enough: an unformatted\n   intermediate commit stays unformatted forever. Default to `$STACK` here even\n   for a single PR.\n\n7. **Verify** with `git sl` to show any commits that were modified.\n\n8. **Optionally re-run tests** to confirm the formatting didn't break anything:\n\n   ```bash\n   git test run -x '\u003Ctest-command>' --jobs \u003CN> '\u003Crevset>'\n   ```\n\n## Examples\n\n```\n\u002Fstack-test \"npm test\"                          # tip only, auto-sized jobs\n\u002Fstack-test \"nix flake check\"                   # tip only — see step 4\n\u002Fstack-test \"cargo test\" --stack                # every commit: a PR stack\n\u002Fstack-test \"cargo fmt --all\" --fix             # every commit (formatter)\n\u002Fstack-test \"prettier --write .\" --fix '@'      # fix one commit\n\u002Fstack-test \"make lint\" '@'                     # explicit revset wins\n\u002Fstack-test \"npm test\" --jobs 4 'draft()'       # run mode only: every worktree's drafts\n```\n\n## Notes\n\n- Test results are cached by command + tree ID, under\n  `.git\u002Fbranchless\u002Ftest\u002F\u003Ctree-oid>\u002F`. Use `--no-cache` to bypass the cache for\n  one run without clearing stored results (useful after environment changes).\n- Cache cleanup affects the common Git directory shared by every worktree. Stop\n  and ask before clearing cached test results.\n- `strategy = worktree` (set by this repo's git preset; upstream defaults to\n  `working-copy`) is what makes parallelism possible at all. In run mode it also\n  means `--jobs 1` still runs in an isolated worktree, so a dirty working copy\n  is fine. Fix mode overrides it with `--strategy working-copy` (step 6).\n- `--jobs N` on the command line overrides `branchless.test.jobs` in **both**\n  directions: it lowers a configured `0` and raises a configured `1`.\n- The `BRANCHLESS_TEST_COMMIT` env var is available inside the test command.\n",{"name":5,"description":7,"argument-hint":50,"compatibility":51,"disable-model-invocation":46},"\u003Ccommand> [--fix] [--stack|--tip] [--jobs N] [revset]","Requires git-branchless","main","a33b4e70efef03fe75378fad9c847b73ea142c46","packages\u002Fstacked-workflows\u002Fskills\u002Fstack-test",0,"https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor","2026-11-13 03:39:17",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add higherorderfunctor\u002Fnix-agentic-tools --skill stack-test",{"tool":65,"command":66},"bunx","bunx skills add higherorderfunctor\u002Fnix-agentic-tools --skill stack-test",{"tool":68,"command":69},"pnpm","pnpm dlx skills add higherorderfunctor\u002Fnix-agentic-tools --skill stack-test","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-test\u002FSKILL.md",true,[73],{"path":74,"resourceType":75,"resourceTypeDesc":76,"sizeBytes":77,"sourceHtmlUrl":78},"references\u002Fgit-branchless.md","REFERENCE","参考文档",37,"https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-test\u002Freferences\u002Fgit-branchless.md",[80,107,126,145,160,176],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":45},"01M6MQXAXVWG1RY9H2116G4SVX","stack-summary","Use when you need to audit, analyze, or review stack quality before restructuring. Produces a structured summary with per-commit classification, philosophy audit, and violation flags. Output feeds directly into \u002Fstack-plan restructure mode. Use INSTEAD of manual git log inspection.","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-summary\u002FSKILL.md",[],[26,87,88,89,90,91,29,92,93,36,32,30,94,43,95,96,97,98,99,100,101,28,102,103,104,105,106],"stack summary","summary","feeds","review stack","for","mode","classification","git log","log","review","output","analyze","with","philosophy","inspection","plan","worktree","audit","flags","git",{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":111,"categories":112,"keywords":113,"publishedAt":45},"01M6MQX62HMQR5CSN4FSC95ZJC","stack-submit","Use when you need to push, submit, or create pull requests for a commit stack. Rebases only the current stack onto upstream main, validates, and pushes INSTEAD of manual git sync + git submit + PR\u002FMR creation. Handles branch creation, stacked PR\u002FMR creation with correct base branches.","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-submit\u002FSKILL.md",[],[114,26,115,116,117,118,119,120,91,29,121,122,123,35,52,36,32,124,125,28],"submit","stack submit","pull","branch","push","pr","creation","correct","upstream","branches","git sync","mr",{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":45},"01M6MQX2BNQ4MAV9KCV0RZ734G","stack-split","Use when you need to break up, split, or decompose a large commit into smaller atomic commits. Use INSTEAD of manual git rebase -i + edit or git reset HEAD^. Prevents: non-working intermediate commits, wrong split ordering, missed downstream restack.","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-split\u002FSKILL.md",[],[133,26,134,135,40,29,136,36,32,137,30,43,138,139,140,141,142,143,106,144,28],"split","stack split","decompose","up","atomic commits","reset","head","missed","break","atomic","edit","rebase",{"skillNo":146,"name":147,"nameZh":6,"description":148,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":149,"categories":150,"keywords":151,"publishedAt":45},"01M6MQWWM5P7FVQSF7EWHJ70C6","stack-plan","Use when you need to plan commits, restructure a stack, or commit uncommitted work as organized atomic commits. Builds a stack from a description, uncommitted work, or existing commits INSTEAD of dumping everything into one monolithic commit with git add -A && git commit, or manual git rebase -i, git reset --soft, or ad-hoc git move sequences. Prevents: wrong commit ordering, forward references, git move -F panics, untested intermediates.","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-plan\u002FSKILL.md",[],[26,102,152,153,154,40,91,155,29,156,36,157,32,137,30,43,158,138,99,159,28],"stack plan","tree","as","move","git commit","Existing","git move","references",{"skillNo":161,"name":162,"nameZh":6,"description":163,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":45},"01M6MQWP7CKTM5NF72MED1H8NS","stack-fix","Use when you need to fix, correct, or update content in an earlier commit — line-level edits, content moves, or structural changes. Absorbs staged changes into correct stack commits INSTEAD of running git absorb or git commit --fixup via Bash, or hand-running git prev + edit + git amend + git restack --merge. Prevents: missed dry-run preview, leftover staged changes going unnoticed, forgetting to restack. Falls back to guided manual amend when absorb cannot route hunks.","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fstacked-workflows\u002Fskills\u002Fstack-fix\u002FSKILL.md",[],[27,26,167,168,40,29,121,169,156,36,32,30,170,171,43,172,173,174,175,28],"stack fix","back","structural","Bash","preview","hand","dry","route","running",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":182,"publishedAt":45},"01M6MQWJS10XBJT1C1JW4QF1X9","peer-communication","How to write replies a person reads: answer first, plain words, easy to scan. Load before your first reply in an interactive session.","https:\u002F\u002Fgithub.com\u002Fhigherorderfunctor\u002Fnix-agentic-tools\u002Fblob\u002Fmain\u002Fpackages\u002Fpeer-communication\u002Fskills\u002Fpeer-communication\u002FSKILL.md",[],[183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199],"peer","communication","peer communication","scan","answer","session","how to","load","interactive","replies","first","how","write","person","easy","reply","plain"]