MCPInstall

commit-push-pr

Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.

Installs
87
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/llama-farm/llamafarm --skill commit-push-pr
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads commit-push-pr automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

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:

  1. Check if PR already exists:
gh pr list --head "$(git branch --show-current)" --json number,url,title
  1. If PR exists:

    • Offer to push updates to the existing PR
    • Report the PR URL
  2. 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):

  1. Inform user that changes need to go on a feature branch
  2. Stage changes first to analyze them:
git add -A
git diff --staged --stat
  1. Generate a conventional commit message based on the changes (see Step 5)

  2. Derive branch name from commit message:

    • feat(cli): add project list → feat-cli-add-project-list
    • fix: resolve memory leak → fix-resolve-memory-leak
    • Rules: lowercase, replace spaces/special chars with hyphens, max 50 chars
  3. 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

  1. Stage all changes:
git add -A
  1. Analyze the staged changes:
git diff --staged --stat
git diff --staged
  1. 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"
  2. 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:

IssueSeverityAction
Hardcoded secrets (API keys, passwords)BLOCKCannot auto-fix - user must remove
Command injection (shell=True, os.system)BLOCKCannot auto-fix - user must refactor
Empty catch/except blocksPROPOSESuggest adding error logging
Duplicate code patternsPROPOSESuggest extraction
Unused importsPROPOSESuggest removal
TODO/FIXME commentsWARNNote but allow proceed

3. Handle blocking issues

If BLOCK issues found:

  • List each issue with file:line reference
  • Stop the workflow
  • User must fix manually and re-run

4. Handle proposable fixes

For each PROPOSE issue:

  • Show: file, line, problem, suggested fix
  • Ask: "Apply this fix? (y/n/all/skip)"
  • If approved: apply edit, re-stage
  • If skipped: continue without fix

5. Handle warnings

For WARN issues:

  • Display summary
  • Continue without blocking

Step 6: Create the Commit

Create the commit with the approved message:

git commit -m "$(cat <<'EOF'
type(scope): short description

Optional longer description explaining the change.
EOF
)"

Important:

  • Use HEREDOC for multi-line messages
  • Never add co-author or Claude attribution
  • Let pre-commit hooks run (never use --no-verify)

If commit fails due to pre-commit hook:

  • Report the failure to the user
  • Show the hook output
  • Do NOT retry with --no-verify
  • Ask user how to proceed (fix issues or abort)

Step 7: Push to Remote

  1. Check if branch has upstream:
git rev-parse --abbrev-ref @{upstream} 2>/dev/null
  1. If no upstream, push with -u:
git push -u origin $(git branch --show-current)
  1. If has upstream, regular push:
git push

If push fails due to conflicts:

  • Inform user about the conflict
  • Suggest: git pull --rebase origin $DEFAULT_BRANCH or git merge origin/$DEFAULT_BRANCH
  • Do NOT force push

Step 8: Create or Report PR

  1. Check if PR already exists:
gh pr list --head "$(git branch --show-current)" --json number,url,title
  1. If PR exists:

    • Report: "Changes pushed to existing PR: <URL>"
    • Show PR title and number
  2. If no PR exists:

    • Generate PR title from commit message (first line)
    • Generate PR body with summary of changes
    • Create PR:
gh pr create --title "type(scope): description" --body "$(cat <<'EOF'
## Summary

- Brief description of changes

## Changes

- List of key changes made

## Test Plan

- How to verify these changes work
EOF
)"
  1. Report the new PR URL to the user

Branch Name Generation

Convert commit message to valid branch name:

InputOutput
feat(cli): add project list commandfeat-cli-add-project-list-command
fix: resolve memory leak in cachefix-resolve-memory-leak-in-cache
refactor(server): simplify auth flowrefactor-server-simplify-auth-flow

Algorithm:

  1. Take the commit message (first line only)
  2. Lowercase everything
  3. Remove the colon after type/scope
  4. Replace ( and ) with -
  5. Replace spaces and special characters with -
  6. Collapse multiple hyphens to single hyphen
  7. Trim to max 50 characters at word boundary
  8. Remove trailing hyphens

Error Handling

ErrorAction
Pre-commit hook failsShow output, ask user to fix, do NOT bypass
Push rejected (conflicts)Suggest rebase/merge, do NOT force push
PR creation failsShow error, suggest manual creation
Not a git repoInform user, exit
gh CLI not installedInform user how to install
Not authenticated to GitHubSuggest gh auth login

Output Format

On success, report:

Committed: feat(cli): add project list command
Branch: feat-cli-add-project-list-command
Pushed to: origin/feat-cli-add-project-list-command
PR: https://github.com/owner/repo/pull/123

Notes for the Agent

  1. Never mention Claude - No co-author lines, no "generated by Claude" in PR descriptions
  2. Respect hooks - Pre-commit hooks exist for a reason, never skip them
  3. Be informative - Tell the user what's happening at each step
  4. Handle errors gracefully - Don't leave the repo in a broken state
  5. Ask when uncertain - If the commit message isn't clear, ask the user
  6. Keep it simple - One commit per invocation, clear linear workflow

FAQ

What does the commit-push-pr skill do?

Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.

How do I install commit-push-pr?

Run npx skills add https://github.com/llama-farm/llamafarm --skill commit-push-pr in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/commit-push-pr/ (personal) or .claude/skills/commit-push-pr/ (project).

Which AI agents can use commit-push-pr?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is commit-push-pr safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains commit-push-pr?

It is published by llama-farm in llama-farm/llamafarm. It has 87 recorded installs.

More from llama-farm/llamafarm

View all →

code-review

llama-farm/llamafarm

Comprehensive code review for diffs. Analyzes changed code for security vulnerabilities, anti-patterns, and quality issues. Auto-detects domain (frontend/backend) from file paths.

electron-skills

llama-farm/llamafarm

Electron patterns for LlamaFarm Desktop. Covers main/renderer processes, IPC, security, and packaging.

Security85 installs

typescript-skills

llama-farm/llamafarm

Shared TypeScript best practices for Designer and Electron subsystems.

python-skills

llama-farm/llamafarm

Shared Python best practices for LlamaFarm. Covers patterns, async, typing, testing, error handling, and security.

Testing & QA68 installs

react-skills

llama-farm/llamafarm

React 18 patterns for LlamaFarm Designer. Covers components, hooks, TanStack Query, and testing.

rag-skills

llama-farm/llamafarm

RAG-specific best practices for LlamaIndex, ChromaDB, and Celery workers. Covers ingestion, retrieval, embeddings, and performance.

AI & Agents58 installs

Popular code quality & workflow skills

View category →

grill-me

mattpocock/skills

A relentless interview to sharpen a plan or design.

Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.

handoff

mattpocock/skills

Compact the current conversation into a handoff document for another agent to pick up.

domain-modeling

mattpocock/skills

Build and sharpen a project's domain model. Use when discussing codebase terminology, writing or editing a GLOSSARY.md, or recording or editing an ADR.

codebase-design

mattpocock/skills

Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

diagnosing-bugs

mattpocock/skills

Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.