python-heredoc

A shell-use guide for running multi-line Python code with a quoted heredoc, a block of text passed directly to a command. It also specifies using Pynchy's uv-based Python command.

In plain words
What is it for?
Running longer Python snippets or snippets with complex quoting from Bash, including code that needs additional dependencies.
Why use it?
It prevents shell quoting problems when Python contains quotes, apostrophes, f-strings, or multiple statements.

Skill for Claude CodeCodex

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.

agentmods
npx agentmods add skills/crypdick/pynchy/python-heredoc
Any agent
npx skills add crypdick/pynchy --skill python-heredoc
Clone the repo
git clone --depth 1 https://github.com/crypdick/pynchy

Made for: Claude Code, Codex.

Per session 43 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 306 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
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 $0.00043 $0.00306
Opus 5 $0.00022 $0.00153
Sonnet 5 $0.00009 $0.00061
Haiku 4.5 $0.00004 $0.00031

Measured yesterday against content hash 0a9121fdeefc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

python-heredoc scanned grade A 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 yesterday.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

resp = requests.get("https://api.example.com/data")
data/defaults/skills/python-heredoc/SKILL.md · 41 lines

What it actually says

Python Heredoc Pattern

Run Python via Bash? Never python -c "..." beyond trivial one-liners. Shell quoting break on f-strings, apostrophes, nested quotes, escape sequences.

Use heredoc syntax instead

uv run python << 'PYTHON_CODE'
import json

data = {"name": "it's working", "value": f"{1 + 2}"}
print(json.dumps(data, indent=2))
PYTHON_CODE

Single quotes round 'PYTHON_CODE' block shell var expansion. $variables and backticks stay literal Python.

With dependencies

uv run --with requests python << 'PYTHON_CODE'
import requests

resp = requests.get("https://api.example.com/data")
print(resp.json())
PYTHON_CODE

Rules

  1. Always uv run python (not bare python or python3)
  2. Always quote delimiter: << 'PYTHON_CODE' (not << PYTHON_CODE)
  3. Closing PYTHON_CODE own line, no leading whitespace
  4. Never python -c for code with quotes, f-strings, multiple statements
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. yesterday First seen · 41 lines · 43 tokens per session scan A 0a9121fdeefc

Subscribe to this mod's changes

python-heredoc is a skill published in the GitHub repository crypdick/pynchy (10 stars, last pushed 7d ago), licensed MIT. It adds 43 tokens to every session and 306 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). 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

migrate-from-openclaw

Migrate from OpenClaw to NanoClaw v2. Detects an existing OpenClaw installation, extracts identity, channel credentials, scheduled tasks, and other config, then guides interactive migration. Triggers on "migrate from openclaw", "openclaw migration", "import from openclaw".

nanocoai/nanoclaw · 71 tokens

add-dial-tool

Give chosen NanoClaw agents a real phone number as a container tool — the dial CLI baked into the agent image plus OneCLI credential injection for api.getdial.ai, scoped per agent, so the agents you pick can send SMS, place AI voice calls, and receive verification codes from inside the sandbox. Independent of the Dial…

nanocoai/nanoclaw · 117 tokens

add-imessage

Add iMessage to NanoClaw — one channel, two backends. Local (this Mac's chat.db via the Chat SDK bridge; macOS + Full Disk Access) or Hosted iMessage (via photon.codes — native spectrum-ts with a device-login wizard; any OS, no Mac relay). Triggers on "add imessage", "connect imessage", "add photon", "imessage via…

nanocoai/nanoclaw · 92 tokens

add-signal

Add Signal channel integration via signal-cli device-link. Native adapter — no Chat SDK bridge.

nanocoai/nanoclaw · 22 tokens

add-telegram

Add Telegram channel integration via Chat SDK.

nanocoai/nanoclaw · 12 tokens

migrate-slack-agents

Migrate a classic single-bot Slack install to one provisioned Slack app per existing agent group while preserving agent identities, workspaces, memory, and wiring behavior — or record the operator's choice to stay on classic, which remains supported. Use when /update-nanoclaw surfaces the Slack agents requirement, or…

nanocoai/nanoclaw · 75 tokens