commit-push-pr
npx machina-cli add skill 7dieuuoc/ChernyCode/commit-push-pr --openclawCommit, Push, and Create PR
Automate the git workflow for completing a feature or fix.
Pre-computed Context
Before proceeding, gather this information:
- Current branch:
!git branch --show-current - Git status:
!git status --short - Recent commits on this branch:
!git log --oneline -5 - Diff summary:
!git diff --stat
Workflow
-
Review Changes
- Check
git statusfor all modified/added files - Review the diff to understand what's being committed
- Ensure no sensitive files are staged (.env, credentials, etc.)
- Check
-
Run Pre-commit Checks
- Format code:
ruff format .(if Python files changed) - Lint code:
ruff check .(if Python files changed) - Run tests:
pytest(if tests exist)
- Format code:
-
Stage and Commit
- Stage relevant files:
git add <files> - Create a commit with Conventional Commits format:
feat:for new featuresfix:for bug fixesdocs:for documentationrefactor:for refactoringtest:for testschore:for maintenance
- Write a clear, concise commit message focusing on "why"
- Stage relevant files:
-
Push to Remote
- Push the branch:
git push -u origin HEAD - If branch doesn't exist on remote, create it
- Push the branch:
-
Create Pull Request
- Use GitHub CLI:
gh pr create - Include:
- Clear title summarizing the change
- Description with summary and context
- Reference any related issues
- Add appropriate labels if applicable
- Use GitHub CLI:
Arguments
Pass a commit message or leave empty for auto-generated message based on changes.
Usage: /commit-push-pr [optional commit message]
Example: /commit-push-pr feat: add user authentication
Output
Return the PR URL when complete.
Source
git clone https://github.com/7dieuuoc/ChernyCode/blob/main/cursor_personal_skills/commit-push-pr/SKILL.mdView on GitHub Overview
Automate the git workflow for delivering features or fixes from start to PR. This skill guides you through reviewing changes, running pre-commit checks, staging and committing with Conventional Commits, pushing to the remote, and creating a pull request with GitHub CLI. It returns the PR URL when the PR is ready for review.
How This Skill Works
It collects context such as the current branch, status, recent commits, and diff stats, then executes five steps: review changes, run pre-commit checks (ruff format ., ruff check ., pytest if tests exist), stage and commit with a conventional prefix, push the branch to origin, and create a PR with gh pr create. If you omit a commit message, the tool auto-generates one based on the changes.
When to Use It
- Starting work on a new feature on its own branch and want a single command flow to PR
- Fixing a bug and preparing a targeted PR with a clear scope
- Updating documentation or changelog and needing appropriate commit types (docs, refactor, etc.)
- Enforcing pre-commit checks before PR creation to ensure code quality
- Preparing a review-ready PR with a clear title, description, and related issues
Quick Start
- Step 1: /commit-push-pr [optional commit message]
- Step 2: Review changes, run pre-commit checks, and stage/commit automatically
- Step 3: The tool pushes to remote and creates a PR; returns the PR URL
Best Practices
- Review git status and diff before staging to avoid leaking sensitive files
- Exclude sensitive files (.env, credentials) from commits
- Use Conventional Commits: feat:, fix:, docs:, refactor:, test:, chore:
- Run pre-commit checks locally (ruff format ., ruff check ., pytest) before pushing
- Write a clear PR title and description with context and reference related issues
Example Use Cases
- feat: add user authentication on login flow
- fix: resolve null pointer when loading user profile
- docs: update API usage section
- refactor: extract utilities for user service
- test: add integration tests for checkout flow