/ai-git:git-commit-push-pr [--preflight] [--no-pr]from ai-git
Commits changes with a repo-style message, pushes, and opens a PR. Supports --preflight to run checks before committing and --no-pr to stop after push.
Ships in ai-git. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Commit the current changes, push them, and open a pull request. Ask the user where to commit and where the PR should merge, and never assume either.
Ask every question with the AskUserQuestion tool when it's available, so the user can answer with one pick. Otherwise ask in plain text, number the options, and wait for the answer.
The text typed after the command holds the arguments. In Claude Code it is inserted here: $ARGUMENTS. In other agents, read it from the user's message. It may be empty.
--preflight: run the git-preflight skill with --fix before anything else (Step 1).--no-pr: commit and push, then stop without opening a PR.The two can be combined. Ignore anything else in the arguments, including a commit message, and say in one line that you did: the message comes from the diff.
--preflight)Run the git-preflight skill from this plugin with --fix as its arguments. It runs the project's typecheck, lint, format, security and test checks, applies the auto-fixes it can without asking, and re-runs what failed.
ai-git:git-preflight and args --fix.git-preflight skill from this plugin (Codex lists it as ai-git:git-preflight), and follow its instructions with --fix as its arguments.If the skill can't be loaded, stop and tell the user to run /git-preflight --fix ($ai-git:git-preflight --fix in Codex), then run this command again without --preflight.
When preflight finishes:
git branch --show-currentgit status (never -uall, which can exhaust memory on large repos). If there is nothing to commit (no untracked files and no modifications), tell the user and stop.git diff and git diff --staged to see the changes.git log -5 --format='%s' to see the repo's commit message style.Ask where to commit:
main, master or the repo's default branch: don't commit there. Offer:
If the user picks "Create new branch", name it after the change in the style of the repo's branches (feat/..., fix/...). If they typed a name, use it. Then git checkout -b <branch_name>.
Stage the changed files by name. Don't use git add . or git add -A.
Never stage files that look like secrets: .env, .env.*, credentials.*, *.key, *.pem, *.secret and similar. If any are present, skip them and warn the user.
Write a concise commit message that says what changed and why, follows the style from Step 2, and uses conventional commit prefixes (feat:, fix:, docs:) if the repo uses them.
Add no AI attribution to the commit: no Co-Authored-By trailer, no "Generated with" line, and nothing else that credits Claude, Codex, Cursor or another agent.
Pass the message through a HEREDOC:
git commit -m "$(cat <<'EOF'
your commit message here
EOF
)"
git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/nullgit push -u origin <branch>. Otherwise git push.With --no-pr, show the branch and commit hash, and stop here.
Opening a PR needs the GitHub CLI (gh), installed and authenticated. If it isn't, say so and stop: the commit is already pushed.
If the branch already has an open PR (gh pr view --json url,state shows OPEN), the push updated it. Give its URL and stop.
Gather context:
# The repo's default branch
gh repo view --json defaultBranchRef --jq .defaultBranchRef.name
# Whether staging exists on origin
git ls-remote --heads origin staging
Ask where the PR should merge, with options built from what exists:
staging: offer only the default branch.staging exists on origin: "staging" (description: "Merge into staging for pre-production review"), first and recommended, then the default branch (description: "Merge directly into {default}").The user can always type another branch name.
git fetch origin <target>, then git log origin/<target>..HEAD --oneline and git diff origin/<target>...HEAD to see everything the PR includes. Check that it matches the goal of the change, and nothing else.
Write the title and body:
gh pr list --state merged --limit 5 --json title), since PR titles often become commit messages. Say what the change does for the user, not how it works: "Cut websocket message size by about 70% with compression", not "Negotiate permessage-deflate on the websocket".--preflight, commands run in this session, or testing the user described. If nothing was run, write "Not tested" and one sentence on what needs checking.🤖 Generated with [Claude Code](https://claude.com/claude-code) in Claude Code, 🤖 Generated with [Codex](https://openai.com/codex) in Codex, or 🤖 Generated with [Cursor](https://cursor.com) in Cursor.Create it with gh pr create as a real PR, not a draft, so review bots run. Pass the body through a HEREDOC:
gh pr create --base <target> --title "the pr title" --body "$(cat <<'EOF'
## Summary
<the problem, then the fix, in a few sentences>
## Test plan
<what was actually run>
<attribution line for the agent running this skill>
EOF
)"
If it fails because the GitHub GraphQL rate limit is used up, open the PR through the REST API, which has its own limit. Write the body to a file, then run gh api repos/{owner}/{repo}/pulls -f title="<title>" -f head=<branch> -f base=<target> -F body=@<file>.
Give the user the PR URL.
main, master or the default branch.git status -uall.Step 7's guidance on PR titles and descriptions is adapted from file-pr in tstack by Theo Browne (MIT). See THIRD-PARTY-NOTICES.md in this plugin.
What SKILL.md sets; muted values are Claude Code's defaults
3 skills in this plugin
/git-initInitialize .gitignore with exclusion patterns based on your project's technology stack./git-preflightRuns the project's configured typecheck, lint, format, security and test checks and offers to fix what fails. Use when the user asks for preflight checks or to check code before committing, and when /git-commit-push-pr --preflight runs it.npx claudepluginhub charlesjones-dev/ai-agent-plugins --plugin ai-gitOther plugins' skills for the same job