Skip to main content
hooksSource-backed
GitHub logo

PR Title Conventional Commit Reminder - Claude Code Hook

Read-only Claude Code Stop hook that checks the current GitHub pull request title against a Conventional Commits style pattern before the session ends, then falls back to the latest commit subject when no PR title is available.

by MkDev11·added 2026-06-05·
Trigger:Stop
Review first review before installing

Open the source and read safety notes before installing.

Citation facts

Source-backed facts for citing this resource, derived directly from the registry — also available as plain text for AI assistants.

Source URLs
https://www.conventionalcommits.org/en/v1.0.0/, https://github.com/conventional-commits/conventionalcommits.org
Brand
GitHub
Brand domain
github.com
Brand asset source
brandfetch
Safety notes
Runs as a Claude Code Stop hook at the end of a session, not after every file edit., Reads the current git branch, repository root, latest commit subject, and, when GitHub CLI is available, the current branch's PR title and URL., Read-only by default: it does not edit PRs, rewrite commits, stage files, push branches, or create release notes., Default mode is advisory and exits 0 on mismatches so it will not block Claude Code from stopping., Set `PR_TITLE_REMINDER_STRICT=1` only after review; strict mode exits 2 when the PR title or fallback commit subject does not match the configured pattern., Set `PR_TITLE_REMINDER_OFFLINE=1` to skip GitHub CLI lookup and use the latest commit subject only.
Privacy notes
The GitHub CLI lookup may send the repository remote, current branch, authentication context, and PR lookup request to GitHub., Hook output can print sanitized PR title, PR URL, branch name, latest commit subject, and allowed type pattern values to local stderr., No files are uploaded by the script itself, but terminal logs, CI transcripts, screenshots, or support bundles can retain the printed metadata., Use commit-only offline mode for repositories where branch names, PR titles, or private remote metadata should not be queried through GitHub CLI.
Author
MkDev11
Submitted by
MkDev11
Claim status
unclaimed
Last verified
2026-06-05

Decision playbook

Review trust signals before you adopt

Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.

Compare context
Selected

0

Current score

63

Baseline

Delta

No baseline selected

No major trust-signal divergence detected in the current selection.

Source and provenance checks

Needs review

Confirm ownership and provenance before trusting install instructions.

  • Source link availableRequired

    Open the canonical repository and verify ownership.

    Done
  • Source provenance statusRequired

    Marked as source-backed.

    Done
  • Metadata reviewed

    No reviewed flag detected in metadata.

    Pending

Safety and privacy checks

Complete

Validate risk disclosures before installation or API wiring.

  • Safety notes presentRequired

    Review the listed safety guidance before running commands.

    Done
  • Privacy notes presentRequired

    Review data handling notes before connecting accounts or secrets.

    Done
  • Trust level risk gateRequired

    Trust level does not block evaluation.

    Done

Package and install checks

Needs review

Check package metadata and artifact integrity signals.

  • Install payload available

    Install or copy payload is available for review.

    Done
  • Package verification flag

    No package verification flag provided.

    Pending
  • Checksum metadata

    No checksum provided for downloaded artifact.

    Pending

Compare-driven decision checks

Needs review

Use compare context to validate trade-offs before adoption.

  • Compare tray has multiple entries

    Add at least one more entry to compare trust differences.

    Pending
  • Baseline comparison available

    No baseline peer selected yet.

    Pending
  • Diverging trust signals identified

    No major trust-signal divergence found.

    Pending

Setup at a glance

CLI install

Copy-ready — paste the snippet to get started.

5 minutes

Adoption plan

Balanced adoption plan

Current risk score 24/100. Use staged verification before broader rollout.

Risk 24

Pre-adoption checks

Validate source and review signals before any execution.

  • Confirm source provenanceRequired

    Source URL/provenance metadata is present.

    Done
  • Confirm metadata review state

    No review metadata found; increase manual validation.

    Pending
  • Verify install payload

    Install/config payload exists and can be inspected.

    Done

Security checks

