fix: harden git workflow skills with better state handling#406
Merged
Conversation
added 8 commits
March 26, 2026 23:21
… branches gh pr view exits 1 when no PR exists, surfacing a misleading error. gh pr list always exits 0 and its default --state open filter handles closed/merged PRs automatically. Also adds explicit detached HEAD handling.
…ions The command prefix was intended to bypass RTK proxies, but RTK operates as a Claude Code hook (not a shell alias), so command never bypassed it. Aligns these three skills with the rest of the plugin which uses bare git/gh.
Allows triggering the skill with "update the PR description" or similar phrases to refresh an existing PR description without committing or pushing. Supports an optional focus instruction (e.g., "add benchmarking results"). Confirms intent, summarizes changes, and asks before applying.
Update git-commit-push-pr to ask before creating a branch when detached HEAD blocks push/PR flow.\nAdd matching detached HEAD guidance to git-commit and refresh the README skill description.
…h-pr Move detached HEAD detection into Step 1 so it runs before both the no-changes shortcut and the PR check. The no-changes path now checks for unpushed commits and missing PRs before stopping, so the skill can push and create a PR even when there's nothing new to commit.
Rewrite git-commit and git-commit-push-pr around explicit branch and upstream re-checks. Clarify detached HEAD, clean working tree, default branch, and existing PR flows to avoid stale state and invalid branch/PR transitions.
Refine gh pr view handling in git-commit-push-pr so the no-PR case is treated as expected state. Add a compounded learning doc covering the detached HEAD, upstream, default-branch, untracked-file, and PR-detection pitfalls discovered while hardening the git workflow skills.
Clarify the PR description writing guidance so contradictory commit messages are treated as intermediate history and the full branch diff remains the source of truth for what shipped.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 239f3bcc4f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
plugins/compound-engineering/skills/git-commit-push-pr/SKILL.md
Outdated
Show resolved
Hide resolved
plugins/compound-engineering/skills/git-commit-push-pr/SKILL.md
Outdated
Show resolved
Hide resolved
gh pr view can return CLOSED/MERGED PRs on reused branches. Without the state gate, the skill skips PR creation or edits the wrong PR. Restores the check in both the full workflow (Step 3) and the description-update flow (DU-2). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three git workflow skills accumulated state-handling gaps: detached HEAD could fall through to invalid push/PR paths, a clean working tree was treated as "nothing to do" even when commits needed pushing or a PR needed creating, and the
commandprefix convention didn't actually bypass RTK (it operates as a Claude Code hook, not a shell alias).Changes
git-commit(Step 1) andgit-commit-push-pr(Step 1). Detached HEAD is caught before any commit/push logic runs, with an offer to create a feature branch.git-commit-push-pr): When the working tree is clean, the skill now checks for unpushed commits and missing PRs before stopping. A clean working tree doesn't mean there's nothing to do.git-commit-push-pr):gh pr viewexits 1 when no PR exists, which could surface as misleading error output. Added explicit guidance: "Do not treat every non-zero exit as a fatal error here." The command is unchanged; the interpretation guidance is new.commandprefix: Droppedcommand git/command ghfrom all three skills and theclean-gonescript. RTK is a Claude Code hook that rewrites commands before the shell sees them, socommandnever bypassed it.git-commit-push-pr): The skill can now update an existing PR description without committing. Triggered by phrases like "update the PR description". Confirms intent, summarizes changes, and asks before applying. Supports an optional focus (e.g., "update the PR description and add the benchmarking results").🤖 Generated with Claude Opus 4.6 (1M context, extended thinking) via Claude Code