Token导航 LogoToken导航

Agent Skill · 待分类

branch-commit-pr(分支提交 pr)

branch-commit-pr 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

branch-commit-pr 是待分类类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为接触敏感数据;许可证信息还不明确,第三方扫描已通过,按安装量在待分类类的 11,209 个 Skill 里排第 10,045。

总安装 216周安装 9GitHub Stars 1下载 72核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:branch-commit-pr(分支提交 pr)
来源仓库:https://github.com/nianyi778/branch-commit-pr
仓库路径:skills/branch-commit-pr
安装命令:
npx skills add https://github.com/nianyi778/branch-commit-pr --skill branch-commit-pr
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/nianyi778/branch-commit-pr --skill branch-commit-pr

这个 Skill 是做什么的

这个 Skill 的分类还没最终确定,用法以来源仓库的说明为准。

branch-commit-pr 完成从分支创建到 Pull Request 提交的完整 Git 工作流自动化,支持多阶段灵活触发。适用于功能开发周期管理、代码保存与合作者提交流程引导,可根据请求关键词自动匹配执行阶段。严格遵循模式检测优先原则,依次处理分支命名、提交信息规范与 PR 模板填充,确保可追溯性。

依赖 gh CLI 工具与 GitHub 权限配置,部分操作需交互式输入 issue 编号或描述文本,注意敏感信息脱敏。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/branch-commit-pr

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/nianyi778/branch-commit-pr --skill branch-comm…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要接触敏感数据,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

branch-commit-pr 怎么安装?

在终端执行 npx skills add https://github.com/nianyi778/branch-commit-pr --skill branch-commit-pr。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

branch-commit-pr 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

branch-commit-pr 需要什么权限?

权限级别是接触敏感数据。该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

branch-commit-pr 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

branch-commit-pr 用的人多吗?

公开数据是累计安装 216 次,近一周安装 9 次,下载 72 次,GitHub 1 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

branch-commit-pr 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 需要接触敏感数据,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理待分类类任务、又不想每次都手写提示词的人。

不太适合

  • 环境里有大量密钥、凭证,不方便给第三方 Skill 读取的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

待分类类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
infsh-cli

infsh CLI · Codex、Claude

4,374,576382权限未标注未明确未收录
ai-video-generation

AI 视频生成 · Codex、Claude

4,313,376382调用外部服务未明确有提醒
lark-openapi-explorer

云雀 OpenAPI 浏览器 · Codex、Claude

2,064,1209,011需要联网未明确有提醒
lark-workflow-standup-report

Lark 工作流程站立报告 · Codex、Claude

2,041,6328,978需要联网未明确通过
use-my-browser

使用我的浏览器 · Codex、Claude

1,848,49140操作浏览器未明确未通过
branch-commit-pr

分支提交 pr · 本页

2161接触敏感数据未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Branch → Commit → PR

A complete git development workflow skill. Handles the entire cycle from branch creation to pull request submission.


MODE DETECTION (FIRST STEP)

Analyze the user's request to determine which phase(s) to execute:

User Request PatternModePhases
"start work on X", "begin feature X"FULL_CYCLEPhase 0 → 1 → (work) → 2 → 3
"create branch for X"BRANCH_ONLYPhase 0 → 1
"commit", "save changes"COMMIT_ONLYPhase 0 → 2
"open PR", "create pull request", "submit"PR_ONLYPhase 0 → 3
"commit and PR", "finish up"COMMIT_AND_PRPhase 0 → 2 → 3
"set default branch to X"CONFIGPhase 0 (override + persist)

If ambiguous, ask the user which phase(s) they want.


PHASE 0: Context Gathering (MANDATORY — runs before every other phase)

Execute ALL of the following in parallel:

# Group 0: User-configured default branch (highest priority)
git config --local bcp.default-branch 2>/dev/null || echo "NOT_SET"

# Group 1: Repository state
git status --porcelain
git branch --show-current
git remote -v

# Group 2: Default branch detection (if not user-configured)
git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||'
git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}'