Confirm safety, privacy, and package integrity signals.

  • Review safety notesRequired

    Safety notes are present.

    Done
  • Review privacy notesRequired

    Privacy notes are present.

    Done
  • Verify package integrity metadata

    No package verification/checksum metadata.

    Pending

Rollout

Adopt in controlled steps based on the selected plan.

  • Run in isolated sandbox firstRequired

    Use a constrained sandbox and observe behavior across multiple tasks.

    Pending
  • Roll out graduallyRequired

    Roll out to a small cohort before wider usage.

    Pending
  • Set monitoring and fallback

    Define rollback path and monitor errors after adoption.

    Pending

Evidence readiness

Evidence readiness matrix · balanced

Missing required evidence: Metadata review. Risk score 31.

Risk 31

Source provenance

Present

Source repository/provenance is listed.

Required in this preset

Metadata review

Missing

Review metadata is missing.

Required in this preset

Safety notes

Present

Safety notes are present.

Required in this preset

Privacy notes

Present

Privacy notes are present.

Optional in this preset

Package integrity

Missing

Package integrity metadata is missing.

Optional in this preset

Install payload

Present

Install payload is available.

Required in this preset

Required gaps: Metadata review

Decision timeline

Decision timeline · balanced

Blocking gaps: Check metadata review status. Risk 28.

Risk 28

triage

Confirm source provenanceRequired

Source/provenance metadata is available.

Done

triage

Check metadata review statusRequired

Review metadata is missing.

Pending

verify

Review safety notesRequired

Safety notes are available.

Done

verify

Review privacy notes

Privacy notes are available.

Done

verify

Validate package integrity metadata

Package integrity metadata is missing.

Pending

rollout

Verify install payload and commandsRequired

Install payload is available.

Done

Blockers: Check metadata review status

Prerequisite readiness

Prerequisite readiness

4 prerequisites to line up before setup.

0/4 ready
Install & runtime2Permissions & scopes1General15 minutes

Safety & privacy surface

Safety & privacy surface

6 safety and 4 privacy notes across 4 risk areas. Review closely: credentials & tokens, network access.

4 areas
  • SafetyCredentials & tokensRuns as a Claude Code Stop hook at the end of a session, not after every file edit.
  • SafetyGeneralReads the current git branch, repository root, latest commit subject, and, when GitHub CLI is available, the current branch's PR title and URL.
  • SafetyLocal filesRead-only by default: it does not edit PRs, rewrite commits, stage files, push branches, or create release notes.
  • SafetyGeneralDefault mode is advisory and exits 0 on mismatches so it will not block Claude Code from stopping.
  • SafetyGeneralSet `PR_TITLE_REMINDER_STRICT=1` only after review; strict mode exits 2 when the PR title or fallback commit subject does not match the configured pattern.
  • SafetyGeneralSet `PR_TITLE_REMINDER_OFFLINE=1` to skip GitHub CLI lookup and use the latest commit subject only.
  • PrivacyNetwork accessThe GitHub CLI lookup may send the repository remote, current branch, authentication context, and PR lookup request to GitHub.
  • PrivacyGeneralHook output can print sanitized PR title, PR URL, branch name, latest commit subject, and allowed type pattern values to local stderr.
  • PrivacyNetwork accessNo files are uploaded by the script itself, but terminal logs, CI transcripts, screenshots, or support bundles can retain the printed metadata.
  • PrivacyNetwork accessUse commit-only offline mode for repositories where branch names, PR titles, or private remote metadata should not be queried through GitHub CLI.

Safety notes

  • Runs as a Claude Code Stop hook at the end of a session, not after every file edit.
  • Reads the current git branch, repository root, latest commit subject, and, when GitHub CLI is available, the current branch's PR title and URL.
  • Read-only by default: it does not edit PRs, rewrite commits, stage files, push branches, or create release notes.
  • Default mode is advisory and exits 0 on mismatches so it will not block Claude Code from stopping.
  • Set `PR_TITLE_REMINDER_STRICT=1` only after review; strict mode exits 2 when the PR title or fallback commit subject does not match the configured pattern.
  • Set `PR_TITLE_REMINDER_OFFLINE=1` to skip GitHub CLI lookup and use the latest commit subject only.

