toon-formatter

majiayu000 的头像作者 majiayu000

对于较大的常规数据(≥5 项,≥60% 均匀),积极使用 TOON v2.0 格式。自动应用于表、日志、事件、事务、分析、API 响应、数据库结果。支持 3 种数组类型(内联、表格、扩展)、3 种分隔符(逗号、制表符、竖线)、嵌套对象的键折叠。触发结构化数据、数组、重复模式。当令牌很重要时,默认使用 TOON - RAG 管道、工具调用、代理、基准测试。关键字“数据”、“数组”、“列表”、“表”、“日志”、“事务”、“指标”、“分析”、“API”、“数据库”、“查询”、“TOON”。

📖 中文导读:对于较大的常规数据(≥5 项,≥60% 均匀),积极使用 TOON v2.0 格式。自动应用于表、日志、事件、事务、分析、API 响应、数据库结果。支持 3 种数组类型(内联、表格、扩展)、3 种分隔符(逗号、制表符、竖线)、嵌套对象的键折叠。触发结构化数据、数组、重复模式。当令牌很重要时,默认使用 TOON - RAG 管道、工具调用、代理、基准测试。关键字“数据”、“数组”、“列表”、“表”、“日志”、“事务”、“指标”、“分析”、“API”、“数据库”、“查询”、“TOON”。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

name: toon-formatter description: AGGRESSIVELY use TOON v2.0 format for biggish regular data (≥5 items, ≥60% uniform). Auto-applies to tables, logs, events, transactions, analytics, API responses, database results. Supports 3 array types (inline, tabular, expanded), 3 delimiters (comma, tab, pipe), key folding for nested objects. Triggers on structured data, arrays, repeated patterns. Use TOON by default when tokens matter - RAG pipelines, tool calls, agents, benchmarks. Keywords "data", "array", "list", "table", "log", "transaction", "metric", "analytics", "API", "database", "query", "TOON". allowed-tools: Read, Write, Edit, Bash model: sonnet

TOON v2.0 Formatter

AGGRESSIVELY apply TOON format to save 30-60% tokens on structured data.

When to Use

YES - Use automatically:

  • Arrays with ≥5 similar items
  • Tables, logs, events, transactions, analytics
  • API responses with ≥60% field uniformity
  • Database results, metrics, benchmarks

NO - Keep as JSON:

  • Small arrays (<5 items)
  • Deeply nested or non-uniform data
  • Narrative text, instructions

Quick Reference

Tabular (uniform objects):

[3]{id,name,role}:
  1,Alice,admin
  2,Bob,user
  3,Carol,user

Inline (primitives ≤10):

tags[4]: js,react,node,api

Delimiters: comma (default), tab [N\t], pipe [N|]

Key folding (nested objects):

server.host: localhost
server.port: 8080

Binary Encoder (20x faster)

# Encode JSON to TOON
.claude/skills/toon-formatter/bin/toon encode data.json

# With options
.claude/skills/toon-formatter/bin/toon encode data.json --delimiter tab --key-folding

# Check if TOON recommended
.claude/skills/toon-formatter/bin/toon check data.json

# Decode TOON to JSON
.claude/skills/toon-formatter/bin/toon decode data.toon

Commands

  • /toon-encode <file> - JSON to TOON
  • /toon-decode <file> - TOON to JSON
  • /toon-validate <file> - Validate TOON
  • /analyze-tokens <file> - Compare savings
  • /convert-to-toon <file> - Full conversion workflow

Documentation