toon-format

toon-format — an installable skill for AI agents.

By reason-machines · 1,304 installs

npx skills add reason-machines/trending-skills --skill toon-format

Source repository · Upstream listing

Token Oriented Object Notation (TOON) Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection. TOON is a compact, human readable encoding of the JSON data model that minimizes tokens for LLM input. It combines YAML style indentation for nested objects with CSV style tabular layout for uniform arrays, achieving ~40% token reduction while maintaining or improving LLM comprehension accuracy. Installation CLI Core API encode / stringify decode / parse Encoding options Format Overview Primitive scalars TOON encodes scalars the same way as YAML — unquoted when unambiguous: Nested objects (YAML style indentation) Flat arrays (scalar items) Square brackets declare the array length, values are comma separated: Uniform object arrays (tabular format) Curly braces declare the field headers; each subsequent indented line is a row: Quoting rules Values containing commas, colons, or newlines are quoted: Mixed nesting Using TOON with LLMs Direct prompt injection Anthropic / Claude Token count comparison utility Common Patterns Batch API calls with TOON RAG / retrieval context injection Streaming encode for large datasets Schema aware encoding (TypeScript) Express middleware for TOON content type When to Use TOON vs JSON Scenario Recommendation Uniform arrays of objects ✅ TOON (biggest savings) Deeply nested / non uniform ⚠️ Benchmark both; JSON compact may win Pure flat tabular data Consider CSV (smaller) or TOON (structured) Latency critical (local models) Benchmark TTFT + tokens/sec Programmatic API calls Keep JSON; encode to TOON only for LLM input Semi uniform (~40–60% tabular) Benchmark; savings diminish Troubleshooting Values with commas parse incorrectly Wrap them in double quotes in your TOON string, or ensure encode() handles it automatically: Round trip type loss (numbers vs strings) TOON uses unquoted values for numbers and booleans. Ensure your data uses proper JS types before encoding — don't pass "95000" (string) when you mean 95000 (number): LLM misreads tabular rows Add a brief TOON format explanation to your system prompt: CLI not found after global install Decoding fails on hand written TOON Common mistakes in hand written TOON: Missing length declaration: items{id,name}: → must be items[2]{id,name}: Inconsistent indentation (mix of tabs/spaces) Unquoted values containing : as first character Resources [Official Specification (SPEC v3.0)](https://github.com/toon format/spec/blob/main/SPEC.md) [npm package: @toon format/toon](https://www.npmjs.com/package/@toon format/toon) [Online Playground](https://toonformat.dev) [GitHub Repository](https://github.com/toon format/toon)