/git-plugin:git-api-pr <files...> --title "type(scope): description"from git-plugin
Creates GitHub PRs from file changes without local git commits. Useful for quick fixes, typos, config updates, or bypassing local git state.
Ships in git-plugin. 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.
None: SKILL.md is the whole skill.
| Use this skill when... | Use /git:commit instead when... |
|---|---|
| Quick fix to 1-3 files (typos, config, docs) | Complex multi-file refactoring |
| Want a clean workflow without local commits | Need local testing before submitting |
| Submitting changes without touching git state | Need pre-commit hooks to run |
| Want to avoid branch creation/switching locally | Need to stage partial file changes |
| File edits are already done, just need the PR | Need interactive staging (git add -p) |
git remote -vgit config --default '' --get init.defaultBranchgh auth statuspwdParse these from $ARGUMENTS:
| Parameter | Required | Description |
|---|---|---|
$@ (positional) | Yes | One or more file paths to create/update in the repo |
--title <text> | Yes | PR title — use conventional commit format |
--base <branch> | No | Base branch (default: repo default branch from context) |
--branch <name> | No | New branch name (auto-generated from title if omitted) |
--body <text> | No | PR body/description |
--draft | No | Create as draft PR |
--delete | No | Delete the specified files instead of updating them |
The scope is required. Write type(scope): … — docs(readme): update install steps, never a bare docs: update install steps. The Conventional Commits spec lets you omit the scope; this house convention does not (.claude/rules/conventional-commits.md). Take it from the component or plugin the change touches. A --title with no scope breaks this convention, so add one before creating the PR.
Execute this server-side PR creation workflow:
$ARGUMENTS--title is provided — error if missing--delete):
./ or working directory prefix)$REPO)--base if provided, otherwise use default branch from context# Get base branch SHA
BASE_SHA=$(gh api repos/$REPO/git/ref/heads/$BASE_BRANCH -q .object.sha)
# Get base tree SHA
BASE_TREE=$(gh api repos/$REPO/git/commits/$BASE_SHA -q .tree.sha)
If this fails, the base branch doesn't exist — report error and list available branches.
Derive from the --title:
type(scope): )fix/kebab-subject)"fix(api): handle null response" → fix/handle-null-responseFor each file path:
# Base64-encode the file content and create a blob
BLOB_SHA=$(gh api repos/$REPO/git/blobs \
-f content="$(base64 < "$FILE_PATH" | tr -d '\n')" \
-f encoding=base64 \
-q .sha)
Track each {path, blob_sha} pair for the tree creation in Step 5.
For --delete files, skip blob creation — these are handled differently in the tree.
Build a tree JSON payload and create the tree:
# Write tree entries to a temp file
TREE_FILE=$(mktemp)
For each file to update/create, add a tree entry:
{"path": "relative/path/to/file", "mode": "100644", "type": "blob", "sha": "<blob_sha>"}
For each file to delete, add a tree entry:
{"path": "relative/path/to/file", "mode": "100644", "type": "blob", "sha": null}
Create the tree:
TREE_SHA=$(gh api repos/$REPO/git/trees \
-f base_tree="$BASE_TREE" \
--input "$TREE_FILE" \
-q .sha)
Note: The --input file must contain the full JSON body with a tree array. Example:
{
"base_tree": "<BASE_TREE>",
"tree": [
{"path": "src/config.ts", "mode": "100644", "type": "blob", "sha": "<blob1>"},
{"path": "README.md", "mode": "100644", "type": "blob", "sha": "<blob2>"}
]
}
COMMIT_SHA=$(gh api repos/$REPO/git/commits \
-f message="$TITLE" \
-f tree="$TREE_SHA" \
-f "parents[]=$BASE_SHA" \
-q .sha)
gh api repos/$REPO/git/refs \
-f ref="refs/heads/$BRANCH" \
-f sha="$COMMIT_SHA"
If this fails with "Reference already exists", report the error and suggest using a different branch name.
When --body is provided, write it to a tempfile with the Write tool and pass --body-file. This sidesteps shell quoting entirely so backticks and code fences in the body render correctly. See the Body content rule in github-issue-writing for the canonical guidance.
# Write tool → "$TMP_BODY" (no shell escaping involved)
gh pr create \
--repo "$REPO" \
--head "$BRANCH" \
--base "$BASE_BRANCH" \
--title "$TITLE" \
--body-file "$TMP_BODY"
When --body is unset, fall back to the trivial-body form --body "Created via API — no local git operations.".
Add --draft if the flag was provided.
Print a summary:
PR created successfully (no local git changes):
PR: <url>
Branch: <branch> → <base>
Files: <count> file(s) changed
Commit: <sha>
Remove any temp files created during execution.
| Error | Recovery |
|---|---|
gh auth status fails | "Run gh auth login first" |
| Base branch SHA lookup fails | List branches: gh api repos/$REPO/branches --jq '.[].name' |
| Blob creation fails | Report which file failed and the API error |
| Branch already exists | Suggest --branch <different-name> |
| Tree creation fails | Check if file paths are valid repo-relative paths |
| PR creation fails | Show the API error — common cause is branch protection |
| Context | Command |
|---|---|
| Single file fix | /git:api-pr file.ts --title "fix(docs): correct typo" |
| Multi-file fix | /git:api-pr a.ts b.ts --title "fix(config): update settings" |
| Draft PR | /git:api-pr file.ts --title "feat(api): add endpoint" --draft |
| Custom branch | /git:api-pr file.ts --title "fix(api): handle null response" --branch hotfix/issue-123 |
| Delete file | /git:api-pr old-file.ts --title "chore(scripts): remove deprecated helper" --delete |
| Non-default base | /git:api-pr file.ts --title "fix(api): handle null response" --base develop |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub laurigates/claude-plugins --plugin git-plugin52 skills in this plugin
/deadbranchdeadbranch CLI for stale-branch cleanup — dry-run preview, TUI or non-interactive delete, protects main/develop/WIP. Use when asked to clean up branches, prune branches, or remove stale branches./external-pr-trustAuthorship as a precondition of merging — bot vs stranger classification, what a merge executes, the merge-guard hook. Use when bulk-merging PRs, or when a merge is denied for a non-self author./gh-cli-agenticgh CLI commands with JSON output for agents. Use when querying PRs, issues, runs, or repo metadata; inspecting PR checks; fetching failed CI logs; or mapping a github.com URL to an API call.Other plugins' skills for the same job