commit-push-pr
БесплатноБез исполняемых скриптовНе проверенCommit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
Об этом скилле
Commit, Push & PR Skill
Automates the git workflow of committing changes, pushing to GitHub, and opening a PR with intelligent handling of edge cases.
Required Reading
Before executing, internalize the git workflow standards: @.claude/rules/git_workflow.md
Key rules:
- Use Conventional Commits format:
type(scope): description - NEVER attribute Claude in commits or PRs (no co-author, no mentions)
- NEVER skip pre-commit hooks (no
--no-verify)
Execution Workflow
Step 1: Assess Git State
Run these commands to understand the current state:
# Detect the default branch (main, master, etc.)
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
# Fallback if symbolic-ref fails (e.g., shallow clone or missing HEAD)
if [ -z "$DEFAULT_BRANCH" ]; then
DEFAULT_BRANCH=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
fi
# Final fallback to 'main' if detection fails
DEFAULT_BRANCH=${DEFAULT_BRANCH:-main}
# Get current branch
BRANCH=$(git branch --show-current)
# Check for uncommitted changes
git status --porcelain
# Check for unpushed commits (if branch has upstream)
git log origin/$DEFAULT_BRANCH..HEAD --oneline 2>/dev/null || echo "No upstream or no commits ahead"
# Check if branch has upstream tracking
git rev-parse --abbrev-ref @{upstream} 2>/dev/null || echo "No upstream"
Determine the state:
HAS_CHANGES: Are there uncommitted changes (staged, unstaged, or untracked)?HAS_UNPUSHED: Are there commits ahead of origin/$DEFAULT_BRANCH?ON_DEFAULT_BRANCH: Is current branch the default branch ($DEFAULT_BRANCH)?HAS_UPSTREAM: Does the branch track a remote?
Step 2: Handle "Nothing to Do" Case
If !HAS_CHANGES && !HAS_UNPUSHED:
Inform user: "No changes to commit and no unpushed commits. Nothing to do."
Exit gracefully.
Step 3: Handle "No Changes But Unpushed Commits" Case
If !HAS_CHANGES && HAS_UNPUSHED:
- Check if PR already exists:
gh pr list --head "$(git branch --show-current)" --json number,url,title
If PR exists:
- Offer to push updates to the existing PR
- Report the PR URL
If no PR:
- Offer to push and create a new PR
- Proceed to Step 7
Step 4: Branch Management (if HAS_CHANGES)
If on default branch ($DEFAULT_BRANCH):
- Inform user that changes need to go on a feature branch
- Stage changes first to analyze them:
git add -A
git diff --staged --stat
Generate a conventional commit message based on the changes (see Step 5)
Derive branch name from commit message:
feat(cli): add project list→feat-cli-add-project-listfix: resolve memory leak→fix-resolve-memory-leak- Rules: lowercase, replace spaces/special chars with hyphens, max 50 chars
Create and checkout the new branch:
git checkout -b <branch-name>
If already on feature branch:
- Continue with the existing branch
- Check if PR exists for context
Step 5: Stage Changes and Generate Commit Message
- Stage all changes:
git add -A
- Analyze the staged changes:
git diff --staged --stat
git diff --staged
Generate a conventional commit message based on:
- Files changed (infer scope from directory)
- Nature of changes (feat/fix/refactor/docs/test/chore)
- Summarize the "why" not just the "what"
Present the commit message to the user. Example format:
Proposed commit message:
feat(cli): add project listing command
Adds a new 'lf project list' command that displays all projects
in the current workspace with their status.
Do you want to use this message, modify it, or provide your own?
Step 5.5: Quality Check
Skip if: --quick flag was passed.
Run quality checks on staged changes before committing.
1. Auto-fix trivial issues (no prompt needed)
Search for and remove debug statements:
# Find files with debug statements
git diff --staged --name-only | xargs grep -l -E "(console\.(log|debug|info)|debugger|print\()" 2>/dev/null
For each file found:
- Remove
console.log(...),console.debug(...),console.info(...)statements - Remove
debugger;statements - Remove
print(...)statements (Python) - Re-stage the file after fixes
Report: "Auto-fixed: Removed N debug statements from M files"
2. Check for issues requiring attention
Scan staged diff for:
| Issue | Severity | Action |
|---|---|---|
| Hardcoded secrets (API keys, passwords) | BLOCK | Cannot auto-fix - user must remove |
Command injection (shell=True, os.system) |
BLOCK | Cannot auto-fix - user must refactor |
| Empty catch/except blocks | PROPOSE | Suggest adding error logging |
| Duplicate code patterns | PROPOSE | Suggest extraction |
| Unused imports | PROPOSE | Suggest removal |
| TODO/FIXME comments | WARN | Note but allow proceed |
3. Handle blocking issues
If BLOCK issues found:
- List each i
Установить commit-push-pr в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
BashReadWriteEditGrepGlobAskUserQuestionFAQ
Что делает скилл commit-push-pr?
Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
Как установить скилл commit-push-pr?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл commit-push-pr запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic