agentsclimarketplace

Github cli workarounds

Skill ceilidhboy/skills/skills/github-cli-workarounds

Agent skills for Laravel and PHP development. Installable via npx skills@latest add ceilidhboy/skills

Install
npx -y skills add ceilidhboy/skills --skill github-cli-workarounds

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Workarounds for shell escaping issues when using the GitHub CLI (`gh`) for creating issues, gists, and pull requests with content containing special characters like `$`, backticks, or quotes. Use when creating GitHub issues, gists, or pull requests where content contains `$variables`, backtick-enclosed code, or multi-line bodies that cause shell parsing errors.

SKILL.md

2.9 KB, as published. Nobody here has run it

GitHub CLI Workarounds

The Problem

When using gh issue create --body "..." or gh gist create with inline content, the shell interprets special characters:

  • $variable — expanded as a shell variable (e.g., $content, $images)
  • Backticks ` — interpreted as command substitution
  • Double quotes — broken nesting with the shell's quoting

This causes Syntax error: word unexpected or truncated content.

The Fix: Always Use Temp Files

For Issues

Write the body to a temp file, then use --body-file:

cat > /tmp/gh-body.md << 'ISSUEBODY'
Content with $variables, `backticks`, and "quotes" works fine here.
ISSUEBODY

gh issue create --repo owner/repo \
  --title "Issue title" \
  --body-file /tmp/gh-body.md \
  --label enhancement

Important: Use << 'EOF' (single-quoted delimiter) to prevent shell expansion in the heredoc.

For Gists

Write to a temp file, then pipe it:

cat > /tmp/gh-gist-content.md << 'GISTCONTENT'
Content with $variables here.
GISTCONTENT

gh gist create /tmp/gh-gist-content.md --desc "Description"

For Pull Requests

Same pattern as issues:

cat > /tmp/gh-pr-body.md << 'PRBODY'
PR description with $special chars.
PRBODY

gh pr create --repo owner/repo \
  --title "PR title" \
  --body-file /tmp/gh-pr-body.md

Why This Works

  • The heredoc (<< 'EOF') with a quoted delimiter prevents ALL shell expansion
  • --body-file reads the file directly, bypassing shell parsing entirely
  • No escaping, no quoting gymnastics, no syntax errors

Common Pitfall: \n in Multi-line Bodies

Inside bash single quotes, \n is two literal characters (backslash + n), not a newline. This means:

# BROKEN — \n is literal text, not a newline
ga pr create --body 'line1\nline2'

# BROKEN — same issue with ga api -F
ga api ... -F body="line1\nline2"

# WORKS — heredoc + --body-file (or --field with real newlines)
cat > /tmp/body.md << 'BODY'
line1
line2
BODY
ga pr create --body-file /tmp/body.md

Rule of thumb: Any time your body/description has more than one line, use --body-file with a heredoc. Never use \n in inline --body / -F arguments — it will appear literally on GitHub.

When to Activate This Skill

  • Creating GitHub issues, gists, or pull requests where the content contains PHP code examples with $variables, backtick-enclosed code, or special characters
  • Any gh command where the body/description is longer than a single line or contains syntax examples

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.