commit-push-pr
Create a git commit, push a branch, and open a Pull Request with gh. Use when asked to commit changes, push to origin, or create PRs, especially when conventional commits and PR templates are required.
When & Why to Use This Skill
This Claude skill automates the end-to-end Git workflow, enabling developers to seamlessly transition from local code changes to remote Pull Requests. By integrating with the GitHub CLI (gh), it handles branch management, enforces Conventional Commit standards, and automatically populates PR templates based on project context and language detection, significantly boosting developer productivity and repository consistency.
Use Cases
- Automating the creation of Pull Requests with standardized templates and Conventional Commit messages to maintain high-quality project history.
- Streamlining the developer workflow by automatically handling branch creation, upstream pushing, and PR initialization in a single step.
- Ensuring localized documentation by automatically detecting the project's primary language (e.g., Japanese or English) to generate appropriate PR titles and descriptions.
- Enforcing secure coding practices through automated GPG-signed commits with a smart fallback mechanism for environments without signing keys.
| name | commit-push-pr |
|---|---|
| description | Create a git commit, push a branch, and open a Pull Request with gh. Use when asked to commit changes, push to origin, or create PRs, especially when conventional commits and PR templates are required. |
Commit, Push, and PR Workflow
Workflow
- Detect PR language by reading
README/README.md.- If the README contains Japanese text, use Japanese for PR title/body; otherwise use English.
- Ensure a feature branch.
- Run
git branch --show-current. - If on
mainormaster, infer branch naming fromgit branch -r --list 'origin/*' | grep -v 'HEAD\|main\|master', propose a name, then rungit switch -c <branch-name>.
- Run
- Try signed commit first, fallback if it fails.
- Attempt a signed commit with
git commit -S. - If the signed commit fails, retry without signing using
git -c commit.gpgsign=false commitand note the fallback in the response.
- Attempt a signed commit with
- Create a Conventional Commit.
- Format:
<type>[optional scope]: <description>- Optional body
- Conversation log:
prompt: <user prompt>----<assistant response>- Repeat for each exchange
- Optional footer(s)
- Use
feat|fix|docs|style|refactor|test|chore|ci|build|perfas needed. - Keep description present tense, lowercase, under 50 chars, no period.
- Format:
- Push the branch.
- If no upstream:
git push -u origin <branch-name>. - Otherwise:
git push.
- If no upstream:
- Create a PR with
gh pr create.- Look for PR templates in
.github/PULL_REQUEST_TEMPLATE.md,.github/PULL_REQUEST_TEMPLATE/, ordocs/PULL_REQUEST_TEMPLATE.md. - If no template, use a language-appropriate default template.
- Use a HEREDOC body:
gh pr create --title "<title>" --body "$(cat <<'EOF' <body> EOF )"
- Look for PR templates in
- Output the PR URL.
Default PR templates
English
## Summary
- <1-3 bullets>
## Changes
- <specific changes>
## Test Plan
- <how to test>
## Notes
- <extra context>
Japanese
## 概要
- <1〜3点>
## 変更点
- <具体的な変更>
## テスト方法
- <テスト手順>
## 備考
- <補足>