Skip to content
toon-formatter logo

TOON v2.0 Formatter Skill (AGGRESSIVE MODE)

toon-formatter

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....

mattnigh/skills_collection0installs24stars

SKILL.md

Full skill instructions

TOON v2.0 Formatter Skill (AGGRESSIVE MODE)

Purpose

AGGRESSIVELY apply TOON v2.0 format to save 30-60% tokens on structured data. Use TOON by default for biggish, regular data. Use native Zig encoder for 20x performance.

When to Use (AGGRESSIVE)

TOON ALL DAY - Use automatically for:

  • ✅ Arrays with ≥ 5 similar items
  • ✅ Tables, logs, events, transactions, analytics
  • ✅ API responses with uniform structure (≥60% field overlap)
  • ✅ Database query results
  • ✅ Repeatedly-used, structured data in prompts
  • ✅ RAG pipelines, tool calls, agents passing data around
  • ✅ Benchmarks/​evals where prompt size = money
  • ✅ Shape is more important than labels
  • ✅ You know what each column means
  • ✅ Can declare headers once, go row-by-row

MAYBE, BUT NOT AUTOMATICALLY - Be selective when:

  • ⚠️ Human collaborators reading/​editing data a lot
  • ⚠️ APIs/​tools expect JSON (use JSON on wire, TOON in prompts)
  • ⚠️ Structure is uneven (many optional keys, weird nesting)

NO, JUST DON'T - Stick to JSON/​text for:

  • ❌ Short arrays (< 5 items)
  • ❌ One-off examples in docs
  • ❌ Narrative text, instructions, essays
  • ❌ Deep, irregular trees where hierarchy matters

What is TOON v2.0?

TOON (Token-Oriented Object Notation) v2.0 reduces token consumption by 30-60% for structured data:

Three Array Types

1. Tabular (uniform objects ≥5 items):

[2]{id,name,balance}:
  1,Alice,5420.50
  2,Bob,3210.75

2. Inline (primitives ≤10):

tags[5]: javascript,react,node,express,api

3. Expanded (non-uniform):

- name: Alice
  role: admin
- name: Bob
  level: 5

Three Delimiters

Comma (default, most compact):

[2]{name,city}: Alice,NYC Bob,LA

Tab (for data with commas):

[2\t]{name,address}: Alice	123 Main St, NYC

Pipe (markdown-like):

[2|]{method,path}: GET|/​api/​users

Key Folding

Flatten nested objects (25-35% extra savings):

server.host: localhost
server.port: 8080
database.host: db.example.com

Process

1. Detect Suitable Data

When encountering array data, check if it meets TOON criteria:

  • ✅ Array with ≥5 items
  • ✅ Objects with ≥60% field uniformity (most objects share same fields)
  • ✅ Flat or moderately nested structure

How to check uniformity:

  1. Extract all field names from all objects
  2. Count how many objects have the most common set of fields
  3. Calculate: (objects with common fields / total objects) × 100
  4. If ≥60%, uniformity is good for TOON

2. Estimate Token Savings

Quick estimation method:

  • JSON tokens ≈ (item count × field count × 4) + overhead
    • Example: 10 items × 5 fields × 4 = ~200 tokens
  • TOON tokens ≈ 20 (header) + (item count × field count × 2)
    • Example: 20 + (10 × 5 × 2) = ~120 tokens
  • Savings ≈ (JSON - TOON) / JSON × 100%
    • Example: (200 - 120) / 200 = 40% savings

3. Apply TOON v2.0 Aggressively

AGGRESSIVE MODE: Use Zig encoder for optimal results

If data meets criteria:

Method 1: Use Zig Encoder (Recommended - 20x faster):

.claude/​utils/​toon/​zig-out/​bin/​toon encode data.json \
  --delimiter tab \
  --key-folding \
  > data.toon

Method 2: Manual TOON (for inline generation):

  1. Detect array type (inline/​tabular/​expanded)
  2. Choose delimiter (comma/​tab/​pipe)
  3. Apply key folding if nested objects
  4. Build TOON header: [N]{fields}: or key[N]: values
  5. Output formatted TOON

Show brief summary:

📊 Using TOON v2.0 (estimated 42% savings, 10 items)
Format: Tabular with tab delimiter
Key folding: enabled