Privacy notes

  • The GitHub CLI lookup may send the repository remote, current branch, authentication context, and PR lookup request to GitHub.
  • Hook output can print sanitized PR title, PR URL, branch name, latest commit subject, and allowed type pattern values to local stderr.
  • No files are uploaded by the script itself, but terminal logs, CI transcripts, screenshots, or support bundles can retain the printed metadata.
  • Use commit-only offline mode for repositories where branch names, PR titles, or private remote metadata should not be queried through GitHub CLI.

Prerequisites

  • Claude Code CLI with hooks enabled.
  • bash, git, grep, sed, and tr available on PATH.
  • GitHub CLI is optional but recommended; the hook uses `gh pr view` only for read-only PR-title lookup.
  • A repository PR-title policy based on Conventional Commits or a custom `PR_TITLE_CONVENTIONAL_TYPES` allowlist.

Schema details

Install type
cli
Reading time
6 min
Difficulty score
31
Troubleshooting
Yes
Breaking changes
No
Source repository stats
Scope
Source repo
Runtime and command metadata
Trigger
Stop
Script language
bash
Script body
#!/usr/bin/env bash
set -u

# Claude Code Stop hook. Checks the current PR title with GitHub CLI when a
# branch has an open PR, then falls back to the latest commit subject. The
# default mode is advisory and exits 0. Set PR_TITLE_REMINDER_STRICT=1 to exit
# 2 on a mismatch.

DEFAULT_TYPE_PATTERN="build|chore|ci|content|docs|feat|fix|perf|refactor|revert|style|test"
TYPE_PATTERN="${PR_TITLE_CONVENTIONAL_TYPES:-$DEFAULT_TYPE_PATTERN}"
TYPE_PATTERN=$(printf '%s' "$TYPE_PATTERN" | tr ',' '|')
CONVENTIONAL_RE="^(${TYPE_PATTERN})(\\([A-Za-z0-9._/-]+\\))?!?: .+"

is_conventional() {
  printf '%s\n' "$1" | grep -Eq "$CONVENTIONAL_RE"
}

sanitize_for_terminal() {
  # PR titles, branch names, and commit subjects can come from untrusted
  # repositories. Strip C0 and DEL control bytes before printing them so
  # terminal escape sequences (for example OSC 52) are not emitted raw.
  printf '%s' "$1" | LC_ALL=C tr -d '\000-\037\177'
}

finish_mismatch() {
  label=$(sanitize_for_terminal "$1")
  value=$(sanitize_for_terminal "$2")
  extra=$(sanitize_for_terminal "${3:-}")
  type_pattern=$(sanitize_for_terminal "$TYPE_PATTERN")

  printf 'PR title reminder: %s does not look like a Conventional Commits title.\n' "$label" >&2
  printf '  Found: %s\n' "$value" >&2
  printf '  Expected: type(scope): summary, for example content(hooks): add reminder hook\n' >&2
  printf '  Allowed types: %s\n' "$type_pattern" >&2
  if [ -n "$extra" ]; then
    printf '  %s\n' "$extra" >&2
  fi

  if [ "${PR_TITLE_REMINDER_STRICT:-0}" = "1" ]; then
    exit 2
  fi
  exit 0
}

if ! command -v git >/dev/null 2>&1; then
  exit 0
fi

PROJECT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null || true)
if [ -z "$PROJECT_ROOT" ]; then
  exit 0
fi

cd "$PROJECT_ROOT" 2>/dev/null || exit 0

BRANCH=$(git branch --show-current 2>/dev/null || true)
if [ -z "$BRANCH" ]; then
  exit 0
fi

case "$BRANCH" in
  main|master|trunk)
    if [ "${PR_TITLE_REMINDER_CHECK_DEFAULT:-0}" != "1" ]; then
      exit 0
    fi
    ;;