# Group 3: Branch naming conventions (sample existing branches)
git branch -r --sort=-committerdate | head -20

# Group 4: Commit style detection
git log -30 --pretty=format:"%s"

# Group 5: Upstream & PR tooling check
gh auth status 2>/dev/null
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "NO_UPSTREAM"

0.1 Default Branch Resolution

PRIORITY ORDER:
1. git config --local bcp.default-branch → user explicitly set (persistent, per-repo)
2. User says "use X as default branch" in current conversation → use + offer to persist
3. git symbolic-ref refs/remotes/origin/HEAD → auto-detect from remote
4. git remote show origin → fallback (requires network)
5. Check if 'main' or 'master' exists in remote branches → last resort
6. FAIL with clear error → ask user to set: "Which branch should I use as the base?"

TO SET/CHANGE DEFAULT BRANCH:
  git config --local bcp.default-branch <branch-name>

TO CLEAR (revert to auto-detect):
  git config --local --unset bcp.default-branch

When user says "set default branch to X" or "use X as base branch":

  1. Validate that branch X exists (git branch -r or git branch)
  2. Run git config --local bcp.default-branch X
  3. Confirm: "Default branch set to X for this repo. All future branches will be created from X."

Store as DEFAULT_BRANCH for all subsequent phases.

0.2 Branch Naming Convention Detection

Analyze the 20 most recent remote branches:

PATTERNS TO DETECT:
- Conventional: feat/xxx, fix/xxx, chore/xxx → TYPE = "conventional"
- Issue-prefixed: feat/123-xxx, fix/PROJ-456-xxx → TYPE = "issue-prefixed"
- Slash-separated: feature/xxx, bugfix/xxx → TYPE = "slash-separated"
- Flat: xxx-yyy-zzz (no prefix) → TYPE = "flat"
- Custom: any other consistent pattern → TYPE = "custom"

DETECTION:
  Count branches matching each pattern.
  If any pattern >= 40% of branches → adopt that pattern.
  If no clear pattern → default to "conventional" (feat/xxx, fix/xxx).

0.3 Commit Style Detection

Analyze the 30 most recent commits:

DETECTION:
  semantic_count = commits matching /^(feat|fix|chore|refactor|docs|test|ci|style|perf|build)(\(.+\))?:/
  plain_count = non-semantic commits with >3 words
  short_count = commits with <=3 words

  IF semantic_count >= 50%: COMMIT_STYLE = "semantic"
  ELSE IF plain_count >= 50%: COMMIT_STYLE = "plain"
  ELSE: COMMIT_STYLE = "plain" (safe default)

LANGUAGE:
  COMMIT_LANG = "english" (always — commits must be in English regardless of repo history)

0.4 Issue Tracker Detection

CHECK in order:
1. Environment variable JIRA_URL is set → JIRA_ENABLED = true
2. gh CLI authenticated → GITHUB_ISSUES_ENABLED = true
3. Neither → ISSUE_TRACKING = "none"

