toon-format
LLM(大規模言語モデル)で効率的にデータを扱えるよう、構造化されたデータをJSONよりも少ないトークン数で表現し、コスト削減や処理速度向上に貢献するTOON形式でデータをエンコードするSkill。
📜 元の英語説明(参考)
TOON (Token-Oriented Object Notation) encoding for LLM-efficient data representation. 30-60% token savings vs JSON for structured data.
🇯🇵 日本人クリエイター向け解説
LLM(大規模言語モデル)で効率的にデータを扱えるよう、構造化されたデータをJSONよりも少ないトークン数で表現し、コスト削減や処理速度向上に貢献するTOON形式でデータをエンコードするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o toon-format.zip https://jpskill.com/download/18059.zip && unzip -o toon-format.zip && rm toon-format.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/18059.zip -OutFile "$d\toon-format.zip"; Expand-Archive "$d\toon-format.zip" -DestinationPath $d -Force; ri "$d\toon-format.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
toon-format.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
toon-formatフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
TOON Format Skill
TOON は、LLM プロンプト用に設計された、コンパクトで人間が読みやすい JSON エンコーディングです。
変数
| 変数 | デフォルト | 説明 |
|---|---|---|
| VALIDATION_MODE | strict | strict (CLI 検証が必要) または lenient (パーサーが寛容) |
| AUTO_FIX | true | 検証失敗時に自動的に修正スクリプトを実行 |
指示
必須 - このスキルのフォーマットルールと reference/format-rules.md に従ってください。
- 配列には常に明示的な
[count]を含める - 表形式の行には 2 スペースのインデントを使用する
- 表形式の配列の後には、それを終了するために空行を追加する
- セル内のネストされた配列にはセミコロンを使用する (カンマではない)
危険信号 - 停止して再検討
もしあなたが以下をしようとしているなら:
- 表形式のセル内の引用符で囲まれた文字列の中にカンマを入れる
- 配列宣言から
[count]を省略する - 表形式の配列の後に空行を忘れる
- YAML スタイルの
- itemリスト構文を使用する #でコメントを追加する
停止 -> reference/format-rules.md を確認 -> その後、続行
ワークフロー
- [ ] TOON が適切かどうかを判断する (下記の「TOON を使用するタイミング」を参照)
- [ ] 表形式表現のためのデータ構造を設計する
- [ ] チェックポイント: フォーマットがルールに一致することを確認する
- [ ] 適切なインデントで TOON を記述する
- [ ]
npx @toon-format/cli --decodeで検証する - [ ] エラーが発生した場合は、
reference/validation-tools.mdから自動修正スクリプトを実行する
クックブック
フォーマットルール
- IF: TOON ファイルを記述または編集する場合
- THEN:
reference/format-rules.mdを読む - COVERS: 構文ルール、制約、正しいパターン
検証と修正
- IF: TOON ファイルの検証に失敗した場合
- THEN:
reference/validation-tools.mdを読む - COVERS: CLI 検証、自動修正スクリプト
TOON を使用するタイミング
良い候補:
- 均一な表形式データ (類似オブジェクトのリスト)
- ドキュメントのインデックスとマニフェスト
- 繰り返されるキーと値の構造
- LLM に供給される構造化データ
代わりに JSON を使用する:
- 深くネストされた構造
- 非均一なデータ (混合スキーマ)
- 頻繁なプログラムによる操作を必要とするデータ
- ツールによって読み取られる構成ファイル
TOON 構文
キーと値 (YAML ライク)
name: John
age: 30
active: true
明示的な長さを持つ配列
tags[3]: red, green, blue
表形式データ (主なユースケース)
# 構文: name[count]{col1,col2,col3}:
# 2 スペースでインデントされた CSV ライクな行が続く
users[3]{id,name,email}:
1,John,john@example.com
2,Jane,jane@example.com
3,Bob,bob@example.com
重要: 行は必ず 2 スペースでインデントする必要があります。最後の行の後に必ず空行を追加してください。
セル内のネストされた配列
セミコロンを使用するか、複数の項目を含む値を引用符で囲みます:
pages[2]{path,keywords,priority}:
/intro,"overview;basics;start",core
/api,"reference;methods;types",core
複数行文字列
行区切りには \n を使用して、引用符で囲まれた文字列を使用します:
description: "This is a multi-line\nstring value that preserves\nline breaks."
ネストされたオブジェクト
config:
database:
host: localhost
port: 5432
cache:
enabled: true
ドキュメントのエンコーディングパターン
インデックスファイル
meta:
category: libraries
generated: 2025-01-15T10:30:00Z
count: 5
items[5]{id,name,description,path,keywords}:
baml,BAML,Structured LLM outputs,ai-docs/libraries/baml/_index.toon,"llm;types;structured"
mcp,MCP,Tool integration protocol,ai-docs/libraries/mcp/_index.toon,"tools;context;servers"
prisma,Prisma,Type-safe database ORM,ai-docs/libraries/prisma/_index.toon,"database;orm;sql"
ページサマリー
meta:
library: baml
page: error-handling
source_url: https://docs.boundaryml.com/guide/error-handling
content_hash: a3f2c1d4e5
summary:
purpose: "Configure retry policies and fallback strategies for resilient LLM calls."
key_concepts[4]: RetryPolicy,FallbackClient,timeout,exponential backoff
gotchas[2]: Default timeout 60s may be too short,Retries count against rate limits
code_patterns[1]:
- lang: baml
desc: Retry policy configuration
code: "retry_policy Resilient {\n max_retries 3\n strategy exponential\n}"
トークン比較
JSON (~280 トークン):
{"pages":[{"path":"/intro","section":"guide","title":"Introduction","priority":"core"},{"path":"/setup","section":"guide","title":"Setup","priority":"core"}]}
TOON (~100 トークン):
pages[2]{path,section,title,priority}:
/intro,guide,Introduction,core
/setup,guide,Setup,core
削減: ~64%
ツールとライブラリ
- TypeScript/JS:
@toon-format/toon(npm) - Python:
python-toon(pip) - Online: https://toontools.vercel.app/playground
- Spec: https://toonformat.dev/
ベストプラクティス
- 可能な場合は、表形式表現のためのデータ構造を設計する
- 配列には明示的な
[count]を使用する - LLM の解析に役立ちます - JSON を正規のソースとして保持し、TOON を LLM 転送に使用する
- ネストされた配列にはセミコロンを使用する (例:
"val1;val2;val3") - 長い文字列を切り捨てる (コードスニペットは 200 文字未満)
- 表形式の配列の後には、それを終了するために必ず空行を追加する
フォーマット制約
公式の @toon-format/cli によって強制されます (検証するには --decode を使用):
| ルール | ❌ 不正 | ✅ 正 |
|---|---|---|
| コメントなし | # comment |
(コメントを完全に削除) |
| YAML スタイルのリストなし | - item |
key[N]{col}: + インデントされた行 |
| 行はインデントする必要がある | row,data |
row,data (2 スペース) |
| 配列にはカウント + 列が必要 | items{a,b}: |
items[3]{a,b}: |
| 複数行文字列なし | key: \| |
key: "line1\nline2" |
| パイプ区切り文字なし | val\|val |
val,val または "val;val" |
| 表形式のセルにカンマを使用しない | "a,b" |
"a;b" |
| 配列の後に空行が必要 | ターミネータがない | 最後の行の後の空行 |
検証ツール:
# 公式 CLI で検証 (validate ではなく --decode を使用!)
npx @toon-format/cli --decode file.toon > /dev/null
# 一般的な問題を自動修正 (この順序で実行)
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_comments.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_yaml_lists.p
(原文はここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
TOON Format Skill
TOON is a compact, human-readable encoding of JSON designed for LLM prompts.
Variables
| Variable | Default | Description |
|---|---|---|
| VALIDATION_MODE | strict | strict (CLI validation required) or lenient (parser permissive) |
| AUTO_FIX | true | Run fix scripts automatically on validation failure |
Instructions
MANDATORY - Follow the format rules in this skill and reference/format-rules.md.
- Always include explicit
[count]for arrays - Use 2-space indentation for tabular rows
- Add blank line after tabular arrays to terminate them
- Use semicolons for nested arrays in cells (NOT commas)
Red Flags - STOP and Reconsider
If you're about to:
- Put commas inside quoted strings in tabular cells
- Omit the
[count]from array declarations - Forget the blank line after a tabular array
- Use YAML-style
- itemlist syntax - Add comments with
#
STOP -> Check reference/format-rules.md -> Then proceed
Workflow
- [ ] Determine if TOON is appropriate (see "When to Use TOON" below)
- [ ] Design data structure for tabular representation
- [ ] CHECKPOINT: Verify format matches rules
- [ ] Write TOON with proper indentation
- [ ] Validate with
npx @toon-format/cli --decode - [ ] If errors, run auto-fix scripts from
reference/validation-tools.md
Cookbook
Format Rules
- IF: Writing or editing TOON files
- THEN: Read
reference/format-rules.md - COVERS: Syntax rules, constraints, correct patterns
Validation & Fixing
- IF: TOON file fails validation
- THEN: Read
reference/validation-tools.md - COVERS: CLI validation, auto-fix scripts
When to Use TOON
Good candidates:
- Uniform tabular data (lists of similar objects)
- Documentation indexes and manifests
- Repeated key-value structures
- Any structured data being fed to LLMs
Use JSON instead for:
- Deeply nested structures
- Non-uniform data (mixed schemas)
- Data requiring frequent programmatic manipulation
- Configuration files read by tools
TOON Syntax
Key-Value (YAML-like)
name: John
age: 30
active: true
Arrays with Explicit Length
tags[3]: red, green, blue
Tabular Data (Primary Use Case)
# Syntax: name[count]{col1,col2,col3}:
# Followed by 2-space indented CSV-like rows
users[3]{id,name,email}:
1,John,john@example.com
2,Jane,jane@example.com
3,Bob,bob@example.com
IMPORTANT: Rows MUST be indented with 2 spaces. Always add a blank line after the last row.
Nested Arrays in Cells
Use semicolons or quote values containing multiple items:
pages[2]{path,keywords,priority}:
/intro,"overview;basics;start",core
/api,"reference;methods;types",core
Multi-line Strings
Use quoted strings with \n for line breaks:
description: "This is a multi-line\nstring value that preserves\nline breaks."
Nested Objects
config:
database:
host: localhost
port: 5432
cache:
enabled: true
Encoding Patterns for Documentation
Index Files
meta:
category: libraries
generated: 2025-01-15T10:30:00Z
count: 5
items[5]{id,name,description,path,keywords}:
baml,BAML,Structured LLM outputs,ai-docs/libraries/baml/_index.toon,"llm;types;structured"
mcp,MCP,Tool integration protocol,ai-docs/libraries/mcp/_index.toon,"tools;context;servers"
prisma,Prisma,Type-safe database ORM,ai-docs/libraries/prisma/_index.toon,"database;orm;sql"
Page Summaries
meta:
library: baml
page: error-handling
source_url: https://docs.boundaryml.com/guide/error-handling
content_hash: a3f2c1d4e5
summary:
purpose: "Configure retry policies and fallback strategies for resilient LLM calls."
key_concepts[4]: RetryPolicy,FallbackClient,timeout,exponential backoff
gotchas[2]: Default timeout 60s may be too short,Retries count against rate limits
code_patterns[1]:
- lang: baml
desc: Retry policy configuration
code: "retry_policy Resilient {\n max_retries 3\n strategy exponential\n}"
Token Comparison
JSON (~280 tokens):
{"pages":[{"path":"/intro","section":"guide","title":"Introduction","priority":"core"},{"path":"/setup","section":"guide","title":"Setup","priority":"core"}]}
TOON (~100 tokens):
pages[2]{path,section,title,priority}:
/intro,guide,Introduction,core
/setup,guide,Setup,core
Savings: ~64%
Tools & Libraries
- TypeScript/JS:
@toon-format/toon(npm) - Python:
python-toon(pip) - Online: https://toontools.vercel.app/playground
- Spec: https://toonformat.dev/
Best Practices
- Design data structures for tabular representation when possible
- Use explicit
[count]for arrays - helps LLM parsing - Keep JSON as canonical source, TOON for LLM transport
- Use semicolons for nested arrays (e.g.,
"val1;val2;val3") - Truncate long strings (code snippets < 200 chars)
- Always add a blank line after tabular arrays to terminate them
Format Constraints
Enforced by official @toon-format/cli (use --decode to validate):
| Rule | ❌ Incorrect | ✅ Correct |
|---|---|---|
| No comments | # comment |
(remove comments entirely) |
| No YAML-style lists | - item |
key[N]{col}: + indented rows |
| Rows must be indented | row,data |
row,data (2 spaces) |
| Arrays need count+cols | items{a,b}: |
items[3]{a,b}: |
| No multiline strings | key: \| |
key: "line1\nline2" |
| No pipe delimiters | val\|val |
val,val or "val;val" |
| No commas in tabular cells | "a,b" |
"a;b" |
| Blank line AFTER arrays | missing terminator | blank line after last row |
Validation tools:
# Validate with official CLI (use --decode, not validate!)
npx @toon-format/cli --decode file.toon > /dev/null
# Auto-fix common issues (run in this order)
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_comments.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_yaml_lists.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_nested_lists.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_commas.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_pipes.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_multiline.py path/
python3 .claude/ai-dev-kit/dev-tools/scripts/fix_toon_blank_lines.py path/