esac

if [ "${PR_TITLE_REMINDER_OFFLINE:-0}" != "1" ] && command -v gh >/dev/null 2>&1; then
  PR_DATA=$(gh pr view --json title,url,headRefName --template '{{.title}}{{"\n"}}{{.url}}{{"\n"}}{{.headRefName}}{{"\n"}}' 2>/dev/null || true)
  PR_TITLE=$(printf '%s\n' "$PR_DATA" | sed -n '1p')
  PR_URL=$(printf '%s\n' "$PR_DATA" | sed -n '2p')
  PR_HEAD=$(printf '%s\n' "$PR_DATA" | sed -n '3p')

  if [ -n "$PR_TITLE" ]; then
    if is_conventional "$PR_TITLE"; then
      exit 0
    fi

    EXTRA="PR: $PR_URL"
    if [ -n "$PR_HEAD" ]; then
      EXTRA="PR: $PR_URL (head: $PR_HEAD)"
    fi
    finish_mismatch "current PR title" "$PR_TITLE" "$EXTRA"
  fi
fi

SUBJECT=$(git log -1 --pretty=%s 2>/dev/null || true)
if [ -z "$SUBJECT" ]; then
  exit 0
fi

if is_conventional "$SUBJECT"; then
  exit 0
fi

finish_mismatch "latest commit subject on $BRANCH" "$SUBJECT" "No current PR title was available; install and authenticate gh, or set PR_TITLE_REMINDER_OFFLINE=1 for commit-only mode."
Collection metadata
Estimated setup
5 minutes
Difficulty
beginner
Full copyable content
{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/pr-title-conventional-commit-reminder.sh"
          }
        ]
      }
    ]
  }
}

About this resource

Overview

This hook gives a final local reminder before a Claude Code session stops: is the current PR title ready for release tooling?

It uses Conventional Commits as the default title shape, including the repository-specific content type used by this directory's content PR workflow. When gh is installed and authenticated, the hook reads the current branch's PR title with gh pr view. When no PR is available, it falls back to the latest commit subject so a contributor still gets a useful reminder before pushing or opening a PR.

Features

  • Checks the current GitHub PR title at session stop, after Claude has finished editing and before a human is likely to open or update a PR.
  • Falls back to the latest commit subject when GitHub CLI is missing, unauthenticated, offline, or the current branch has no PR.
  • Accepts common Conventional Commits types plus content by default: build, chore, ci, content, docs, feat, fix, perf, refactor, revert, style, and test.
  • Supports custom type policy with PR_TITLE_CONVENTIONAL_TYPES, using either a pipe-separated or comma-separated list.
  • Stays advisory by default and can be made blocking only with the explicit PR_TITLE_REMINDER_STRICT=1 opt-in.

How It Works

On Stop, the hook confirms it is running inside a git work tree and skips default branches such as main, master, and trunk unless PR_TITLE_REMINDER_CHECK_DEFAULT=1 is set.

For feature branches, it first tries a read-only gh pr view --json title,url,headRefName. If a PR title is found, the title must match:

type(scope): summary

The scope is optional and a breaking-change bang is allowed, so feat!: remove legacy endpoint and fix(api): handle empty cursor both pass. If no PR title is available, the same check runs against git log -1 --pretty=%s.

Use Cases

  • Keep squash-merge PR titles release-note ready in repositories that generate changelogs or release notes from merge commit subjects.
  • Nudge Claude to update a vague title such as updates before the contributor requests review.
  • Support content repositories whose PR titles use a custom type like content(hooks): add package policy hook.
  • Keep the reminder local and lightweight instead of adding a repository-wide required check.

Installation

  1. Create the hooks directory: mkdir -p .claude/hooks
  2. Create the hook file: touch .claude/hooks/pr-title-conventional-commit-reminder.sh
  3. Paste the script body into that file and make it executable: chmod +x .claude/hooks/pr-title-conventional-commit-reminder.sh
  4. Add the configuration below to .claude/settings.json for a project hook or ~/.claude/settings.json for a user hook.
  5. Authenticate GitHub CLI with gh auth login if you want PR-title lookup.

