From void-grimoire
Commit changes, push to GitHub, and open a PR. Includes quality checks (security, patterns, simplification). Use --quick to skip checks.
How this skill is triggered — by the user, by Claude, or both
Slash command
/void-grimoire:commit-push-prThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
Automates the git workflow of committing changes, pushing to GitHub, and opening a PR with intelligent handling of edge cases.
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_BRANCHCheck if a PR already exists for the current branch (host-appropriate query: gh pr list --head ... on GitHub, bitbucket MCP on Bitbucket).
If PR exists: report "Changes pushed to existing PR: " with the title and number. Done.
If no PR exists: delegate to the create-pr skill. Do not inline a PR body template here — create-pr owns host detection, title shape, and the risk-sized body rubric (trivial / standard / critical). It explicitly forbids ## Summary / ## Test Plan / "Affected files" boilerplate.
Report the new PR URL.
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
Builds accessible UIs with shadcn/ui components on Radix UI + Tailwind CSS, plus canvas visuals. For React apps (Next.js, Vite, Remix, Astro), design systems, responsive layouts, themes, dark mode, prototypes.
npx claudepluginhub dmltdev/void-grimoire --plugin void-grimoire