JIRA CONFIG (if enabled):
  JIRA_URL = $JIRA_URL (e.g. https://team.atlassian.net)
  JIRA_EMAIL = $JIRA_EMAIL
  JIRA_API_TOKEN = $JIRA_API_TOKEN
  All three must be set. If any missing → warn user, disable Jira.

0.5 MANDATORY OUTPUT

CONTEXT DETECTED
================
Default branch: [main | master | develop | ...] (source: user-configured | auto-detected)
Current branch: [branch-name]
Branch naming: [conventional | issue-prefixed | slash-separated | flat]
Commit style: [semantic | plain] + english
Issue tracking: [GitHub Issues | Jira (PROJ) | both | none]
Working directory: [clean | N files modified]
Upstream: [tracked | untracked]
gh CLI: [authenticated | not available]

PHASE 1: Branch Management

1.1 Pre-flight Checks

ABORT IF:
- Not in a git repository
- DEFAULT_BRANCH not resolved

DIRTY WORKING DIRECTORY HANDLING (smart defaults — do NOT ask unless necessary):
- COMMIT_ONLY / COMMIT_AND_PR → Dirty is EXPECTED. Proceed directly.
- BRANCH_ONLY / FULL_CYCLE →
    1. Try: git stash → checkout DEFAULT_BRANCH → pull → checkout -b BRANCH → git stash pop
    2. If stash pop conflicts → warn user and let them resolve
    3. NEVER ask "do you want to stash?" — just do it automatically
- PR_ONLY → Changes must be committed first. Auto-stage + commit, or warn.

WARN IF:
- Already on a feature branch (not default)
  → Ask: "You're on [branch]. Create new branch from DEFAULT_BRANCH, or continue here?"

1.2 Sync Default Branch

# Always fetch latest before branching
git fetch origin $DEFAULT_BRANCH

# Switch to default branch and pull
git checkout $DEFAULT_BRANCH
git pull origin $DEFAULT_BRANCH

1.3 Generate Branch Name

Based on detected convention (Phase 0.2):

INPUT: User's description of the work (e.g. "add user authentication")

CONVENTIONAL:
  → feat/add-user-authentication
  → fix/null-pointer-in-login
  Prefix types: feat, fix, chore, refactor, docs, test, ci, perf

ISSUE-PREFIXED (if issue number provided):
  → feat/123-add-user-authentication
  → fix/PROJ-456-null-pointer-in-login

SLASH-SEPARATED:
  → feature/add-user-authentication
  → bugfix/null-pointer-in-login

FLAT:
  → add-user-authentication

RULES:
  - Lowercase only
  - Hyphens for spaces (no underscores, no dots)
  - Max 60 characters (truncate description, never truncate prefix)
  - Strip special characters
  - No trailing hyphens

1.4 Create and Push Branch

# Create branch from updated default
git checkout -b $BRANCH_NAME

# Set upstream immediately
git push -u origin $BRANCH_NAME

1.5 Output

BRANCH CREATED
==============
Branch: feat/add-user-authentication
Base: main (up to date with origin/main)
Upstream: origin/feat/add-user-authentication

Ready to work. When done, I can commit and create a PR.

PHASE 2: Smart Commit

2.1 Analyze Changes

# Parallel execution
git status --porcelain
git diff --stat
git diff --staged --stat
ABORT IF:
- No changes (staged or unstaged) → "Nothing to commit."

SMART DEFAULTS (do NOT ask — just do):
- Only unstaged changes → Stage all and proceed.
- Both staged and unstaged → Commit only staged changes (respect user's intent).
- Only staged changes → Commit them directly.

2.2 Atomic Commit Planning

HARD RULE: Multiple files → consider multiple commits.

FORMULA: min_commits = ceil(changed_file_count / 4)

SPLIT BY (in priority order):
1. Different directories/modules → different commits
2. Different concerns (logic/style/config/test) → different commits
3. New files vs modifications → consider splitting
4. Implementation + its test → SAME commit (always)

COMBINE ONLY WHEN:
- Same atomic unit (function + its direct test)
- Splitting would break compilation
- Files are tightly coupled (type def + sole consumer)

2.3 Generate Commit Messages

Based on COMMIT_STYLE and COMMIT_LANG from Phase 0.3:

SEMANTIC:
  "feat: add user authentication middleware"
  "fix: resolve null pointer in login handler"
  "refactor: extract validation logic to utils"

PLAIN:
  "Add user authentication middleware"
  "Fix null pointer in login handler"

NOTE: Always write commit messages in English, regardless of the repo's existing commit language.

2.4 Execute Commits

For each commit group, in dependency order:

# Stage files
git add <file1> <file2> ...

# Verify staging
git diff --staged --stat

# Commit
git commit -m "<message>"

2.5 Push

# If upstream is set
git push

# If no upstream yet
git push -u origin $(git branch --show-current)

2.6 Output

COMMITS CREATED
===============
Strategy: 3 atomic commits from 8 files

  abc1234  feat: add auth middleware (3 files)
  def5678  feat: add login/signup endpoints (3 files)
  ghi9012  test: add auth integration tests (2 files)

Pushed to origin/feat/add-user-authentication

PHASE 3: Pull Request Creation

3.1 Pre-flight Checks

ABORT IF:
- gh CLI not authenticated → "Install and authenticate gh CLI: gh auth login"
- On default branch → "You're on the default branch. Nothing to PR."
- No commits ahead of default branch → "No new commits to create PR for."

CHECK:
- All changes committed? (git status clean)
- All commits pushed? (not ahead of origin)
  → If behind: auto-push before PR

3.2 Gather PR Content

# Commits that will be in the PR
git log --oneline $(git merge-base HEAD origin/$DEFAULT_BRANCH)..HEAD

# Full diff stat
git diff origin/$DEFAULT_BRANCH...HEAD --stat

# Detailed diff for summary generation
git diff origin/$DEFAULT_BRANCH...HEAD

3.3 Generate PR Title

Based on commit style:

IF single commit:
  → Use commit message as PR title

IF multiple commits, same feature:
  → Synthesize: "feat: add user authentication system"

IF multiple commits, mixed:
  → Synthesize the overarching theme

ALWAYS:
  → Match COMMIT_STYLE (semantic prefix or plain)
  → Write in English

3.4 Generate PR Body

## Summary
<2-4 bullet points describing WHAT changed and WHY>

## Changes
<Commit list with brief descriptions>
- abc1234 feat: add auth middleware
- def5678 feat: add login/signup endpoints
- ghi9012 test: add auth integration tests

## Testing
<How these changes were tested, or "Needs review">

3.5 Issue Linking

GitHub Issues (default)
IF user mentions issue number (e.g. "closes #42", "fixes #123"):
  → Add to PR body: "Closes #42"
  → Add to PR title if issue-prefixed branch naming is used

IF no issue mentioned:
  → Don't add issue references (don't guess)
Jira (optional — only if JIRA_URL, JIRA_EMAIL, JIRA_API_TOKEN are all set)
IF Jira is enabled AND user mentions Jira ticket (e.g. "PROJ-123"):
  → Add to PR body: "Jira: [PROJ-123]($JIRA_URL/browse/PROJ-123)"
  → Optionally transition ticket status via API:

  curl -s -X POST \
    -H "Authorization: Basic $(echo -n $JIRA_EMAIL:$JIRA_API_TOKEN | base64)" \
    -H "Content-Type: application/json" \
    "$JIRA_URL/rest/api/3/issue/PROJ-123/transitions" \
    -d '{"transition": {"id": "31"}}'

  → Only transition if user explicitly asks (e.g. "move to In Review")
  → NEVER transition without user confirmation

IF Jira enabled but no ticket mentioned:
  → Don't add Jira references (don't guess)

