CommunityProgramación y desarrollogithub.com

commit-pr

Commit the current work with explicit staging and a well-formed message, then optionally push and open a pull request, following the git rules in CLAUDE.md and the project's own conventions. Runs only when the user invokes it.

¿Qué es commit-pr?

commit-pr is a Claude Code agent skill that commit the current work with explicit staging and a well-formed message, then optionally push and open a pull request, following the git rules in CLAUDE.md and the project's own conventions. Runs only when the user invokes it.

Compatible con✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/arslanramay/claude-code-engineering-playbook/tree/HEAD/examples/skills/commit-pr

Installed? Explore more Programación y desarrollo skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Commit, push, open a PR

Invoking this skill is the user's request to commit. $0 sets how far to go:

ArgumentDoes
none or commitcommit, then ask whether to push and open a PR
pushcommit and push
prcommit, push, open a PR

Anything after it is extra instruction from the user: $ARGUMENTS.

1. Read the project's rules first

  • Read CLAUDE.md / AGENTS.md (root and nearest folder), CONTRIBUTING.md, any commitlint config, and .github/pull_request_template.md.
  • Run git log --oneline -15 to see the format actually in use.
  • Project rules win over the defaults below: commit format, branch names, base branch, production branches, PR template, labels, files that must never be committed.

2. Check the state before touching anything

git status --short --branch   # also shows the upstream, if any
git branch --show-current
git diff --stat; git diff --cached --stat

Stop and ask when any of these is true:

  • The branch is a production branch (main, master, production, release*, or what the project names) and the user didn't say in this message to commit there. Offer a branch: <type>/<ticket>-<slug>.
  • Detached HEAD, or a merge, rebase or cherry-pick is in progress.
  • Something is already staged that you did not stage.

3. Choose and stage the files

  • Commit only the work in hand. Leave unrelated edits, and any file the project marks as permanently local, unstaged.
  • Never commit .env files, secrets, database dumps, exports, or build output.
  • Separate deliverables get separate commits: code, tests, docs.
  • Stage explicit paths only: git add -- <path> <path>. Never git add -A, git add . or git commit -a.
  • Confirm with git diff --cached --name-only. Scan git diff --cached for keys, tokens and connection strings; stop if you find one.

4. Write the message

  • Format: the project's own, else Conventional Commits: type(scope): imperative summary, at most 72 characters before any ticket suffix, no trailing period.
  • Body: why the change was needed first, then a bullet list of the changes.
  • Links: ticket ids as their URLs. Commit references link to <repo-url>/commit/<full 40-char SHA>; get the SHA with git rev-parse <short> and the repo URL from git remote get-url origin.
  • No AI attribution of any kind: no co-author trailer, no "generated with" line.
  • Pass the message with a heredoc or -F <file>.

5. Commit

  • If a hook fails, fix the cause, re-stage, and make a new commit. Never --no-verify; never --amend unless asked.
  • Show git log -1 --stat.

6. Push (only for push or pr)

  • Always an explicit refspec: git push -u origin HEAD:refs/heads/<branch>.
  • Why: a branch made with git worktree add -b X origin/dev tracks origin/dev, so a bare git push would push straight to dev.
  • Never force-push. Never push to a production branch unless the user said so in this message.

7. Open the PR (only for pr)

  • Base: the project's integration branch from its CLAUDE.md, else gh repo view --json defaultBranchRef -q .defaultBranchRef.name.
  • Title: the commit subject style.
  • Body, written to a temp file and passed with --body-file:
    • every paragraph and bullet on one unwrapped line (GitHub turns each newline into a line break);
    • Summary: why;
    • Changes: bullets;
    • Verification: the commands actually run and their measured results, plus anything not verified;
    • Links: tickets, related PRs, docs, full-SHA commit links.
  • Follow the project's PR template and labels. Never merge unless asked.

8. Report

Branch, each commit as a full-SHA link, the PR URL, and anything left uncommitted on purpose.

Individual skills in this repo

This repo contains 1 individual skill — each has its own dedicated page.

Skills relacionados