cat
Skill4 starsChanged 6 months agoMITView on GitHub
Guidelines for safely using `cat` and avoiding shell hangs with heredocs. You MUST load this skill before running the `cat` command (especially with `EOF`).
In this repository124 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/AGENTS.mdAGENTS.md
- .github/workflows/AGENTS.mdAGENTS.md
- .vscode/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- agent-log-analysisSkill
- agent-mdSkill
- agent-md-writerSkill
- agent-skill-md-writerSkill
- agentskillsSkill
- agents-md-writerSkill
- ai-prompt-writerSkill
- ansibleSkill
- apache-airflow-apiSkill
- apache-airflow-dagsSkill
- astro-cliSkill
- astronomer-docsSkill
- awesome-copilotSkill
- brainstorm-agent-runsSkill
- brainstorm-github-prSkill
- brainstormSkill
- chrome-devtoolsSkill
- claude-docsSkill
- codeqlSkill
- code-reviewSkill
- code-tourSkill
- coding-standard-writerSkill
- context-aware-opsSkill
- copilot-cliSkill
- copilot-docsSkill
- critical-thinkingSkill
- datadog-agentSkill
- datadog-apiSkill
- datadog-mcpSkill
- datadog-monitorsSkill
- datadog-pulumiSkill
- devcontainerSkill
- dictationSkill
- direnvSkill
- dockerfileSkill
- dockerSkill
- docs-reviewSkill
- docs-writerSkill
- dot-claudeSkill
- dotfilesSkill
- dot-githubSkill
- editorconfigSkill
- fact-writerSkill
- gdpr-compliantSkill
- gh-agent-taskSkill
- gh-apiSkill
- gh-aw-compileSkill
- gh-aw-firewall-debugSkill
- gh-aw-firewallSkill
- gh-aw-newSkill
- gh-awSkill
- gh-aw-troubleshootingSkill
- gh-codespaceSkill
- gh-issueSkill
- gh-modelsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 11
Use caution when running cat or heredocs (<<EOF) in automated environments or agentic runtimes, as missing or truncated EOF delimiters can …
- Distinctive: line 23
When printing massive, multi-gigabyte log files to standard out, which will completely crash the terminal or context window.
- Very specific: line 34
Never use heredocs (cat <<EOF > file.md or command --body "$(cat <<EOF)") for long strings or generated code.
- Very specific: line 57
Use your agentic file-writing tools (like the Write or Edit tool) to create a temporary file first, and then pass that file using commands' …
- Very specific: line 77
When you absolutely must execute cat reading from stdin or a heredoc in a shell command, enforce a timeout so that if it hangs, it will …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cat Skill
Use caution when running cat or heredocs (<<EOF) in automated environments or agentic runtimes, as missing or
truncated EOF delimiters can cause persistent shell hangs.
When to Use
- Using
catto write files. - Using heredoc (
<<EOF) to pass multiline strings. - Reading or streaming file contents.
When Not to Use
- For modifying or appending to files when specific, robust file-writing tools (like the Edit or Write tools) are available.
- When printing massive, multi-gigabyte log files to standard out, which will completely crash the terminal or context window.
- In automated scripts that write complex YAML or JSON where a missing quote or delimiter can silently break the entire file structure.
Common Pitfalls
- Heredoc Hangs: Using
cat <<EOFinside a script without quoting the EOF delimiter or failing to print the delimiter exactly, causing the shell to hang indefinitely waiting for input. - Overwriting Files: Accidentally using
>instead of>>and instantly destroying the contents of a critical configuration file. - Binary Garbling: Running
caton a compiled binary or PDF, dumping control characters into the terminal that corrupt the session's display state.
Avoid Heredocs for Long Strings
Never use heredocs (cat <<EOF > file.md or command --body "$(cat <<EOF)") for long strings or generated code. If the
output gets truncated before the EOF delimiter is printed, the cat command will hang forever waiting for input,
which forces the runtime to cancel the job.
Bad Pattern (Hangs easily)
# DO NOT DO THIS
gh issue comment 123 --body "$(cat <<'EOF'
Very long text...
EOF
)"
# DO NOT DO THIS
cat <<'EOF' > /tmp/file.md
Very long text...
EOFGood Pattern (Safe alternatives)
Alternative 1: Use native file flags
Use your agentic file-writing tools (like the Write or Edit tool) to create a temporary file first, and then pass that
file using commands' native file flags (like --body-file).
# First, use your Write tool to save content to /tmp/comment.md
gh issue comment 123 --body-file /tmp/comment.mdAlternative 2: mktemp and quoted writes
COMMENT_FILE=$(mktemp)
# Use your Write tool to write to $COMMENT_FILE, or use safe quoted echoing if short
echo "Short text" > "$COMMENT_FILE"
gh issue comment 123 --body-file "$COMMENT_FILE"
rm "$COMMENT_FILE" # Always clean up temporary files after useAlways Use Timeouts with Stdin and Heredocs
When you absolutely must execute cat reading from stdin or a heredoc in a shell command, enforce a timeout so that
if it hangs, it will fail fast instead of locking up the workflow. Note that simple file reads like cat somefile.txt
do not typically require a timeout.
timeout 10s cat <<'EOF'
Long text...
EOFRelated Skills
- robust-commands: You MUST load this skill when executing commands requiring resilient error recovery or fallbacks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