3.6 Create PR

gh pr create \
  --title "$PR_TITLE" \
  --body "$(cat <<'EOF'
$PR_BODY
EOF
)" \
  --base $DEFAULT_BRANCH

Optional flags based on context:

--draft          # If user says "draft PR" or "WIP"
--reviewer USER  # If user specifies reviewers
--assignee USER  # Auto-assign to current user if desired
--label LABEL    # If user specifies labels

3.7 Output

PULL REQUEST CREATED
====================
Title: feat: add user authentication system
URL: https://github.com/org/repo/pull/42
Base: main ← feat/add-user-authentication
Commits: 3
Status: Open

Issues linked:
  - Closes #15 (GitHub)
  - PROJ-123 (Jira)

Next: Waiting for review. Use 'gh pr view 42' to check status.

FULL CYCLE EXAMPLE

When user says "Start working on adding dark mode (closes #28)":

1. PHASE 0: Detect context
   → Default branch: main, Branch style: conventional, Commit style: semantic

2. PHASE 1: Create branch
   → git fetch origin main
   → git checkout main && git pull
   → git checkout -b feat/add-dark-mode
   → git push -u origin feat/add-dark-mode

3. [User works on code with agent assistance]

4. PHASE 2: Commit changes
   → Analyze: 6 files changed across components/ and styles/
   → Commit 1: "feat: add dark mode toggle component" (3 files)
   → Commit 2: "feat: add dark theme CSS variables" (2 files)
   → Commit 3: "test: add dark mode toggle tests" (1 file)
   → git push