[10\t]{id,name,address,status}:
  1	Alice	123 Main St, NYC	active
  2	Bob	456 Oak Ave, LA	inactive
  ...

Otherwise, use JSON and explain why:

Using JSON because:
- Only 3 items (too small)
- Or: Low uniformity (only 45% have same fields)
- Or: Deeply nested structure

4. Show Formatted Output

Immediately show in TOON with brief explanation:

📊 API Endpoints (15 items, TOON format - saved 40.1% tokens):

[15]{method,path,description,auth,rateLimit}:
  GET,/​api/​users,List all users,required,100/​min
  POST,/​api/​users,Create new user,required,50/​min
  ...

No long explanations needed - just use it!

Best Practices

Always Show Format Decision

When working with data, always indicate which format you're using and why:

📊 Using TOON (estimated 42% token savings)
[count]{fields}:...

or

ℹ️ Using JSON (deeply nested structure, TOON not suitable)
{...}

When NOT to Use TOON

Explain when JSON is better:

  • Deeply nested data: TOON excels with flat/​tabular structures
  • Low uniformity (<70%): Different fields per object reduces TOON benefits
  • Small arrays (<10 items): Overhead not worth it
  • Single records: Use JSON for clarity

Performance Tips

  1. Batch processing: Convert large datasets once, reuse TOON format
  2. Uniformity matters: Higher field overlap = better savings
  3. Nested arrays: TOON supports nested structures but savings diminish
  4. Type coercion: TOON preserves types (numbers, booleans, dates)

Examples

Example 1: API Response

Input:

const apiResponse = await fetch('/​api/​users').then(r => r.json());
// 150 users returned

Output:

API Response (150 users):
Format: TOON (saves 41.2%, 1,847 tokens saved)

[150]{id,name,email,role,lastLogin}:
  1,Alice Smith,[email protected],admin,2024-01-15T10:30:00Z
  2,Bob Jones,[email protected],user,2024-01-15T09:15:00Z
  ...

Example 2: Database Query

Input:

SELECT * FROM transactions WHERE date > '2024-01-01' LIMIT 500;

Output:

Query Results (500 transactions):
Format: TOON (saves 38.9%, 3,421 tokens saved)

[500]{id,date,amount,merchant,category,status}:
  1,2024-01-15,42.50,Starbucks,Food & Drink,completed
  2,2024-01-15,125.00,Shell Gas,Transportation,completed
  ...

Example 3: Metrics Dashboard

Input:

const metrics = analyzePerformance();
// Returns array of route performance metrics

Output:

Performance Metrics (45 routes):
Format: TOON (saves 44.1%, 892 tokens saved)

[45]{route,avgTime,p95,requests,errors}:
  /​api/​users,125,340,15420,3
  /​api/​products,89,210,8932,0
  /​api/​orders,450,1250,3421,12
  ...

Example 4: Mixed Data (JSON Better)

Input:

const complexData = {
  metadata: { version: '1.0', timestamp: '...' },
  results: [
    { id: 1, data: { nested: { deep: 'value' } } },
    // Highly nested, non-uniform
  ]
};

Output:

ℹ️ Using JSON format (TOON not recommended):
- Deeply nested structure
- Low uniformity (45%)
- Small array (only 5 items)

{
  "metadata": { "version": "1.0", ... },
  "results": [ ... ]
}

Integration with Other Skills

Financial Analysis

When analyzing transactions or financial data, use TOON for large result sets:

  • Transaction histories (100+ items)
  • Account balances across multiple accounts
  • Payment logs and audit trails

Data Export

When exporting data, check if TOON is suitable:

  • If ≥5 items and ≥60% uniform → use TOON
  • Otherwise → use JSON

API Documentation

Document API endpoints in TOON format for compact reference:

# API Endpoints

[15]{method,path,auth,rateLimit,description}:
  GET,/​api/​users,required,100/​min,List all users
  POST,/​api/​users,required,50/​min,Create new user
  ...

Commands

Use with these TOON v2.0 commands:

  • /​toon-encode <file> [--delimiter tab] [--key-folding] - JSON → TOON v2.0
  • /​toon-validate <file> [--strict] - Validate TOON file
  • /​analyze-tokens <file> - Compare JSON vs TOON savings
  • /​convert-to-toon <file> - Legacy command (use toon-encode)

