Appearance
pr-writing-reminder.sh
.claude/hooks/pr-writing-reminder.sh
PreToolUse
When a PR or issue BODY is written via the GitHub MCP tools, inject a pointer to the writing standard (docs/agents/pr-writing.md) so it's surfaced at the moment of writing rather than carried always-on. Reminder only; Claude applies the standard. Registered in settings.json under PreToolUse for mcp__github__create_pull_request | mcp__github__update_pull_request | mcp__github__issue_write. jq parses the hook's stdin JSON.
Source
bash
#!/usr/bin/env bash
#
# PreToolUse hook — when a PR or issue BODY is written via the GitHub MCP tools,
# inject a pointer to the writing standard (docs/agents/pr-writing.md) so it's
# surfaced at the moment of writing rather than carried always-on. Reminder only;
# Claude applies the standard.
#
# Registered in settings.json under PreToolUse for
# mcp__github__create_pull_request | mcp__github__update_pull_request |
# mcp__github__issue_write. jq parses the hook's stdin JSON.
set -euo pipefail
input="$(cat)"
tool="$(jq -r '.tool_name // empty' <<<"$input")"
body="$(jq -r '.tool_input.body // empty' <<<"$input")"
# Only fire when an actual body is being written — skip label-only / state-only
# updates (closing a PR, adding a label) which carry no body.
[ -n "$body" ] || exit 0
case "$tool" in
mcp__github__create_pull_request|mcp__github__update_pull_request|mcp__github__issue_write)
jq -n --arg ctx "Gate: you're writing a PR/issue body. Follow the standard in docs/agents/pr-writing.md — it applies at EVERY size: a plain-language lead first, then a \`> [!IMPORTANT]\` decision alert if the change made a decision, emoji-anchored \`##\` section headings, no hand-added attribution (the platform appends its own on PRs), and clickable #refs. Apply the kind + Area labels when opening (docs/agents/triage-labels.md). Read the doc if unsure — dropping the style because a change 'looks small' is the recurring miss." \
'{hookSpecificOutput: {hookEventName: "PreToolUse", additionalContext: $ctx}}'
;;
esac
exit 0