5. PHASE 3: Create PR
   → Title: "feat: add dark mode support"
   → Body with summary, commit list, "Closes #28"
   → gh pr create ...
   → Return PR URL

CONFIGURATION OVERRIDE

Users can override detected conventions by stating preferences:

"Use conventional commits" → COMMIT_STYLE = "semantic"
"Branch name should be feature/xxx" → BRANCH_STYLE = "slash-separated"
"Default branch is develop" → DEFAULT_BRANCH = "develop"
"Link to PROJ-456" → Add Jira reference

Always prefer explicit user instructions over auto-detection.


ERROR HANDLING

ErrorRecovery
git push rejected (behind remote)git pull --rebase origin $BRANCH then retry push
Merge conflict during rebaseShow conflicts, ask user to resolve, then git rebase --continue
gh not authenticatedPrint: Run 'gh auth login' to authenticate
No remote configuredPrint: Run 'git remote add origin <url>'
Branch already existsAsk: "Branch X exists. Switch to it, or create X-2?"
PR already exists for branchShow existing PR URL, ask if user wants to update it
Jira API failsWarn and continue without Jira linking (non-blocking)
Dirty working directorySmart default: auto-stash for branch ops, proceed for commit ops (see Phase 1.1)

PLATFORM ADAPTATION

This skill is model-agnostic. It works with any AI coding agent that has shell access.

Claude Code

Native support. Install via:

claude install-skill https://github.com/anthropics/personage/tree/main/commit_pr

Or add SKILL.md to your project's .claude/skills/ directory.

OpenAI Codex

Add SKILL.md content to your Codex system prompt or project instructions:

# In your repo, reference it as agent instruction
cp SKILL.md .codex/instructions/branch-commit-pr.md

Or paste the content into Codex's "Instructions" field in the UI.

Cursor

Add as a project-level rule:

cp SKILL.md .cursor/rules/branch-commit-pr.mdc

Prefix the file with frontmatter to control activation:

---
description: Git workflow — branch, commit, PR
globs:
alwaysApply: false
---

Windsurf

Add to workspace rules:

cp SKILL.md .windsurf/rules/branch-commit-pr.md

Gemini CLI

Reference in your GEMINI.md or project instructions:

<!-- In GEMINI.md -->
Follow the workflow defined in .gemini/skills/branch-commit-pr.md

Other Agents (Cline, Aider, etc.)

Most agents support custom system prompts. The general approach:

  1. Copy SKILL.md into the agent's instruction/rules directory
  2. Or paste content into the agent's system prompt configuration
  3. Ensure the agent has git and gh CLI access in its shell

Cross-Model Tips

  • Be explicit over implicit — this skill uses concrete defaults ("auto-stash and proceed") rather than open-ended questions, which ensures consistent behavior across models of varying capability.
  • Bash is the universal interface — all operations use standard git and gh commands. No model-specific APIs or tool names are required.
  • Structured format aids weaker models — decision tables and numbered steps reduce ambiguity compared to prose instructions.

ANTI-PATTERNS (NEVER DO)

  1. NEVER create a branch without fetching latest default branch first
  2. NEVER force-push without explicit user request
  3. NEVER guess issue numbers — only link what user explicitly mentions
  4. NEVER transition Jira tickets without user confirmation
  5. NEVER commit with empty message or generic "update" message
  6. NEVER create PR from default branch
  7. NEVER push to default branch directly
  8. NEVER delete branches without asking
  9. NEVER make a single commit from 5+ unrelated files — split atomically
  10. NEVER skip the context gathering phase — conventions matter

平台分布

Codex

33.48%
按下载量换算24

Claude

31.4%
按下载量换算23

Cursor

21.07%
按下载量换算15

Gemini CLI

10.15%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

接触敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills