From b7c4f572d10db51e6be9c302171bc53a43758a0b Mon Sep 17 00:00:00 2001 From: Vladimir Bragin Date: Sat, 28 Nov 2026 19:43:40 -0600 Subject: [PATCH 1/2] docs(skills): lessons from 2026-11-27/28 (worktree base, submit before review, mutations, patches, stacks, untracked overwrite) - flow-next: fast-forward a new worktree to origin/ before editing, and diff against it. - flow-complete: start a reviewer only after submit printed "Submitted for review"; INVALID_TRANSITION means re-claim or clear the blocker first. - test-driven-development: a mutation that doesn't compile proves nothing. - git-and-diff-workflows: write patches with git diff --output; back up and cmp untracked files that block a switch, never git clean or --force. - merge-pr: retarget a stacked PR to main once its base has merged. Refs scf-ozu1c Co-Authored-By: Claude Opus 5.5 --- .agent/SKILL_INVENTORY.md | 10 +++++----- .agents/skills/flow-complete/SKILL.md | 1 + .agents/skills/flow-next/SKILL.md | 1 + .agents/skills/git-and-diff-workflows/SKILL.md | 7 +++++++ .agents/skills/merge-pr/SKILL.md | 5 +++++ .agents/skills/test-driven-development/SKILL.md | 3 +++ .claude/skills/flow-complete/SKILL.md | 1 + .claude/skills/flow-next/SKILL.md | 1 + .claude/skills/git-and-diff-workflows/SKILL.md | 7 +++++++ .claude/skills/merge-pr/SKILL.md | 5 +++++ .claude/skills/test-driven-development/SKILL.md | 3 +++ .cursor/skills/flow-complete/SKILL.md | 1 + .cursor/skills/flow-next/SKILL.md | 1 + .cursor/skills/git-and-diff-workflows/SKILL.md | 7 +++++++ .cursor/skills/merge-pr/SKILL.md | 5 +++++ .cursor/skills/test-driven-development/SKILL.md | 3 +++ 16 files changed, 56 insertions(+), 5 deletions(-) diff --git a/.agent/SKILL_INVENTORY.md b/.agent/SKILL_INVENTORY.md index 80edd0e..ed66912 100644 --- a/.agent/SKILL_INVENTORY.md +++ b/.agent/SKILL_INVENTORY.md @@ -39,7 +39,7 @@ commands or edit code/config as part of its procedure. | skill-authoring | Create and improve first-party skills with progressive disclosure and eval guidance | L2 | 2026-11-09 | | subagent-review | Review-only external CLI orchestration and structured lightweight decisions (`swarm_decide`) via MCP | L1 | 2026-10-25 | | systematic-debugging | Evidence-first root-cause debugging with reproduce/minimise/hypothesis/regression loop | L2 | 2026-07-14 | -| test-driven-development | Red-green-refactor workflow for behavior changes with practical test seams | L2 | 2026-07-14 | +| test-driven-development | Red-green-refactor workflow for behavior changes with practical test seams | L2 | 2026-11-28 | | rust-testing | Cargo/nextest unit tests beside modules | L2 | 2026-08-14 | | threat-modeling-agentic-tools | Threat-model MCP/tool abuse and injection | L1 | 2026-07-01 | | use-jev | Delegate pending decisions, blocked steps and triage items to Jev in one batched call; act on confident low-risk picks, hand back the rest | L2 | 2026-11-09 | @@ -51,7 +51,7 @@ commands or edit code/config as part of its procedure. | fix-it | Fix the one problem the latest report named: diagnose read-only, back up before overwriting, smallest reversible fix, verify what the user sees, report with an undo path. Triggered by /fix-it or "fix it" after a report | L2 | 2026-11-21 | | step-back | Recover the ticket's goal, criteria and scope, review the diff against them in both directions, re-plan via next-steps | L2 | 2026-11-19 | | ship-pr | Take one PR from open to merged: fix CI failures at the root cause, wait for green on the exact head commit, merge, verify. User-typed only; `--no-ci` gates locally when CI exists but can't run; remedies for workflows that never ran and repository-setting failures | L2 | 2026-11-28 | -| merge-pr | Merge one PR without fixing anything: CI already green on the exact head commit; Actions could not start (billing, spending limit, minutes), with the workflow steps replayed locally; a mix of the two; or no CI at all, with the declared checks run locally. Merge pinned to the head commit. User-typed only | L2 | 2026-11-21 | +| merge-pr | Merge one PR without fixing anything: CI already green on the exact head commit; Actions could not start (billing, spending limit, minutes), with the workflow steps replayed locally; a mix of the two; or no CI at all, with the declared checks run locally. Merge pinned to the head commit. User-typed only | L2 | 2026-11-28 | | validate-implementation | Per-AC Verified/Failed/Unknown verdicts with evidence (**compiled harness**) | L2 | 2026-07-19 | | verification-before-completion | Evidence-backed completion claims with fresh command proof (**compiled harness**) | L1 | 2026-11-04 | @@ -62,7 +62,7 @@ commands or edit code/config as part of its procedure. | search-tool-selection | Choose fd vs rg vs ast-grep vs fff MCP vs Graphify vs IDE search (**compiled harness**) | L1 | 2026-07-21 | | safe-command-patterns | Bounded output, inspect-before-edit, confirmation gates | L1 | 2026-07-03 | | search-and-navigation | rg, fd, bat, tree, navigation | L1 | 2026-07-03 | -| git-and-diff-workflows | git, gh, bounded diffs | L1 | 2026-11-09 | +| git-and-diff-workflows | git, gh, bounded diffs | L1 | 2026-11-28 | | cli-tools-overview | Router for CLI skills + shared references (install-tiers, agent-environment) | L1 | 2026-07-04 | | task-env-package-tools | Task runners, sync/frontmatter/pytest gates (**compiled harness**) | L1 | 2026-07-21 | | structural-code-search | ast-grep, semgrep, ctags | L1 | 2026-07-03 | @@ -118,10 +118,10 @@ specializations remain authoritative. Review notes and trigger cases are in | external-gemini-review | Gemini-only external review | L1 | 2026-07-01 | | pr-ready-hygiene | Definition-of-done checks and paste-ready PR text | L2 | 2026-07-01 | | agent-flow | Core rules for projects tracked by agent-flow (`.agent-flow/`): ready queue, claims, evidence, handoffs | L1 | 2026-11-06 | -| flow-complete | Finish an agent-flow ticket: DoD, push, PR, handoff, submit for review | L2 | 2026-11-06 | +| flow-complete | Finish an agent-flow ticket: DoD, push, PR, handoff, submit for review | L2 | 2026-11-28 | | flow-land | End-of-session handoff for agent-flow tickets | L1 | 2026-11-06 | | flow-loop | Capped autonomous agent-flow ticket loop under a run contract; explicit invocation only | L2 | 2026-11-06 | -| flow-next | Claim the next ready agent-flow ticket and set up its branch or worktree | L1 | 2026-11-06 | +| flow-next | Claim the next ready agent-flow ticket and set up its branch or worktree | L1 | 2026-11-28 | | flow-plan | Turn a request or spec into agent-flow tickets with dependencies | L1 | 2026-11-27 | | flow-review | Review an agent-flow ticket against its acceptance criteria | L2 | 2026-11-06 | | flow-status | Read-only agent-flow board summary | L1 | 2026-11-06 | diff --git a/.agents/skills/flow-complete/SKILL.md b/.agents/skills/flow-complete/SKILL.md index 87c1eab..1888065 100644 --- a/.agents/skills/flow-complete/SKILL.md +++ b/.agents/skills/flow-complete/SKILL.md @@ -31,4 +31,5 @@ risk_class: medium ``` 6. **Submit.** Run `agent-flow submit `. It re-runs the DoD and moves the ticket to `review`. - `GATE_FAILED` tells you exactly what is missing. Fix it and submit again. + - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't record a verdict, and a second one duplicates the review. 7. Report the PR URL and the ticket state. Do **not** approve your own ticket. A reviewer does that: `flow-review`, the `flow-reviewer` agent, the swarm, or a human. diff --git a/.agents/skills/flow-next/SKILL.md b/.agents/skills/flow-next/SKILL.md index 5254cf3..a9da4e8 100644 --- a/.agents/skills/flow-next/SKILL.md +++ b/.agents/skills/flow-next/SKILL.md @@ -25,6 +25,7 @@ Arguments: `$ARGUMENTS`, either a ticket id or filters like `--label agent-ok -- 4. **Set up the workspace on the returned `branch`.** - Single agent: `git switch -c `, or `git switch ` if it already exists. - Parallel agents: `agent-flow worktree create `, then work inside the printed path. Worktrees are created one at a time. + - Before editing, `git fetch` and `git merge --ff-only origin/` in the worktree, and diff against `origin/`. The worktree starts from the local base branch, which can be many commits behind, and diffs against it look far larger than the change. 5. **Load the context.** Run `agent-flow show ` and read: - the spec, - the scope paths, diff --git a/.agents/skills/git-and-diff-workflows/SKILL.md b/.agents/skills/git-and-diff-workflows/SKILL.md index 4e71c90..7c2499b 100644 --- a/.agents/skills/git-and-diff-workflows/SKILL.md +++ b/.agents/skills/git-and-diff-workflows/SKILL.md @@ -62,6 +62,13 @@ gitleaks detect --source . --no-git -v 2>/dev/null | head -50 separate temporary worktree. Don't stash: `git stash` + `git stash pop` drops what you staged, including `git rm` deletions, so the next commit can come out empty. If you must stash, use `git stash pop --index`. Either way, confirm `git diff --cached --stat` shows your change before you commit. +- **Moving uncommitted changes to another branch or worktree:** write the patch with + `git diff --output=`, then `git apply --3way `. Agent shells merge stderr into stdout, so a + piped `git diff > file` can pick up CRLF warnings and fail with "corrupt patch". +- **"Untracked working tree files would be overwritten" on a switch:** the branch now tracks files you + have untracked copies of. Back them up outside the repo, confirm each copy with `cmp`, and copy again if + a live writer (a tracker export, a running app) changed one meanwhile. Only then remove them and + switch. Never `git clean` or `switch --force`: the untracked copy can hold the only local data. - See [bounded-output-patterns.md](../cli-tools-overview/references/bounded-output-patterns.md). ## Commands Requiring Confirmation diff --git a/.agents/skills/merge-pr/SKILL.md b/.agents/skills/merge-pr/SKILL.md index 0bdefd6..b1a04fc 100644 --- a/.agents/skills/merge-pr/SKILL.md +++ b/.agents/skills/merge-pr/SKILL.md @@ -207,6 +207,11 @@ Immediately before merging, re-read the PR and confirm: - the runs for `` still show the case from step 2: all green, only the not-started cause, the same mix of passed and not-started runs, or, when CI never triggered or there is none, still none. +**Stacked PRs:** once a PR's base branch has merged, retarget it before merging: +`gh pr edit --base main`. GitHub only retargets a child itself when the merged parent branch is +deleted; otherwise the child merges into a branch that is already merged and its change never reaches +`main`. + Use the merge method the repository's recent PRs used, pinned to the checked commit: ```bash diff --git a/.agents/skills/test-driven-development/SKILL.md b/.agents/skills/test-driven-development/SKILL.md index 6c57a91..53a1fd6 100644 --- a/.agents/skills/test-driven-development/SKILL.md +++ b/.agents/skills/test-driven-development/SKILL.md @@ -86,6 +86,9 @@ Avoid tests that: - Keep each red/green step small enough to explain in the final response. - If a failing test exposes an unrelated pre-existing issue, narrow the command or document the blocker before changing scope. +- **Proving a test catches a regression** (break the fix, expect red): check that the mutated code + compiled and that the failure is that test's assertion. A compile error proves nothing. Mutate in a + scratch copy, or restore the file and confirm `git status` is clean before you claim the result. ## Red flags diff --git a/.claude/skills/flow-complete/SKILL.md b/.claude/skills/flow-complete/SKILL.md index 87c1eab..1888065 100644 --- a/.claude/skills/flow-complete/SKILL.md +++ b/.claude/skills/flow-complete/SKILL.md @@ -31,4 +31,5 @@ risk_class: medium ``` 6. **Submit.** Run `agent-flow submit `. It re-runs the DoD and moves the ticket to `review`. - `GATE_FAILED` tells you exactly what is missing. Fix it and submit again. + - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't record a verdict, and a second one duplicates the review. 7. Report the PR URL and the ticket state. Do **not** approve your own ticket. A reviewer does that: `flow-review`, the `flow-reviewer` agent, the swarm, or a human. diff --git a/.claude/skills/flow-next/SKILL.md b/.claude/skills/flow-next/SKILL.md index 5254cf3..a9da4e8 100644 --- a/.claude/skills/flow-next/SKILL.md +++ b/.claude/skills/flow-next/SKILL.md @@ -25,6 +25,7 @@ Arguments: `$ARGUMENTS`, either a ticket id or filters like `--label agent-ok -- 4. **Set up the workspace on the returned `branch`.** - Single agent: `git switch -c `, or `git switch ` if it already exists. - Parallel agents: `agent-flow worktree create `, then work inside the printed path. Worktrees are created one at a time. + - Before editing, `git fetch` and `git merge --ff-only origin/` in the worktree, and diff against `origin/`. The worktree starts from the local base branch, which can be many commits behind, and diffs against it look far larger than the change. 5. **Load the context.** Run `agent-flow show ` and read: - the spec, - the scope paths, diff --git a/.claude/skills/git-and-diff-workflows/SKILL.md b/.claude/skills/git-and-diff-workflows/SKILL.md index 4e71c90..7c2499b 100644 --- a/.claude/skills/git-and-diff-workflows/SKILL.md +++ b/.claude/skills/git-and-diff-workflows/SKILL.md @@ -62,6 +62,13 @@ gitleaks detect --source . --no-git -v 2>/dev/null | head -50 separate temporary worktree. Don't stash: `git stash` + `git stash pop` drops what you staged, including `git rm` deletions, so the next commit can come out empty. If you must stash, use `git stash pop --index`. Either way, confirm `git diff --cached --stat` shows your change before you commit. +- **Moving uncommitted changes to another branch or worktree:** write the patch with + `git diff --output=`, then `git apply --3way `. Agent shells merge stderr into stdout, so a + piped `git diff > file` can pick up CRLF warnings and fail with "corrupt patch". +- **"Untracked working tree files would be overwritten" on a switch:** the branch now tracks files you + have untracked copies of. Back them up outside the repo, confirm each copy with `cmp`, and copy again if + a live writer (a tracker export, a running app) changed one meanwhile. Only then remove them and + switch. Never `git clean` or `switch --force`: the untracked copy can hold the only local data. - See [bounded-output-patterns.md](../cli-tools-overview/references/bounded-output-patterns.md). ## Commands Requiring Confirmation diff --git a/.claude/skills/merge-pr/SKILL.md b/.claude/skills/merge-pr/SKILL.md index 0bdefd6..b1a04fc 100644 --- a/.claude/skills/merge-pr/SKILL.md +++ b/.claude/skills/merge-pr/SKILL.md @@ -207,6 +207,11 @@ Immediately before merging, re-read the PR and confirm: - the runs for `` still show the case from step 2: all green, only the not-started cause, the same mix of passed and not-started runs, or, when CI never triggered or there is none, still none. +**Stacked PRs:** once a PR's base branch has merged, retarget it before merging: +`gh pr edit --base main`. GitHub only retargets a child itself when the merged parent branch is +deleted; otherwise the child merges into a branch that is already merged and its change never reaches +`main`. + Use the merge method the repository's recent PRs used, pinned to the checked commit: ```bash diff --git a/.claude/skills/test-driven-development/SKILL.md b/.claude/skills/test-driven-development/SKILL.md index 6c57a91..53a1fd6 100644 --- a/.claude/skills/test-driven-development/SKILL.md +++ b/.claude/skills/test-driven-development/SKILL.md @@ -86,6 +86,9 @@ Avoid tests that: - Keep each red/green step small enough to explain in the final response. - If a failing test exposes an unrelated pre-existing issue, narrow the command or document the blocker before changing scope. +- **Proving a test catches a regression** (break the fix, expect red): check that the mutated code + compiled and that the failure is that test's assertion. A compile error proves nothing. Mutate in a + scratch copy, or restore the file and confirm `git status` is clean before you claim the result. ## Red flags diff --git a/.cursor/skills/flow-complete/SKILL.md b/.cursor/skills/flow-complete/SKILL.md index 87c1eab..1888065 100644 --- a/.cursor/skills/flow-complete/SKILL.md +++ b/.cursor/skills/flow-complete/SKILL.md @@ -31,4 +31,5 @@ risk_class: medium ``` 6. **Submit.** Run `agent-flow submit `. It re-runs the DoD and moves the ticket to `review`. - `GATE_FAILED` tells you exactly what is missing. Fix it and submit again. + - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't record a verdict, and a second one duplicates the review. 7. Report the PR URL and the ticket state. Do **not** approve your own ticket. A reviewer does that: `flow-review`, the `flow-reviewer` agent, the swarm, or a human. diff --git a/.cursor/skills/flow-next/SKILL.md b/.cursor/skills/flow-next/SKILL.md index 5254cf3..a9da4e8 100644 --- a/.cursor/skills/flow-next/SKILL.md +++ b/.cursor/skills/flow-next/SKILL.md @@ -25,6 +25,7 @@ Arguments: `$ARGUMENTS`, either a ticket id or filters like `--label agent-ok -- 4. **Set up the workspace on the returned `branch`.** - Single agent: `git switch -c `, or `git switch ` if it already exists. - Parallel agents: `agent-flow worktree create `, then work inside the printed path. Worktrees are created one at a time. + - Before editing, `git fetch` and `git merge --ff-only origin/` in the worktree, and diff against `origin/`. The worktree starts from the local base branch, which can be many commits behind, and diffs against it look far larger than the change. 5. **Load the context.** Run `agent-flow show ` and read: - the spec, - the scope paths, diff --git a/.cursor/skills/git-and-diff-workflows/SKILL.md b/.cursor/skills/git-and-diff-workflows/SKILL.md index 4e71c90..7c2499b 100644 --- a/.cursor/skills/git-and-diff-workflows/SKILL.md +++ b/.cursor/skills/git-and-diff-workflows/SKILL.md @@ -62,6 +62,13 @@ gitleaks detect --source . --no-git -v 2>/dev/null | head -50 separate temporary worktree. Don't stash: `git stash` + `git stash pop` drops what you staged, including `git rm` deletions, so the next commit can come out empty. If you must stash, use `git stash pop --index`. Either way, confirm `git diff --cached --stat` shows your change before you commit. +- **Moving uncommitted changes to another branch or worktree:** write the patch with + `git diff --output=`, then `git apply --3way `. Agent shells merge stderr into stdout, so a + piped `git diff > file` can pick up CRLF warnings and fail with "corrupt patch". +- **"Untracked working tree files would be overwritten" on a switch:** the branch now tracks files you + have untracked copies of. Back them up outside the repo, confirm each copy with `cmp`, and copy again if + a live writer (a tracker export, a running app) changed one meanwhile. Only then remove them and + switch. Never `git clean` or `switch --force`: the untracked copy can hold the only local data. - See [bounded-output-patterns.md](../cli-tools-overview/references/bounded-output-patterns.md). ## Commands Requiring Confirmation diff --git a/.cursor/skills/merge-pr/SKILL.md b/.cursor/skills/merge-pr/SKILL.md index 0bdefd6..b1a04fc 100644 --- a/.cursor/skills/merge-pr/SKILL.md +++ b/.cursor/skills/merge-pr/SKILL.md @@ -207,6 +207,11 @@ Immediately before merging, re-read the PR and confirm: - the runs for `` still show the case from step 2: all green, only the not-started cause, the same mix of passed and not-started runs, or, when CI never triggered or there is none, still none. +**Stacked PRs:** once a PR's base branch has merged, retarget it before merging: +`gh pr edit --base main`. GitHub only retargets a child itself when the merged parent branch is +deleted; otherwise the child merges into a branch that is already merged and its change never reaches +`main`. + Use the merge method the repository's recent PRs used, pinned to the checked commit: ```bash diff --git a/.cursor/skills/test-driven-development/SKILL.md b/.cursor/skills/test-driven-development/SKILL.md index 6c57a91..53a1fd6 100644 --- a/.cursor/skills/test-driven-development/SKILL.md +++ b/.cursor/skills/test-driven-development/SKILL.md @@ -86,6 +86,9 @@ Avoid tests that: - Keep each red/green step small enough to explain in the final response. - If a failing test exposes an unrelated pre-existing issue, narrow the command or document the blocker before changing scope. +- **Proving a test catches a regression** (break the fix, expect red): check that the mutated code + compiled and that the failure is that test's assertion. A compile error proves nothing. Mutate in a + scratch copy, or restore the file and confirm `git status` is clean before you claim the result. ## Red flags From 8f2f385d78242ad8a7e120f70d2e0bace9666eda Mon Sep 17 00:00:00 2001 From: Vladimir Bragin Date: Sat, 28 Nov 2026 20:01:44 -0600 Subject: [PATCH 2/2] docs(skills): address review of scf-ozu1c lessons Correct the patch lesson's cause (redirect re-encoding or 2>&1 warnings), cut four bullets to two lines, and say an early reviewer can't get a brief or approve. Refs scf-ozu1c Co-Authored-By: Claude Opus 5.5 --- .agents/skills/flow-complete/SKILL.md | 2 +- .agents/skills/git-and-diff-workflows/SKILL.md | 11 ++++------- .agents/skills/merge-pr/SKILL.md | 6 ++---- .agents/skills/test-driven-development/SKILL.md | 5 ++--- .claude/skills/flow-complete/SKILL.md | 2 +- .claude/skills/git-and-diff-workflows/SKILL.md | 11 ++++------- .claude/skills/merge-pr/SKILL.md | 6 ++---- .claude/skills/test-driven-development/SKILL.md | 5 ++--- .cursor/skills/flow-complete/SKILL.md | 2 +- .cursor/skills/git-and-diff-workflows/SKILL.md | 11 ++++------- .cursor/skills/merge-pr/SKILL.md | 6 ++---- .cursor/skills/test-driven-development/SKILL.md | 5 ++--- 12 files changed, 27 insertions(+), 45 deletions(-) diff --git a/.agents/skills/flow-complete/SKILL.md b/.agents/skills/flow-complete/SKILL.md index 1888065..1d3877a 100644 --- a/.agents/skills/flow-complete/SKILL.md +++ b/.agents/skills/flow-complete/SKILL.md @@ -31,5 +31,5 @@ risk_class: medium ``` 6. **Submit.** Run `agent-flow submit `. It re-runs the DoD and moves the ticket to `review`. - `GATE_FAILED` tells you exactly what is missing. Fix it and submit again. - - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't record a verdict, and a second one duplicates the review. + - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't get a review brief or approve, and a second one duplicates the review. 7. Report the PR URL and the ticket state. Do **not** approve your own ticket. A reviewer does that: `flow-review`, the `flow-reviewer` agent, the swarm, or a human. diff --git a/.agents/skills/git-and-diff-workflows/SKILL.md b/.agents/skills/git-and-diff-workflows/SKILL.md index 7c2499b..69ee897 100644 --- a/.agents/skills/git-and-diff-workflows/SKILL.md +++ b/.agents/skills/git-and-diff-workflows/SKILL.md @@ -62,13 +62,10 @@ gitleaks detect --source . --no-git -v 2>/dev/null | head -50 separate temporary worktree. Don't stash: `git stash` + `git stash pop` drops what you staged, including `git rm` deletions, so the next commit can come out empty. If you must stash, use `git stash pop --index`. Either way, confirm `git diff --cached --stat` shows your change before you commit. -- **Moving uncommitted changes to another branch or worktree:** write the patch with - `git diff --output=`, then `git apply --3way `. Agent shells merge stderr into stdout, so a - piped `git diff > file` can pick up CRLF warnings and fail with "corrupt patch". -- **"Untracked working tree files would be overwritten" on a switch:** the branch now tracks files you - have untracked copies of. Back them up outside the repo, confirm each copy with `cmp`, and copy again if - a live writer (a tracker export, a running app) changed one meanwhile. Only then remove them and - switch. Never `git clean` or `switch --force`: the untracked copy can hold the only local data. +- **Moving uncommitted changes to another worktree:** `git diff --output=`, then `git apply --3way `. + A shell redirect can re-encode the patch (PowerShell 5.1 writes UTF-16) or mix in `2>&1` warnings. +- **"Untracked working tree files would be overwritten":** back them up outside the repo, `cmp` each copy + (recopy if a live writer changed it), then remove and switch. Never `git clean` or `--force`: it may be the only copy. - See [bounded-output-patterns.md](../cli-tools-overview/references/bounded-output-patterns.md). ## Commands Requiring Confirmation diff --git a/.agents/skills/merge-pr/SKILL.md b/.agents/skills/merge-pr/SKILL.md index b1a04fc..0c9220b 100644 --- a/.agents/skills/merge-pr/SKILL.md +++ b/.agents/skills/merge-pr/SKILL.md @@ -207,10 +207,8 @@ Immediately before merging, re-read the PR and confirm: - the runs for `` still show the case from step 2: all green, only the not-started cause, the same mix of passed and not-started runs, or, when CI never triggered or there is none, still none. -**Stacked PRs:** once a PR's base branch has merged, retarget it before merging: -`gh pr edit --base main`. GitHub only retargets a child itself when the merged parent branch is -deleted; otherwise the child merges into a branch that is already merged and its change never reaches -`main`. +**Stacked PRs:** after the base PR merges, run `gh pr edit --base main`; unless the parent branch was +deleted, the child would merge into the merged branch and never reach `main`. Use the merge method the repository's recent PRs used, pinned to the checked commit: diff --git a/.agents/skills/test-driven-development/SKILL.md b/.agents/skills/test-driven-development/SKILL.md index 53a1fd6..600c76c 100644 --- a/.agents/skills/test-driven-development/SKILL.md +++ b/.agents/skills/test-driven-development/SKILL.md @@ -86,9 +86,8 @@ Avoid tests that: - Keep each red/green step small enough to explain in the final response. - If a failing test exposes an unrelated pre-existing issue, narrow the command or document the blocker before changing scope. -- **Proving a test catches a regression** (break the fix, expect red): check that the mutated code - compiled and that the failure is that test's assertion. A compile error proves nothing. Mutate in a - scratch copy, or restore the file and confirm `git status` is clean before you claim the result. +- **Proving a test catches a regression:** the mutated code must compile and fail on that test's assertion + (a compile error proves nothing); restore it and confirm `git status` is clean before claiming the result. ## Red flags diff --git a/.claude/skills/flow-complete/SKILL.md b/.claude/skills/flow-complete/SKILL.md index 1888065..1d3877a 100644 --- a/.claude/skills/flow-complete/SKILL.md +++ b/.claude/skills/flow-complete/SKILL.md @@ -31,5 +31,5 @@ risk_class: medium ``` 6. **Submit.** Run `agent-flow submit `. It re-runs the DoD and moves the ticket to `review`. - `GATE_FAILED` tells you exactly what is missing. Fix it and submit again. - - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't record a verdict, and a second one duplicates the review. + - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't get a review brief or approve, and a second one duplicates the review. 7. Report the PR URL and the ticket state. Do **not** approve your own ticket. A reviewer does that: `flow-review`, the `flow-reviewer` agent, the swarm, or a human. diff --git a/.claude/skills/git-and-diff-workflows/SKILL.md b/.claude/skills/git-and-diff-workflows/SKILL.md index 7c2499b..69ee897 100644 --- a/.claude/skills/git-and-diff-workflows/SKILL.md +++ b/.claude/skills/git-and-diff-workflows/SKILL.md @@ -62,13 +62,10 @@ gitleaks detect --source . --no-git -v 2>/dev/null | head -50 separate temporary worktree. Don't stash: `git stash` + `git stash pop` drops what you staged, including `git rm` deletions, so the next commit can come out empty. If you must stash, use `git stash pop --index`. Either way, confirm `git diff --cached --stat` shows your change before you commit. -- **Moving uncommitted changes to another branch or worktree:** write the patch with - `git diff --output=`, then `git apply --3way `. Agent shells merge stderr into stdout, so a - piped `git diff > file` can pick up CRLF warnings and fail with "corrupt patch". -- **"Untracked working tree files would be overwritten" on a switch:** the branch now tracks files you - have untracked copies of. Back them up outside the repo, confirm each copy with `cmp`, and copy again if - a live writer (a tracker export, a running app) changed one meanwhile. Only then remove them and - switch. Never `git clean` or `switch --force`: the untracked copy can hold the only local data. +- **Moving uncommitted changes to another worktree:** `git diff --output=`, then `git apply --3way `. + A shell redirect can re-encode the patch (PowerShell 5.1 writes UTF-16) or mix in `2>&1` warnings. +- **"Untracked working tree files would be overwritten":** back them up outside the repo, `cmp` each copy + (recopy if a live writer changed it), then remove and switch. Never `git clean` or `--force`: it may be the only copy. - See [bounded-output-patterns.md](../cli-tools-overview/references/bounded-output-patterns.md). ## Commands Requiring Confirmation diff --git a/.claude/skills/merge-pr/SKILL.md b/.claude/skills/merge-pr/SKILL.md index b1a04fc..0c9220b 100644 --- a/.claude/skills/merge-pr/SKILL.md +++ b/.claude/skills/merge-pr/SKILL.md @@ -207,10 +207,8 @@ Immediately before merging, re-read the PR and confirm: - the runs for `` still show the case from step 2: all green, only the not-started cause, the same mix of passed and not-started runs, or, when CI never triggered or there is none, still none. -**Stacked PRs:** once a PR's base branch has merged, retarget it before merging: -`gh pr edit --base main`. GitHub only retargets a child itself when the merged parent branch is -deleted; otherwise the child merges into a branch that is already merged and its change never reaches -`main`. +**Stacked PRs:** after the base PR merges, run `gh pr edit --base main`; unless the parent branch was +deleted, the child would merge into the merged branch and never reach `main`. Use the merge method the repository's recent PRs used, pinned to the checked commit: diff --git a/.claude/skills/test-driven-development/SKILL.md b/.claude/skills/test-driven-development/SKILL.md index 53a1fd6..600c76c 100644 --- a/.claude/skills/test-driven-development/SKILL.md +++ b/.claude/skills/test-driven-development/SKILL.md @@ -86,9 +86,8 @@ Avoid tests that: - Keep each red/green step small enough to explain in the final response. - If a failing test exposes an unrelated pre-existing issue, narrow the command or document the blocker before changing scope. -- **Proving a test catches a regression** (break the fix, expect red): check that the mutated code - compiled and that the failure is that test's assertion. A compile error proves nothing. Mutate in a - scratch copy, or restore the file and confirm `git status` is clean before you claim the result. +- **Proving a test catches a regression:** the mutated code must compile and fail on that test's assertion + (a compile error proves nothing); restore it and confirm `git status` is clean before claiming the result. ## Red flags diff --git a/.cursor/skills/flow-complete/SKILL.md b/.cursor/skills/flow-complete/SKILL.md index 1888065..1d3877a 100644 --- a/.cursor/skills/flow-complete/SKILL.md +++ b/.cursor/skills/flow-complete/SKILL.md @@ -31,5 +31,5 @@ risk_class: medium ``` 6. **Submit.** Run `agent-flow submit `. It re-runs the DoD and moves the ticket to `review`. - `GATE_FAILED` tells you exactly what is missing. Fix it and submit again. - - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't record a verdict, and a second one duplicates the review. + - Confirm it printed `Submitted for review` before asking for a review. `INVALID_TRANSITION` (the ticket is still `ready` because a dependency blocks it, or the lease lapsed) means re-claim or clear the blocker, then submit again. A reviewer started earlier can't get a review brief or approve, and a second one duplicates the review. 7. Report the PR URL and the ticket state. Do **not** approve your own ticket. A reviewer does that: `flow-review`, the `flow-reviewer` agent, the swarm, or a human. diff --git a/.cursor/skills/git-and-diff-workflows/SKILL.md b/.cursor/skills/git-and-diff-workflows/SKILL.md index 7c2499b..69ee897 100644 --- a/.cursor/skills/git-and-diff-workflows/SKILL.md +++ b/.cursor/skills/git-and-diff-workflows/SKILL.md @@ -62,13 +62,10 @@ gitleaks detect --source . --no-git -v 2>/dev/null | head -50 separate temporary worktree. Don't stash: `git stash` + `git stash pop` drops what you staged, including `git rm` deletions, so the next commit can come out empty. If you must stash, use `git stash pop --index`. Either way, confirm `git diff --cached --stat` shows your change before you commit. -- **Moving uncommitted changes to another branch or worktree:** write the patch with - `git diff --output=`, then `git apply --3way `. Agent shells merge stderr into stdout, so a - piped `git diff > file` can pick up CRLF warnings and fail with "corrupt patch". -- **"Untracked working tree files would be overwritten" on a switch:** the branch now tracks files you - have untracked copies of. Back them up outside the repo, confirm each copy with `cmp`, and copy again if - a live writer (a tracker export, a running app) changed one meanwhile. Only then remove them and - switch. Never `git clean` or `switch --force`: the untracked copy can hold the only local data. +- **Moving uncommitted changes to another worktree:** `git diff --output=`, then `git apply --3way `. + A shell redirect can re-encode the patch (PowerShell 5.1 writes UTF-16) or mix in `2>&1` warnings. +- **"Untracked working tree files would be overwritten":** back them up outside the repo, `cmp` each copy + (recopy if a live writer changed it), then remove and switch. Never `git clean` or `--force`: it may be the only copy. - See [bounded-output-patterns.md](../cli-tools-overview/references/bounded-output-patterns.md). ## Commands Requiring Confirmation diff --git a/.cursor/skills/merge-pr/SKILL.md b/.cursor/skills/merge-pr/SKILL.md index b1a04fc..0c9220b 100644 --- a/.cursor/skills/merge-pr/SKILL.md +++ b/.cursor/skills/merge-pr/SKILL.md @@ -207,10 +207,8 @@ Immediately before merging, re-read the PR and confirm: - the runs for `` still show the case from step 2: all green, only the not-started cause, the same mix of passed and not-started runs, or, when CI never triggered or there is none, still none. -**Stacked PRs:** once a PR's base branch has merged, retarget it before merging: -`gh pr edit --base main`. GitHub only retargets a child itself when the merged parent branch is -deleted; otherwise the child merges into a branch that is already merged and its change never reaches -`main`. +**Stacked PRs:** after the base PR merges, run `gh pr edit --base main`; unless the parent branch was +deleted, the child would merge into the merged branch and never reach `main`. Use the merge method the repository's recent PRs used, pinned to the checked commit: diff --git a/.cursor/skills/test-driven-development/SKILL.md b/.cursor/skills/test-driven-development/SKILL.md index 53a1fd6..600c76c 100644 --- a/.cursor/skills/test-driven-development/SKILL.md +++ b/.cursor/skills/test-driven-development/SKILL.md @@ -86,9 +86,8 @@ Avoid tests that: - Keep each red/green step small enough to explain in the final response. - If a failing test exposes an unrelated pre-existing issue, narrow the command or document the blocker before changing scope. -- **Proving a test catches a regression** (break the fix, expect red): check that the mutated code - compiled and that the failure is that test's assertion. A compile error proves nothing. Mutate in a - scratch copy, or restore the file and confirm `git status` is clean before you claim the result. +- **Proving a test catches a regression:** the mutated code must compile and fail on that test's assertion + (a compile error proves nothing); restore it and confirm `git status` is clean before claiming the result. ## Red flags