Skip to main content
skill CX Codex

commit-pr · zaxbyhub, opencode — Claude Code skill: safe commits and pull requests

commit-pr — a portable skill that verifies your code before push, writes conventional commits, and fills in a PR body. Guards against accidentally committing generated files or secrets.

MIT ★ 539 updated 2026-10-29

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add ZaxbyHub/opencode-swarm --skill commit-pr -a claude-code
Open on GitHub

What commit-pr does

The skill walks through six steps: check your working directory, discover the project's tests and linters, run verification, commit with proper message format, push safely, and open a PR. At each stage it respects the project's own conventions — it looks for Makefile, package.json, .github/workflows/, or build config files to find what checks matter.

Built-in safeguards catch common mistakes: before push, it verifies you are on a feature branch, not main or master; when pushing, it uses --force-with-lease instead of an unconditional force push; secrets and generated output never land in a commit. If the project has a CONTRIBUTING.md file or custom PR template, the skill defers to those local rules.

The skill runs on Claude Code, Codex, and OpenCode. Install separately for each platform via npx skills add.

What it helps with

  • verify tests pass before pushing code
  • write commits in conventional commit format
  • prevent secrets and build artifacts from being committed
  • populate PR description with issue reference
  • identify and push to the correct remote repository

Example prompts for the agent

  • Help me commit these changes and open a pull request
  • Check if everything is ready to push and create the PR
  • Run tests and, if they pass, push the branch and open a PR

How to install commit-pr

1Skills CLI (Vercel)

npx skills add ZaxbyHub/opencode-swarm --skill commit-pr -a claude-code

2Manually: put the files in place

~/.claude/skills/commit-pr/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/commit-pr/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about commit-pr

How do I install commit-pr on Claude Code?

Run npx skills add ZaxbyHub/opencode-swarm --skill commit-pr -a claude-code. The skill will be available at ~/.claude/skills/commit-pr/SKILL.md.

What does commit-pr do?

It automates the entire workflow from code verification to opening a PR: runs the project's tests and linters, prevents secrets and artifacts from being committed, writes commit messages in the correct format, and fills in the PR description.

Will commit-pr work with my project if it has its own commit rules?

Yes. If your project has a CONTRIBUTING.md, pull request template, or other contributor guide, the skill follows those local conventions instead of generic defaults.

Source text

SKILL.md · MIT
---
name: commit-pr
description: >
  Apply when committing, pushing, opening or updating a pull request, or closing
  out CI. A portable, project-agnostic commit and PR workflow: verify before you
  push, write conventional commits and a clear PR body, and never commit
  generated or secret files.
metadata:
  audience: swarm-plugin
  effort: medium
---

# Commit & PR Protocol (portable)

## Graph-first evidence contract

Before publication, use `repo_map` `diff_context` and `impact_cone` as a final drift check, then verify the direct source, Git diff, and tests. Graph evidence is advisory only. If freshness is stale or inconclusive, confidence is low, source is missing, the language is unsupported/dynamic, the graph is absent, or an action fails, publication decisions rely on the direct evidence.

A project-agnostic workflow for landing a change safely. It makes no assumptions
about the language, build tool, or hosting provider — discover each project's
own conventions and follow them. Do every step in order.

> If the repository ships its own commit/PR contract (a `CONTRIBUTING.md`, a
> pull-request template, a contributor-guide file, or a project-specific
> commit-pr skill), that contract wins over this generic guidance. Read it first.

## Step 0 — Working-tree hygiene

1. `git status` and `git diff` — know exactly what you are about to commit.
2. Confirm you are on a feature branch, not the default branch. If you are on
   `main`/`master`, create a branch first.
3. Do not stage generated output, dependency directories, local caches, or
   secrets (build/`dist` output, `node_modules`/`target`/`vendor`, `.env`,
   credentials, keys). If any are tracked or unignored, fix `.gitignore` instead
   of committing them.

## Step 1 — Discover the project's checks

Find the project's own validation commands rather than guessing:

- A package manifest's script section (e.g. `package.json` `scripts`,
  `Makefile` targets, `pyproject.toml`, `Cargo.toml`, `justfile`, `Taskfile`).
