一键导入
commit-push-pr
Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
CLI best practices for LlamaFarm. Covers Cobra, Bubbletea, Lipgloss patterns for Go CLI development.
Electron patterns for LlamaFarm Desktop. Covers main/renderer processes, IPC, security, and packaging.
Shared Python best practices for LlamaFarm. Covers patterns, async, typing, testing, error handling, and security.
Server-specific best practices for FastAPI, Celery, and Pydantic. Extends python-skills with framework-specific patterns.
Shared TypeScript best practices for Designer and Electron subsystems.
Manage LlamaFarm worktrees for isolated parallel development. Create, start, stop, and clean up worktrees.
| name | commit-push-pr |
| description | Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks. |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob, AskUserQuestion |
Automates the git workflow of committing changes, pushing to GitHub, and opening a PR with intelligent handling of edge cases.
Before executing, internalize the git workflow standards: @.claude/rules/git_workflow.md
Key rules:
type(scope): description--no-verify)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?If !HAS_CHANGES && !HAS_UNPUSHED:
Inform user: "No changes to commit and no unpushed commits. Nothing to do."
Exit gracefully.
If !HAS_CHANGES && HAS_UNPUSHED:
gh pr list --head "$(git branch --show-current)" --json number,url,title
If PR exists:
If no PR:
If on default branch ($DEFAULT_BRANCH):
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-leakCreate and checkout the new branch:
git checkout -b <branch-name>
If already on feature branch:
git add -A
git diff --staged --stat
git diff --staged
Generate a conventional commit message based on:
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?
Skip if: --quick flag was passed.
Run quality checks on staged changes before committing.
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:
console.log(...), console.debug(...), console.info(...) statementsdebugger; statementsprint(...) statements (Python)Report: "Auto-fixed: Removed N debug statements from M files"
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 |
If BLOCK issues found:
For each PROPOSE issue:
For WARN issues:
Create the commit with the approved message:
git commit -m "$(cat <<'EOF'
type(scope): short description
Optional longer description explaining the change.
EOF
)"
Important:
--no-verify)If commit fails due to pre-commit hook:
--no-verifygit rev-parse --abbrev-ref @{upstream} 2>/dev/null
-u:git push -u origin $(git branch --show-current)
git push
If push fails due to conflicts:
git pull --rebase origin $DEFAULT_BRANCH or git merge origin/$DEFAULT_BRANCHgh pr list --head "$(git branch --show-current)" --json number,url,title
If PR exists:
If no PR exists:
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
)"
Convert commit message to valid branch name:
| Input | Output |
|---|---|
feat(cli): add project list command | feat-cli-add-project-list-command |
fix: resolve memory leak in cache | fix-resolve-memory-leak-in-cache |
refactor(server): simplify auth flow | refactor-server-simplify-auth-flow |
Algorithm:
( and ) with --| Error | Action |
|---|---|
| Pre-commit hook fails | Show output, ask user to fix, do NOT bypass |
| Push rejected (conflicts) | Suggest rebase/merge, do NOT force push |
| PR creation fails | Show error, suggest manual creation |
| Not a git repo | Inform user, exit |
| gh CLI not installed | Inform user how to install |
| Not authenticated to GitHub | Suggest gh auth login |
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