Resources

  • Zig Encoder: .claude/​utils/​toon/​toon.zig (601 lines, 20x faster)
  • User Guide: .claude/​docs/​toon-guide.md
  • Examples: .claude/​utils/​toon/​examples/ (9 files)
  • Guides: .claude/​utils/​toon/​guides/ (4 files)
  • FAQ: .claude/​docs/​FAQ.md
  • TOON Spec: https://github.com/toon-format/spec
  • Official Site: https://toonformat.dev

Success Metrics

Track TOON usage effectiveness:

  • Average token savings: 30-60%
  • Accuracy improvement: +3-5% (per official benchmarks)
  • Context window freed: 15K+ tokens on large datasets
  • User satisfaction: Faster responses, more context available

More skills from mattnigh

spring-framework-patterns logo
mattnigh/skills_collection

spring-framework-patterns

Comprehensive Spring Framework and Spring Boot best practices including dependency injection patterns, bean lifecycle and scopes, REST API development, Spring Data JPA, service layer design, Spring Security, testing strategies, caching, AOP, async processing, error handling, and common anti-patte...

24 0
View

TypeScript厳格モードによる型安全性設計を専門とするスキル。 📖 参照書籍: - 『Effective TypeScript』(Dan Vanderkam): 型設計 📚 リソース参照: - `resources/Level1_basics.md`: レベル1の基礎ガイド - `resources/Level2_intermediate.md`: レベル2の実務ガイド - `resources/Level3_advanced.md`: レベル3の応用ガイド - `resources/Level4_expert.md`: レベル4の専門ガイド - `resources/di...

24 0
View
deploying-cloud-k8s logo
mattnigh/skills_collection

deploying-cloud-k8s

Deploys applications to cloud Kubernetes (AKS/GKE/DOKS) with CI/CD pipelines. Use when deploying to production, setting up GitHub Actions, troubleshooting deployments. Covers build-time vs runtime vars, architecture matching, and battle-tested debugging.

24 0
View
moai-alfred-agent-guide logo
mattnigh/skills_collection

moai-alfred-agent-guide

19-agent team structure, decision trees for agent selection, Haiku vs Sonnet model selection, and agent collaboration principles. Use when deciding which sub-agent to invoke, understanding team responsibilities, or learning multi-agent orchestration.

24 0
View
mermaid-diagram-generator logo
mattnigh/skills_collection

mermaid-diagram-generator

Converts architecture descriptions, module specs, or workflow docs into Mermaid diagrams. Use when visualizing brick module relationships, workflows (DDD, investigation), or system architecture. Supports: flowcharts, sequence diagrams, class diagrams, state machines, entity relationship diagrams,...

24 0
View
pre-flight-check logo
mattnigh/skills_collection

pre-flight-check

INVOKE FIRST before any code work. Validates git workflow (branch, issue, worklog) and checks approach. Use at START of every task and END before completing. Prevents skipped steps.

24 0
View
browser-dev-tools logo
mattnigh/skills_collection

browser-dev-tools

This skill should be used when working with browser-rendered artifacts (i.e. Bun, React/React Native) to proactively validate that development work on localhost is being built appropriately and to support debugging browser-rendered content. Use this skill after making frontend changes to verify t...

24 0
View
lead-dev logo
mattnigh/skills_collection

lead-dev

Lead Développeur - Coordination technique opérationnelle, code review, mentoring et livraison. Pair de web-dev-process au niveau OPÉRATIONS.

24 0
View
worker-monitor logo
mattnigh/skills_collection

worker-monitor

Monitor Docker workers, RQ queue health, and auto-scale workers (max 4). Use when: checking job progress, monitoring queue depth, scaling workers up/down, diagnosing slow processing, or waiting for jobs to complete. Referenced by data-quality skill during reprocessing.

24 0
View
quality-advisor logo
mattnigh/skills_collection

quality-advisor

Proactive quality guidance system that monitors artifact creation and provides real-time feedback on documentation quality

24 0
View
bump-version logo
mattnigh/skills_collection

bump-version

This skill should be used when the user wants to bump the version number in the workspace. It updates versions across all pyproject.toml files (root, tde, and tda packages) and the CHANGELOG.md to keep them synchronized.

24 0
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View