- CI workflow files under `.github/workflows/` (or the provider's config) —
  these are the checks that must pass to merge.

Run the project's build, test, lint, type-check, and format checks — whatever
exists. Pin tool versions to what the project declares so local results match
CI. If a check fails, fix the cause; do not weaken, skip, or delete the check.

## Step 2 — Verify before you push

Run the discovered checks and confirm they pass. Report the exact commands and
their results — never claim a check passed without having run it. Passing tests
mean the change is *plausible*, not automatically *correct*: make sure the change
actually does what the task intended.

## Step 3 — Commit

Write a clear, conventional commit message:

- Title: `<type>(<scope>): <summary>` where `<type>` is one of `feat`, `fix`,
  `perf`, `refactor`, `docs`, `test`, `build`, `ci`, `chore`, `revert`.
- Keep the title short and imperative; put detail in the body.
- One logical change per commit where practical.

## Step 4 — Push

1. Identify the correct remote. If the repo has several remotes, push to the one
   the PR targets (the upstream you are contributing to), not an unrelated fork.
2. `git push -u <remote> <branch>` for a new branch.
3. If a push is rejected because you rebased, use `git push --force-with-lease`
   — never a plain, unconditional force push. `--force-with-lease` refuses to
   overwrite commits the remote gained since your last fetch, so it cannot
   silently clobber a teammate's work.

## Step 5 — Open or update the PR

Search the repo for a PR template
(`.github/PULL_REQUEST_TEMPLATE.md` or `.github/PULL_REQUEST_TEMPLATE/`). If one
exists, fill in its sections. Otherwise write a body with at least:

- **Summary** — what changed and why.
- **Test plan** — the checks you ran and their results.
- A linking keyword (`Closes #<issue>`) when the PR resolves an issue.

Use a PR title in the same conventional-commit form as your commit.

Before generating the PR body, check if `.swarm/issue-reference.json` exists. If it
does and contains a `number` field, auto-populate `Closes #<number>` as the first line
of the PR body. If the file does not exist, fall back to `Closes #<issue-number>`.

## Step 6 — Close out CI

After the PR is open, watch its checks. If CI fails, read the logs, reproduce
locally, fix the real cause, and push again. A PR is not done until its required
checks are green and any review feedback is addressed. Do not merge over failing
required checks or disable a check to go green.

If this session is running an issue trace (`/swarm issue --trace`), call
`record_issue_publication` (issue number, PR number, canonical PR URL, HEAD sha)
right after the PR is opened so the issue-trace workflow can reach its terminal
`published` state — without it the trace stays at `publication_handoff` and is NOT
considered resolved.

## Contract addendum (2026-10-12)

- **Publication-time re-derivation.** As the LAST step before `gh pr create`
  / `pr edit`, re-derive every claim in the body from the final tree: PR head
  SHA, test counts, file lists, closure evidence. A body drafted earlier is
  stale by construction — the head moves with every amend — and a stale
  `PR head:` line in particular is guarded by no validator.

© ZaxbyHub · MIT · ZaxbyHub/opencode-swarm

Similar skills

All skills for Git and GitHub →

commit-pr by other authors comes first.

commit-pr ZaxbyHub commit-pr — a checklist the agent must clear before it commits, pushes or opens a PR. Built for the case where an AI agent publishes the branch, not a person. CX Codex +1 ★ 539repo stars commit-pr ZaxbyHub The commit-pr skill guides commits, pull request updates, and CI checks in opencode-swarm. Use it when publishing issue-related code changes or closing out a PR. CX Codex +1 ★ 539repo stars commit-pr ZaxbyHub Guides an agent through checks, commit preparation, and PR publication. Useful when a change must follow the opencode-swarm release process. CX Codex +1 ★ 539repo stars commit SeifBenayed A Claude Code, Codex, Cursor and Copilot skill that creates a git commit with a conventional-commits message. It triggers on "commit", "save changes" or "commit this" and reviews the diff before committing anything. CX Codex +1 ★ 116repo stars git-commit-helper davila7 Reads git diff --staged and drafts a commit message following Conventional Commits. It fires after every Bash tool call and appends a line to ~/.claude/git-commit-helper.log. CX Codex +1 7,093installs git-commit official github A GitHub Copilot skill that turns a working diff into a commit: it reads the changes, stages the related files, writes a Conventional Commits message and runs git commit. CX Codex +1 47,165installs smart-commit Rohit Ghumare smart-commit runs lint, typecheck and tests before a commit, scans staged code for leftovers, then writes a conventional commit message from the diff. CX Codex +1 ★ 2,966repo stars conventional-commit marcelorodrigo Makes AI coding agents write commits to the Conventional Commits spec: type, scope, imperative subject. CX Codex +1 964installs create_git_diff_commit danielmiessler create_git_diff_commit generates git add and git commit commands from a repository diff using Conventional Commits. GP ChatGPT ★ 44,690repo stars

From the same set121

The whole set →
qa-reviewer The qa-reviewer subagent reviews pull requests before merge, checking logic, security, error handling, style, and test coverage without changing code. CX Codex +1 ★ 539repo stars durable-session-state The durable-session-state skill keeps task plans, decisions, validation results, and review verdicts in project files. Use it to pick up long-running work after context compaction or a handoff. CX Codex +1 ★ 539repo stars swarm-pr-feedback swarm-pr-feedback — a skill that works through PR feedback you already have: review notes, GitHub threads, failing checks, conflicts. Everything is verified against the code before a single edit lands. CX Codex +1 ★ 539repo stars swarm-pr-feedback swarm-pr-feedback — a skill that resolves pull request review comments, CI failures, and branch conflicts through structured verification stages. CX Codex +1 ★ 539repo stars test-file-split test-file-split breaks an oversized test file into parts along describe() boundaries when it nears the 500-line cap or blows past it. CX Codex +1 ★ 539repo stars fork-pr-operations fork-pr-operations guides agents through fork pull request workflows: GitHub Actions approval, safe rebasing with force-with-lease, and handling multi-round bot reviews. CX Codex +1 ★ 539repo stars parallel-work-check parallel-work-check is a Claude Code skill that compares local and remote commits on an existing branch and reviews new changes. It helps catch overlapping work before editing. CX Codex +1 ★ 539repo stars design-docs Writes and syncs a project's design docs: domain, technical spec, behavior spec, plus a traceability registry and changelog. CX Codex +1 ★ 539repo stars

Project sponsors

Companies that keep this analytics open