Skip to content
toon-format logo

TOON Format Skill

toon-format

When working with JSON data in LLM prompts (especially large arrays or tabular data), consider the token-efficient TOON (Token-Oriented Object Notation) format which reduces tokens by 30-70% while maintaining lossless JSON representation and structural validation. Use for reading/writing .toon fi...

SKILL.md

Full skill instructions

TOON Format Skill

TOON (Token-Oriented Object Notation) is a compact, human-readable, schema-aware encoding of JSON designed to be easy for LLMs to read and (with good prompting) to generate. It is especially effective for uniform arrays of objects (tabular data), where keys are declared once and rows carry values.

Quick decision: should I use TOON?

Use TOON when:

  • You are passing large structured context (especially arrays of objects) to an LLM and want fewer tokens.
  • You want structure guardrails ([N] counts + {fields} headers) to reduce model drift and enable validation.
  • You need a format that stays close to CSV’s readability but is a lossless representation of JSON.

Prefer JSON (or JSONL/​CSV) when:

  • You need interoperability with systems that expect standard JSON.
  • Data is extremely irregular (ragged objects) and the TOON representation won’t be more compact or readable.
  • The task is primarily “machine ↔ machine” with no human/​LLM in the loop.

For more detail: see reference/​when-to-use.md.

Core patterns you must follow

1) Recognize TOON in the wild

TOON commonly looks like:

  • Scalars/​objects as key: value / indented blocks
  • Arrays with lengths: users[3]: ...
  • Tabular arrays with field headers: users[3]{id,name,role}:
  • Rows are delimiter-separated (comma by default; tab often best)

2) Converting JSON ↔ TOON (recommended paths)

A) CLI (fastest, good for pipelines)

Use the official CLI for round-tripping and stats.

Encode JSON → TOON

npx @toon-format/​cli input.json -o output.toon

Decode TOON → JSON

npx @toon-format/​cli input.toon -o output.json

Token stats + maximum efficiency

npx @toon-format/​cli input.json --delimiter "\t" --stats -o output.toon

Optional structure compression

  • Key folding (encode): --keyFolding safe
  • Path expansion (decode): --expandPaths safe

For full CLI options and examples: see reference/​cli.md.

B) TypeScript/​JavaScript library

Use @toon-format/​toon for in-app encode/​decode. See reference/​library.md.

3) Prompting patterns for LLMs (critical)

When sending TOON as input:

  • Show, don’t explain.
  • Wrap data in a fenced code block labeled toon (or yaml if needed):
    • (TOON data)

When asking for TOON output:

  • Provide the expected header template (e.g., users[N]{id,name,role}:)
  • Explicit rules:
    • 2-space indent
    • [N] must match row count
    • no extra commentary; output only the code block (if you need strict parsing)

For proven prompt patterns and pitfalls: see reference/​llm-prompting.md.

4) Always validate model-generated TOON

If the model outputs TOON, you MUST validate it (strict mode by default in official tooling). If validation fails:

  • Ask for re-output with the same header template
  • Or fall back to JSON output

Minimal working examples

Example: filter rows (LLM output expected as TOON)

Input

users[3]{id,name,role,lastLogin}:
  1,Alice,admin,2025-01-15T10:30:00Z
  2,Bob,user,2025-01-14T15:22:00Z
  3,Charlie,user,2025-01-13T09:45:00Z

Instruction Return only users with role "user" as TOON. Use the same header format. Set [N] correctly. Output only the code block.


Utilities included in this Skill

  • scripts/​toon_convert.py: A convenience wrapper that:
    • detects TOON code fences in Markdown and extracts them
    • calls the official CLI via toon (if installed) or npx @toon-format/​cli
    • supports --encode/​--decode, --delimiter, --stats, and folding/​expansion flags

See: scripts/​README.md

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
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