shell-heredoc-and-multiline-strings

shell-heredoc-and-multiline-strings is a skill for Claude Code, Codex from chen3feng/agent-skills. It costs 31 tokens per session (3,587 once invoked), scanned C, original, Apache-2.0.

A guide for safely passing long or multi-line text through an agent's shell. A shell is the command-line program that runs commands such as commit or pull-request tools.

In plain words
What is it for?
Sending multi-line commit messages, pull-request descriptions, SQL, and other long text through shell commands.
Why use it?
It helps prevent quotes, backticks, dollar signs, and line breaks from changing the text or leaving the command waiting for input.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Sending multi-line commit messages, pull-request descriptions, SQL, and other long text through shell commands.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add chen3feng/agent-skills --skill shell-heredoc-and-multiline-strings
Clone the repo
git clone --depth 1 https://github.com/chen3feng/agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for shell-heredoc-and-multiline-strings

README.md
[![agentmods](https://agentmods.dev/badge/skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings/github.svg)](https://agentmods.dev/skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings)
Your own site
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for shell-heredoc-and-multiline-strings

Your own site · 80×15
<a href="https://agentmods.dev/skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings"><img src="https://agentmods.dev/badge/skills/chen3feng/agent-skills/shell-heredoc-and-multiline-strings.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,587 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00031 $0.03587
Opus 5 $0.00015 $0.01793
Sonnet 5 $0.00006 $0.00717
Haiku 4.5 $0.00003 $0.00359

Measured 9d ago against content hash bb18b693d10f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade C, and why

shell-heredoc-and-multiline-strings scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

(`/bin/rm -rf .agent/scratchpad/*` when convenient, or let it live —
skills/shell-heredoc-and-multiline-strings/SKILL.md · 331 lines

How it starts

The opening of the file, as written. The whole thing — 331 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Multi-line strings through an agent shell

When to use

You need to supply a multi-line string to a command — a commit message, a gh pr create --body, a SQL snippet — from an AI agent's terminal tool.

Problem

Agent terminals often paste multi-line commands with subtle whitespace/newline mangling. Observed failures:

  • Heredocs that silently truncate at the first embedded ' or `.
  • $(cat <<'EOF' … EOF) producing a stray cmdsubst heredoc> prompt the agent never escapes, leaving a process wedged in the background.
  • In zsh, wrapping a heredoc inside a double-quoted command-substitution — gh pr create --body "$(cat <<'EOF' … EOF)" — hangs at cmdand dquote> / cmdand quote> prompts as soon as the heredoc body contains triple-backtick fences, embedded $(…), or backslashes. zsh's parser can no longer tell whether quotes are balanced and waits forever for input. Common symptom: the terminal tool reports "command was running, but the user actively interrupted" with a transcript full of cmdand dquote> lines.
  • Quoted multi-line -m strings being split at newlines, so only the first line becomes the commit title and the rest is interpreted as extra git arguments — sometimes parsed as -c config keys (see error: key does not contain a section).
  • Multiple -m flags where one flag's value contains embedded newlines (e.g. git commit -m 'title' -m 'para1' -m 'line1\nline2\nline3'). The agent terminal → shell → git chain re-interprets the real newlines inside the quoted argument: the shell sees an unclosed quote and drops into a quote> / dquote> continuation prompt, waiting forever for input. Symptom is identical to the heredoc hang: the terminal tool reports the command as running but the user has to interrupt. This failure mode persists even when each individual -m value looks "safe" in isolation — it only takes one multi-line value anywhere in the argv to wedge the parse.

Solution

Read the full file on GitHub · 331 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 331 lines · 31 tokens per session scan C bb18b693d10f

Subscribe to this mod's changes

shell-heredoc-and-multiline-strings is a skill published in the GitHub repository chen3feng/agent-skills (5 stars, last pushed 4mo ago), licensed Apache-2.0. It adds 31 tokens to every session and 3,587 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

github-operations

GitHub CLI operations for issues, PRs, milestones, and Projects v2. Covers gh commands, REST API patterns, and automation scripts. Use when managing GitHub issues, PRs, milestones, or Projects with gh.

yonatangross/orchestkit · 50 tokens

coding-standards

Repository coding standards, linters, formatters, CLI design rules, HTTP caching guidelines, and git commit message conventions (Conventional Commits). Includes scripts for formatting Python, shell, Markdown, Kotlin, JSON, and XML. Use when writing, reviewing, formatting, or linting code, verifying CLI ergonomics…

ithinkihaveacat/dotfiles · 81 tokens

semantic-commit

A Git workflow for splitting mixed code changes into separate conventional commits. Conventional commits use a predictable format such as feat, fix, or test to describe each change.

AndrewDongminYoo/cc-agents-kit · 50 tokens

create-pr

Creates a GitHub PR with a Linear-ticket-prefixed title and a decision-led, narrative description for prisma-next. Use when the user wants to create a pull request, open a PR, or submit changes for review.

prisma/orm · 47 tokens

github-pr-description

Generate and create pull request descriptions automatically using GitHub CLI. Use when the user asks to create a PR, generate a PR description, make a pull request, or submit changes for review. Analyzes git diff and commit history to create comprehensive, meaningful PR descriptions that explain what changed, why it…

tailcallhq/forgecode · 72 tokens

git-commit

Generate well-formatted git commit messages following conventional commit standards.

ThinkInAIXYZ/deepchat · 15 tokens