# Python Heredoc

> When running multi-line Python code or code with quotes, apostrophes, or f-strings via Bash, always use heredoc syntax instead of python -c to avoid shell quoting issues.

- **Type:** Skill
- **Install:** `agentstack add skill-crypdick-pynchy-python-heredoc`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [crypdick](https://agentstack.voostack.com/s/crypdick)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [crypdick](https://github.com/crypdick)
- **Source:** https://github.com/crypdick/pynchy/tree/main/src/pynchy/agent/skills/python-heredoc
- **Website:** https://pynchy.ricardodecal.com/

## Install

```sh
agentstack add skill-crypdick-pynchy-python-heredoc
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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

```bash
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

```bash
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

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [crypdick](https://github.com/crypdick)
- **Source:** [crypdick/pynchy](https://github.com/crypdick/pynchy)
- **License:** MIT
- **Homepage:** https://pynchy.ricardodecal.com/

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-crypdick-pynchy-python-heredoc
- Seller: https://agentstack.voostack.com/s/crypdick
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
