# Escaping YAML

> Escapes user-supplied strings for safe embedding in YAML documents: quotes, special characters, multi-line blocks, and type-coercion traps. Use when the user asks to escape, quote, or safely embed a value in YAML.

- Skill: `brokenrobot-xyz/escaping-yaml` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add brokenrobot-xyz/escaping-yaml`
- Raw SKILL.md: https://api.skillmd.com/api/skills/brokenrobot-xyz/escaping-yaml/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: brokenrobot-xyz (https://skillmd.com/u/brokenrobot-xyz)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/brokenrobot-xyz/escaping-yaml

---


# Escape a value for YAML

Produce the safely quoted form of the value the user supplies.

## Steps

1. Inspect the value for YAML special characters, leading/trailing whitespace, and strings YAML
   would coerce to another type (`yes`, `no`, `null`, version-like numbers).
2. Choose the quoting style: single quotes by default; double quotes when the value contains
   single quotes or control characters; a literal block (`|`) for multi-line values.
3. Never emit an unquoted scalar for user-supplied input.
4. Show the escaped value and the reason the quoting style was chosen.

## Output

The escaped value in a fenced code block, followed by one sentence naming the quoting style and
why.