Hook Configuration

{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/pr-title-conventional-commit-reminder.sh"
          }
        ]
      }
    ]
  }
}

Configuration

  • PR_TITLE_CONVENTIONAL_TYPES - allowed type names, separated by | or ,. Defaults to build|chore|ci|content|docs|feat|fix|perf|refactor|revert|style|test.
  • PR_TITLE_REMINDER_STRICT=1 - exit 2 on a mismatch. Leave unset for the default advisory behavior.
  • PR_TITLE_REMINDER_OFFLINE=1 - skip GitHub CLI lookup and check only the latest commit subject.
  • PR_TITLE_REMINDER_CHECK_DEFAULT=1 - check main, master, or trunk instead of skipping default branches.

Limitations

  • The hook checks title shape, not whether the title accurately describes the diff.
  • GitHub CLI looks up the PR for the current branch, so forks, renamed remotes, or multiple matching PRs can require normal gh configuration first.
  • Custom scopes are treated syntactically; the hook does not know whether api, docs, or hooks are approved scopes for a repository.
  • Strict mode can interrupt a stop workflow, so enable it only after the team agrees on title policy and false-positive handling.

Related Content Fit

This entry is intentionally narrower than the existing git-smart-commit command, git pre-commit validator hook, Husky commit governance skill, and contributor commit/changelog rules. Those entries help create or review commits and release policy. This hook adds a session-end runtime reminder focused on the current PR title, with explicit GitHub CLI network/account disclosure and an offline fallback.

Source and References

Source citations

Add this badge to your README

