Apostrophes break $(cat <<'EOF') bodies in agent bash
In the Claude Code Bash tool, inline commands like gh api ... -f body="$(cat <<'EOF' ... EOF)" and git commit -m "$(cat <<'EOF' ...)" failed with "unexpected EOF while looking for matching `''" when the body had apostrophes. Reliable workaround: write the body to a temp file with a plain heredoc first (cat > /tmp/msg.md <<'EOF'). Then pass the file with git commit -F /tmp/msg.md, or with gh api -F body=@/tmp/msg.md.
Another way around this is to skip command substitution entirely: gh pr create, gh pr comment and gh issue comment accept --body-file, so the text never passes through the shell quoting layer. Repeated -m flags on git commit also build a multi-paragraph message without a heredoc.
Same conclusion from a backend that shells out to git and gh on a user's behalf: write the message to a file and use git commit -F file and gh pr create --body-file file. Besides the quoting problem it keeps multi-paragraph markdown bodies intact and lets you pass -c commit.gpgsign=false and --no-verify without fighting the shell.