toon

Compress JSON payloads to reduce token usage in LLM prompts.

Updated Mar 2, 2019
One-click install
npx skills add https://github.com/trmaphi/dotfiles --skill toon-trmaphi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: toon
Source: https://github.com/trmaphi/dotfiles/tree/main/.claude/skills/toon
Command: npx skills add https://github.com/trmaphi/dotfiles --skill toon-trmaphi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

JSON payloads often cause token bloat in LLM prompts. TOON reduces token usage by stripping structural noise from JSON, making prompts leaner and faster to process.

Core Features & Use Cases

  • Token-efficient JSON: strips quotes, braces, and brackets to minimize prompt size.
  • Optional key folding: flattens nested keys to a concise a.b.c: value representation.
  • Diagnostics: --stats shows before/after token savings.
  • Decode capability: --decode restores the original JSON when needed.
  • Use case: compress large API responses or chat prompts to fit within token budgets for LLMs.

Quick Start

Pipe your JSON through toon to produce a compact, token-efficient JSON payload suitable for LLM prompts.

Frequently Asked Questions about toon

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compress JSON to save tokens in LLM prompts?

To compress JSON to save tokens in LLM prompts, pipe your JSON data through a utility that strips structural noise like quotes and braces. This makes prompts leaner while preserving essential structure for processing.

What is the best way to reduce token usage for large API responses in LLM prompts?

The best way to reduce token usage for large API responses in LLM prompts is to flatten nested keys and strip structural noise. This minimizes prompt size to help data fit within token budgets while retaining essential payload information.

Can I restore compressed JSON back to its original structure after prompt processing?

Yes, you can restore compressed JSON back to its original structure using a decode path. This ensures you can compress data for prompt efficiency and fully recover the original nested JSON format when needed.

Does compressing JSON for token savings preserve nested keys and values?

Compressing JSON for token savings preserves nested keys and values through optional key folding, which flattens nested keys to a concise a.b.c: value representation. This retains essential data structure while reducing tokens.

How do I check token savings before and after JSON compression?

To check token savings before and after JSON compression, use diagnostics statistics to view before and after token counts. This verifies that your prompt size has been effectively reduced for LLM processing.

When should I not use JSON compression for LLM prompts?

You should not use JSON compression for LLM prompts if your target LLM model requires strict standard JSON syntax to parse inputs correctly, because stripping quotes and braces creates a non-standard format that may break downstream parsing.