json-to-llm-context
Turn JSON or PostgreSQL jsonb payloads into compact readable context for LLMs. Use when a user wants to compress JSON, reduce token usage, summarize API responses, or convert structured data into model-friendly text without dumping raw paths.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o json-to-llm-context.zip https://jpskill.com/download/20988.zip && unzip -o json-to-llm-context.zip && rm json-to-llm-context.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/20988.zip -OutFile "$d\json-to-llm-context.zip"; Expand-Archive "$d\json-to-llm-context.zip" -DestinationPath $d -Force; ri "$d\json-to-llm-context.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
json-to-llm-context.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
json-to-llm-contextフォルダができる - 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
- 同梱ファイル
- 3
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
JSONからLLMコンテキストへ
概要
このスキルは、生のJSONが直接プロンプトするにはノイズが多すぎる場合に使用します。JSONまたはエクスポートされたjsonbコンテンツを、エンティティ、ステータス、関係、およびカウントを保持したまま、短く読みやすい要約に変換します。
このスキルは以下の用途に適しています。
- APIレスポンス
- PostgreSQLの
jsonbエクスポート - ネストされた設定/状態ペイロード
- コンパクトな要約が必要な大規模なレコード配列
PDF、DOCX、画像OCR、または任意の散文文書にはこのスキルを使用しないでください。
ワークフロー
- 入力が有効なJSONまたは
jsonbスタイルのJSONテキストであることを確認します。 - ファイルに対して
scripts/json_to_readable_context.pyを実行するか、JSONを標準入力でパイプします。 - 生成された読みやすい要約を主要な成果物として返します。
- 出力がまだ長すぎると感じる場合は、
--max-samples、--max-depth、または--max-string-lenなどのより厳しい制限を設けて再実行します。 - 解析に失敗した場合は、推測するのではなく、JSONエラーを明確に報告します。
クイックスタート
python3 scripts/json_to_readable_context.py --input payload.json
標準入力から:
cat payload.json | python3 scripts/json_to_readable_context.py
ファイルに書き出す:
python3 scripts/json_to_readable_context.py --input payload.json --output summary.txt
一般的なチューニング:
python3 scripts/json_to_readable_context.py \
--input payload.json \
--style sectioned \
--strict \
--preserve status,profile.email \
--show-paths \
--expand collections \
--max-samples 2 \
--max-depth 2 \
--max-string-len 48
出力スタイル
このスクリプトは、例えば以下のようなレイヤー2の読みやすい出力を目指しています。
User[123]: Tom
Summary
- Status: active.
- Profile: email a@b.com (verified).
Collections
- Roles: 2 total; values: admin and editor.
動作ルール:
User[123]: Tomのようなエンティティヘッダーを優先します。- 利用可能な場合は、トップレベルの出力を
Summary、Details、Collectionsにグループ化します。 - 可能な場合は、フィールドを短いレポート形式の箇条書きに変換します。
- 大規模な配列は、合計、ステータス、および短い例として要約します。
- 繰り返し実行しても比較可能になるように、安定した順序を維持します。
- 構造が不規則すぎて安全に整形できない場合を除き、生のパスダンプは避けます。
スタイルオプション
--style sectioned(デフォルト):Summary、Details、Collectionsを出力します。--style flat: セクション見出しなしの、よりシンプルなヘッダーと箇条書きリストを出力します。
フラット出力の例:
User[123]: Tom
- Status: active.
- Profile: email a@b.com (verified).
- Roles: 2 total; values: admin and editor.
安全性制御
--strict: 積極的な圧縮を減らし、より明示的な構造を保持します。--preserve key1,key2,path.to.field: 空の場合や通常は削除される場合でも、これらのキーまたはドットパスを常に保持します。--expand collections|details|all: 重要な部分が圧縮されすぎないように、ローカルのサブ箇条書きを追加します。--show-paths:[@status]や[@orders[0]]のようなソースマーカーをレンダリングされた行に追加します。
例:
python3 scripts/json_to_readable_context.py \
--input payload.json \
--strict \
--preserve status,profile.email,orders \
--expand all \
--show-paths
パス付きの例:
User[123]: Tom [@root]
Summary
- Status: active. [@active]
Collections
- Roles: 2 total; values: admin and editor. [@roles]
参照を読むべき時
references/rules.mdは、以下の情報が必要な場合にのみお読みください。
- 正確な要約ヒューリスティック
- 配列とネストされたオブジェクトの処理例
- 出力を厳しくするか緩めるかを決定するためのガイダンス
障害処理
- 無効なJSON: 停止し、解析エラーを表示します。
- 非常に不規則なオブジェクト: 簡略化された読みやすいキー/値の行にフォールバックします。
- 極端に深いペイロード:
--max-depthでトラバーサルを制限します。 - 長すぎるテキストブロブ: 長さのヒントで安全に切り詰めます。
注意事項
jsonとPostgreSQLのjsonbは、解析されると同一に扱われます。- デフォルトの出力は、単一の読みやすいテキスト成果物です。
- このスキルは、意図的に完璧な構造的忠実性よりも読みやすさを優先します。
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
JSON to LLM Context
Overview
Use this skill when raw JSON is too noisy for direct prompting. It converts JSON or exported jsonb
content into short, readable summaries that preserve entities, status, relationships, and counts.
Prefer this skill for:
- API responses
- PostgreSQL
jsonbexports - nested config/state payloads
- large arrays of records that need compact summaries
Do not use this skill for PDF, DOCX, image OCR, or arbitrary prose documents.
Workflow
- Confirm the input is valid JSON or
jsonb-style JSON text. - Run
scripts/json_to_readable_context.pyon the file or pipe JSON through stdin. - Return the generated readable summary as the primary artifact.
- If the output still feels too long, rerun with tighter limits such as lower
--max-samples,--max-depth, or--max-string-len. - If parsing fails, report the JSON error clearly instead of guessing.
Quick Start
python3 scripts/json_to_readable_context.py --input payload.json
From stdin:
cat payload.json | python3 scripts/json_to_readable_context.py
Write to a file:
python3 scripts/json_to_readable_context.py --input payload.json --output summary.txt
Common tuning:
python3 scripts/json_to_readable_context.py \
--input payload.json \
--style sectioned \
--strict \
--preserve status,profile.email \
--show-paths \
--expand collections \
--max-samples 2 \
--max-depth 2 \
--max-string-len 48
Output Style
The script aims for layer-2 readable output, for example:
User[123]: Tom
Summary
- Status: active.
- Profile: email a@b.com (verified).
Collections
- Roles: 2 total; values: admin and editor.
Behavior rules:
- prefer entity headers like
User[123]: Tom - group top-level output into
Summary,Details, andCollectionswhen available - convert fields into short report-style bullets when possible
- summarize large arrays as totals, statuses, and short examples
- keep stable ordering so repeated runs are comparable
- avoid raw path dumps unless the structure is too irregular to beautify safely
Style Options
--style sectioned(default): emitsSummary,Details, andCollections--style flat: emits a simpler header + bullet list without section headings
Example flat output:
User[123]: Tom
- Status: active.
- Profile: email a@b.com (verified).
- Roles: 2 total; values: admin and editor.
Safety Controls
--strict: reduces aggressive compression and keeps more explicit structure--preserve key1,key2,path.to.field: always keeps those keys or dotted paths, even when empty or normally dropped--expand collections|details|all: adds local sub-bullets so important parts are less compressed--show-paths: appends source markers like[@status]or[@orders[0]]to rendered lines
Example:
python3 scripts/json_to_readable_context.py \
--input payload.json \
--strict \
--preserve status,profile.email,orders \
--expand all \
--show-paths
Example with paths:
User[123]: Tom [@root]
Summary
- Status: active. [@active]
Collections
- Roles: 2 total; values: admin and editor. [@roles]
When To Read References
Read references/rules.md only when you need:
- the exact summarization heuristics
- examples of array and nested-object handling
- guidance for deciding whether to tighten or loosen output
Failure Handling
- Invalid JSON: stop and show the parse error
- Very irregular objects: fall back to simplified readable key/value lines
- Extremely deep payloads: cap traversal with
--max-depth - Overlong text blobs: truncate safely with length hints
Notes
jsonand PostgreSQLjsonbare treated the same once parsed- the default output is a single readable text artifact
- this skill intentionally favors readability over perfect structural fidelity
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (4,176 bytes)
- 📎 references/rules.md (2,732 bytes)
- 📎 scripts/json_to_readable_context.py (33,536 bytes)