Show that PR Title Conventional Commit Reminder - Claude Code Hook is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/hooks/pr-title-conventional-commit-reminder-hook.svg)](https://heyclau.de/entry/hooks/pr-title-conventional-commit-reminder-hook)

How it compares

PR Title Conventional Commit Reminder - Claude Code Hook side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.

3 trust signals differ across this comparison (Package trust, Source provenance, Submitter).

Next steps differ across entries — use the actions in the table below to copy install commands and source links per resource.

Field

Read-only Claude Code Stop hook that checks the current GitHub pull request title against a Conventional Commits style pattern before the session ends, then falls back to the latest commit subject when no PR title is available.

Open dossier

Slash command that drafts release notes from the Conventional Commits made since the last release tag.

Open dossier

Source-backed rules for contributor pull requests that need clear commit messages, release-note-ready changelog entries, issue links, breaking-change markers, and privacy-safe history.

Open dossier

Expert release-changelog capability pack for git-cliff with conventional commits, deterministic release notes, and low-maintenance versioning.

Open dossier
Next stepsDiffers
Trust
Review statusNot reviewedNot reviewedNot reviewedNot reviewed
Package trustDiffersPackage not verifiedPackage not verifiedPackage not verifiedPackage verified2026-04-11
Source provenanceDiffersSource-backedSource-backedSource-backedNo submission link
SubmitterDiffersMkDev11jony376MkDev11
Install riskReview firstReview firstReview firstReview first
Notes Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓ Safety ✓ Privacy ✓
BrandGitHub logoGitHub
Categoryhookscommandsrulesskills
SourceSource-backedSource-backedSource-backedFirst-party
AuthorMkDev11jony376MkDev11JSONbored
Added2026-06-052026-06-042026-06-042026-04-11
Platforms
Harness
Source repo
Safety notesRuns as a Claude Code Stop hook at the end of a session, not after every file edit. Reads the current git branch, repository root, latest commit subject, and, when GitHub CLI is available, the current branch's PR title and URL. Read-only by default: it does not edit PRs, rewrite commits, stage files, push branches, or create release notes. Default mode is advisory and exits 0 on mismatches so it will not block Claude Code from stopping. Set `PR_TITLE_REMINDER_STRICT=1` only after review; strict mode exits 2 when the PR title or fallback commit subject does not match the configured pattern. Set `PR_TITLE_REMINDER_OFFLINE=1` to skip GitHub CLI lookup and use the latest commit subject only.Read-only with respect to your repository when refs are validated and passed as git arguments; it only reads git history (tags and commit log) and never creates tags, commits, branches, or release artifacts. Validate the optional ref or discovered tag with `git rev-parse --verify --quiet <ref>^{commit}` and reject refs containing shell metacharacters before reading history. It proposes a version bump and notes for you to review; it does not publish a release or push anything.Commit messages, PR titles, and changelog entries become durable release history; misleading text can cause incorrect SemVer bumps, missed migrations, or hidden breaking changes. Do not hide security fixes, data migrations, dependency trust changes, deprecations, or public API changes inside vague commit messages such as update, cleanup, or misc. When release tooling parses commit history, malformed types, missing breaking-change markers, or noisy commits can publish incorrect release notes.May produce commands or configuration for live infrastructure, CI, releases, or indexing; test changes in staging or dry-run mode first. Use least-privilege API tokens and review workflow, deploy, DNS, cache, and release changes before applying them to production.
Privacy notesThe GitHub CLI lookup may send the repository remote, current branch, authentication context, and PR lookup request to GitHub. Hook output can print sanitized PR title, PR URL, branch name, latest commit subject, and allowed type pattern values to local stderr. No files are uploaded by the script itself, but terminal logs, CI transcripts, screenshots, or support bundles can retain the printed metadata. Use commit-only offline mode for repositories where branch names, PR titles, or private remote metadata should not be queried through GitHub CLI.Commit subjects, bodies, and author names from the selected range are included in the model's context to draft the notes. If commit messages contain internal identifiers, customer names, or unreleased details, those become part of the prompt; review the range before running on a private history. The command writes nothing to disk on its own.Commit subjects, changelog entries, issue links, and release notes can expose customer names, account IDs, private roadmap items, vulnerability details, incident context, internal hostnames, or partner information. Use synthetic examples and public-safe wording in changelog entries; move sensitive incident or vulnerability details to approved private advisories or security channels. Review generated release notes before publication because they may combine private branch names, issue titles, commit bodies, and contributor text.Inputs can include repository metadata, workflow logs, deployment settings, domain names, analytics exports, and service configuration. Redact tokens, account IDs, private URLs, customer data, and proprietary deployment details before sharing generated reports or prompts.
Prerequisites
  • Claude Code CLI with hooks enabled.
  • bash, git, grep, sed, and tr available on PATH.
  • GitHub CLI is optional but recommended; the hook uses `gh pr view` only for read-only PR-title lookup.
  • A repository PR-title policy based on Conventional Commits or a custom `PR_TITLE_CONVENTIONAL_TYPES` allowlist.
— none listed
  • A contributor pull request with commit history, PR title, PR body, and enough diff context to decide whether release notes are needed.
  • Repository guidance for commit style, squash/merge behavior, changelog format, issue-linking expectations, and release process.
  • Access to the current changelog, release notes, linked issues, and any generated release-preview output used by maintainers.
  • Permission to request a title, commit, changelog, or PR body update before merge.
  • Conventional commit policy
  • Git tags access
  • Release workflow ownership
Install
mkdir -p .claude/hooks && touch .claude/hooks/pr-title-conventional-commit-reminder.sh && chmod +x .claude/hooks/pr-title-conventional-commit-reminder.sh
/draft-release-notes [from-ref]
curl -L https://heyclau.de/downloads/skills/git-cliff-release-changelog-capability-pack.zip -o git-cliff-release-changelog-capability-pack.zip && unzip -o git-cliff-release-changelog-capability-pack.zip -d ./git-cliff-release-changelog-capability-pack
Config
{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/pr-title-conventional-commit-reminder.sh"
          }
        ]
      }
    ]
  }
}
Citations
ClaimUnclaimedUnclaimedUnclaimedUnclaimed
Open 4 picks in the interactive comparison tool

Related guides

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.