Skip to content

feat(git-commit-push-pr): pre-resolve context to reduce bash calls#488

Merged
tmchow merged 3 commits intomainfrom
tmchow/preresolved-git-context
Apr 2, 2026
Merged

feat(git-commit-push-pr): pre-resolve context to reduce bash calls#488
tmchow merged 3 commits intomainfrom
tmchow/preresolved-git-context

Conversation

@tmchow
Copy link
Copy Markdown
Collaborator

@tmchow tmchow commented Apr 2, 2026

Summary

Reduces the number of individual bash calls in the git-commit-push-pr and git-commit skills by pre-resolving read-only context on Claude Code and chaining commands elsewhere.

The screenshot that motivated this: a typical "ship this" invocation was producing 9 separate bash tool calls — the first 4-5 were pure info-gathering (git status, diff, branch, log, default branch, PR check) that could be eliminated or consolidated.

Approach

Claude Code path: A new ## Context section uses ! backtick pre-resolution to populate git status, working tree diff, current branch, recent commits, remote default branch, and (for git-commit-push-pr) existing PR check before the skill body executes. The model sees populated data and uses it directly — zero bash calls for context gathering.

Non-CC path: The same section gates with "If you are not Claude Code, skip to Context fallback" at the top, directing to a single combined command that gathers all context in one bash call. The fallback section has a reciprocal gate ("If you are Claude Code, skip this section") so CC doesn't redundantly run it.

Action-phase optimizations (all platforms):

  • Stage + commit chained into one call per commit group (git add && git commit)
  • Step 6 scope gathering in git-commit-push-pr (verify ref, merge-base, log, diff) consolidated from 4 separate code blocks to 2
Phase Before After (CC) After (non-CC)
Context gathering 5-6 calls 0 1
Stage + commit 2 calls 1 1
Scope gathering (PR skill only) 4-5 calls 2 2

Compound Engineering
🤖 Generated with Claude Opus 4.6 (1M context) via Claude Code

On Claude Code, use !backtick pre-resolution to populate git status,
diff, branch, log, default branch, and PR check before the skill
executes — eliminating 6 bash calls and their permission prompts.
Non-CC platforms get a single fallback command that gathers all
context in one call. Also chains stage+commit and scope-gathering
commands to reduce action-phase calls.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b744f39171

ℹ️ 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".

Comment thread plugins/compound-engineering/skills/git-commit-push-pr/SKILL.md Outdated
Same pattern as git-commit-push-pr: on Claude Code, use !backtick
pre-resolution for git status, diff, branch, log, and default branch.
Non-CC platforms get a single fallback command. Also chains
stage+commit into one call per commit group.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 261c28f675

ℹ️ 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".

Comment thread plugins/compound-engineering/skills/git-commit/SKILL.md Outdated
The && chaining between context probes meant git branch and git log
were skipped if git diff HEAD failed (e.g., first-commit repos where
HEAD is unresolved). Switch to semicolons so all probes run
independently regardless of earlier failures.

Addresses PR review feedback on #488.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tmchow tmchow merged commit bbd4f6d into main Apr 2, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant