/to-toon:to-toonfrom to-toon
Converts structured data (JSON, XML, YAML) to compact TOON format (Token-Oriented Object Notation) with 30-60% token savings. Use when compressing API responses, Figma MCP output, config files, or any structured data for token efficiency.
Ships in to-toon. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Convert any structured data (JSON, XML, YAML) to compact TOON format for efficient LLM processing.
# Direct conversion
npx @toon-format/cli input.json -o output.toon
# From stdin
echo '{"name": "Ada", "age": 30}' | npx @toon-format/cli
# With token savings stats
npx @toon-format/cli data.json --stats
npx @toon-format/cli data.toon -o output.json
# Use included script for XML (e.g., Figma MCP output)
${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh input.xml
# Or manual: XML → JSON → TOON
cat input.xml | node ${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-json.mjs | npx @toon-format/cli
# Encode JSON to TOON (auto-detected by extension)
npx @toon-format/cli input.json -o output.toon
# Decode TOON to JSON (auto-detected)
npx @toon-format/cli data.toon -o output.json
# Pipe from stdin
cat data.json | npx @toon-format/cli
echo '{"name": "Ada"}' | npx @toon-format/cli
# Output to stdout
npx @toon-format/cli input.json
# Show token savings
npx @toon-format/cli data.json --stats
TOON combines YAML-like syntax with CSV-style tabular arrays:
# Key-value pairs
name: Ada
age: 30
# Nested objects
address:
city: Berlin
zip: 10115
# Uniform arrays (most compact!)
users[3]{id,name,email}:
1,Alice,[email protected]
2,Bob,[email protected]
3,Carol,[email protected]
| Input Format | JSON Tokens | TOON Tokens | Savings |
|---|---|---|---|
| Simple object | 50 | 30 | 40% |
| Array of 10 objects | 500 | 200 | 60% |
| Nested config | 1000 | 450 | 55% |
| Figma design context | 10000 | 4000 | 60% |
curl -s https://api.example.com/users | npx @toon-format/cli --stats
npx @toon-format/cli package.json --stats
npx @toon-format/cli tsconfig.json -o tsconfig.toon
After get_design_context call:
${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh figma-output.xml --stats
cat users.json | npx @toon-format/cli > users.toon
Full pipeline for XML data (Figma, HTML, SVG, etc.):
# Basic usage
${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh input.xml
# With output file
${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh input.xml -o output.toon
# Show stats
${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh input.xml --stats
# JSON only (skip TOON step)
${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh input.xml --json-only
Convert XML to JSON (Node.js):
cat input.xml | node ${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-json.mjs
When you receive structured data, consider:
npx @toon-format/cli directlyxml-to-json.mjs then CLI# Add to ~/.zshrc or ~/.bashrc
alias toon='npx @toon-format/cli'
alias xml2toon='${CLAUDE_PLUGIN_ROOT}/scripts/xml-to-toon.sh'
@read reference.md for detailed format specification and edge cases.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub alexey1312/agents-plugins --plugin to-toon