PierceS1/PS1 / .claude/skills/commit-push-pr
commit-push-pr
VerifiedCreates a git commit and pushes to remote. Use -a to amend. Optionally accepts a commit message.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 1.9 KB |
SKILL.md
View on GitHub---
name: commit-push-pr
description: Creates a git commit and pushes to remote. Use -a to amend. Optionally accepts a commit message.
---
## Task
Create a git commit with all modified code and push to the remote repository.
### Step 1: Stage Changes
Run `git status` to see what files have changed. Stage the relevant changes:
- Stage files that are related to the current work
- Do NOT stage unrelated changes or files that shouldn't be committed (e.g., local config, debug files)
- Use `git add <file>` for specific files or `git add -A` if all changes should be committed
### Step 2: Commit
If amending:
- If a commit message is provided, use `git commit --amend -m "<message>"`
- Otherwise, use `git commit --amend --no-edit` to keep the previous message
Otherwise:
- If a commit message is provided, use it
- If no message provided, run `git diff --cached` to see what's staged, then draft a concise commit message
- Create a new commit with the message
### Step 3: Push to Remote
Push to the remote. If amending, use `git push --force-with-lease`. If no upstream exists, add `-u origin <branch-name>`. Both flags can be combined if needed.
### Step 4: Create or Update PR
Check if a PR already exists for this branch: `gh pr view --json url 2>/dev/null`
- If no PR exists, create one as a **draft**: `gh pr create --draft --title "<title>" --body "<body>"`
- If a PR already exists, skip this step (the push already updated it)
### Important Notes
- NEVER use `--force` unless explicitly requested
- NEVER skip hooks (`--no-verify`) unless explicitly requested
- ALWAYS create PRs as drafts — never create non-draft PRs
- If the commit fails due to pre-commit hooks, fix the issues
- If push fails due to remote changes, pull and rebase before retrying
- If push fails with 403/permission denied, fork the repo (`gh repo fork --remote=true`), then push to the fork and open a PR against the upstream repo
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementation | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirements | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |