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.

brokenrobot-xyz c92417d 2 files · 1.5 KB Updated

File contents

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.

brokenrobot-xyz/agent-skills/tree/main/plugins/agent-authoring-toolkit/skills/reviewing-claude-skills/evals/files/eval-waiver-respected/escaping-yaml commit c92417d05f

Frequently asked questions

npx skillmds@latest add brokenrobot-xyz/escaping-yaml