
Toon Format
Encode bulky JSON prompts as TOON so Claude, Cursor, or Codex agents consume ~40% fewer tokens while keeping schema-aware structure for tables and nested objects.
Overview
toon-format is a journey-wide agent skill that encodes JSON-shaped data as Token-Oriented Object Notation (TOON) so solo builders cut LLM prompt tokens by about 40% whenever structured context goes into an agent.
Install
npx skills add https://github.com/aradotso/trending-skills --skill toon-formatWhat is this skill?
- ~40% token reduction versus JSON for uniform arrays and nested objects per TOON spec
- npm package `@toon-format/toon` with global CLI: encode, decode, pipe, --pretty, --stats
- Core encode/stringify API for in-repo prompt assembly before agent calls
- Schema-aware tabular rows for uniform arrays plus YAML-style nesting for objects
- Triggers cover convert JSON to TOON, token stats, and round-trip decode for verification
- ~40% token reduction versus JSON for typical uniform-array payloads
- CLI supports encode, decode, pipe, --pretty, and --stats comparison
- Published as npm package @toon-format/toon with global CLI install
Adoption & trust: 1.2k installs on skills.sh; 31 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Large JSON context in agent prompts burns tokens and budget without improving how the model reads uniform lists and nested records.
Who is it for?
Indie builders who repeatedly stuff big structured datasets into agent prompts and want a documented encode/decode workflow with CLI and npm API.
Skip if: Teams that only pass tiny prompts, need a non-JSON data model, or cannot add the @toon-format/toon dependency to their pipeline.
When should I use this skill?
Convert JSON to TOON format, reduce LLM prompt tokens, encode data for LLM input, serialize with fewer tokens, or round-trip TOON decode for verification.
What do I get? / Deliverables
You produce TOON-encoded payloads (and optional --stats proof) that agents ingest with smaller context, then decode back to JSON when you need verification or downstream tooling.
- TOON-encoded string or .toon file from JSON input
- Decoded JSON (optionally pretty-printed) after round-trip check
- Token comparison output from CLI --stats when benchmarking prompts
Recommended Skills
Journey fit
Useful at every journey phase - explore requirements and options before committing to a direction.
Where it fits
Encode competitor feature matrices as TOON before asking an agent to compare positioning without maxing context.
Pipe API fixture JSON through `toon encode` before dropping it into a codegen prompt.
Run `toon encode --stats` on golden test payloads to keep eval runs inside token budgets.
Serialize content calendars as TOON tables for bulk editing assistance in Cursor.
Shrink nightly error-summary JSON into TOON for faster triage chats with Codex.
How it compares
A token-oriented serialization skill—not generic gzip compression and not an MCP server for live data fetch.
Common Questions / FAQ
Who is toon-format for?
Solo and indie developers using AI coding agents who move large JSON structures into prompts and want a standardized, schema-aware TOON encoding with CLI and library support.
When should I use toon-format?
Use it during idea and validate when exploring data shapes in prompts, during build when wiring agent tooling, at ship when trimming eval fixtures, at launch and grow when feeding analytics snapshots to an agent, and in operate when summarizing logs—anytime you convert JSON to TO
Is toon-format safe to install?
It is an open npm package and local CLI; review the Security Audits panel on this Prism page and pin versions in package-lock before agents run install or global CLI commands.
SKILL.md
READMESKILL.md - Toon Format
# 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 ```bash # npm npm install @toon-format/toon # pnpm pnpm add @toon-format/toon # yarn yarn add @toon-format/toon ``` ## CLI ```bash # Install globally npm install -g @toon-format/toon # Convert JSON file to TOON toon encode input.json toon encode input.json -o output.toon # Convert TOON back to JSON toon decode input.toon toon decode input.toon -o output.json # Pipe support cat data.json | toon encode cat data.toon | toon decode # Pretty-print JSON output toon decode input.toon --pretty # Show token count comparison toon encode input.json --stats ``` ## Core API ### encode / stringify ```typescript import { encode, decode } from '@toon-format/toon'; // Basic encoding (JSON → TOON string) const data = { context: { task: 'Our favorite hikes together', location: 'Boulder', season: 'spring_2025', }, friends: ['ana', 'luis', 'sam'], hikes: [ { id: 1, name: 'Blue Lake Trail', distanceKm: 7.5, elevationGain: 320, companion: 'ana', wasSunny: true }, { id: 2, name: 'Ridge Overlook', distanceKm: 9.2, elevationGain: 540, companion: 'luis', wasSunny: false }, { id: 3, name: 'Wildflower Loop', distanceKm: 5.1, elevationGain: 180, companion: 'sam', wasSunny: true }, ], }; const toon = encode(data); console.log(toon); // context: // task: Our favorite hikes together // location: Boulder // season: spring_2025 // friends[3]: ana,luis,sam // hikes[3]{id,name,distanceKm,elevationGain,companion,wasSunny}: // 1,Blue Lake Trail,7.5,320,ana,true // 2,Ridge Overlook,9.2,540,luis,false // 3,Wildflower Loop,5.1,180,sam,true ``` ### decode / parse ```typescript import { decode } from '@toon-format/toon'; const toonString = ` context: task: Our favorite hikes together location: Boulder friends[2]: ana,luis hikes[2]{id,name,distanceKm}: 1,Blue Lake Trail,7.5 2,Ridge Overlook,9.2 `; const parsed = decode(toonString); // Returns the original JavaScript object console.log(parsed.hikes[0].name); // 'Blue Lake Trail' ``` ### Encoding options ```typescript import { encode } from '@toon-format/toon'; const toon = encode(data, { // Force all arrays to tabular format (default: auto-detect uniform arrays) tabular: 'always', // Never use tabular format // tabular: 'never', // Indent size for nested objects (default: 2) indent: 2, // Quote strings that contain special characters (default: auto) quoting: 'auto', }); ``` ## Format Overview ### Primitive scalars TOON encodes scalars the same way as YAML — unquoted when unambiguous: ``` name: Alice age: 30 active: true score: 98.6 nothing: null ``` ### Nested objects (YAML-style indentation) ``` user: name: Alice address: city: Boulder zip: 80301 ``` ### Flat arrays (scalar items) Square brackets declare the array length, values are comma-separated: ``` tags[3]: typescript,llm,serialization scores[4]: 10,20,30,40 ``` ### Uniform object arrays (tabular format) Curly braces declare the field headers; each subsequent indented line is a row: ``` employees[3]{id,name,department,salary}: 1,Alice,Engineering,95000 2,Bob,Market