jpskill.com
🛠️ 開発・MCP コミュニティ

dasel

JSON、YAMLなどの構造化データを、コマンドラインツールdaselを使って抽出・変換・編集し、設定ファイルの変更やシェルスクリプトでのデータ処理を可能にするSkill。

📜 元の英語説明(参考)

Use dasel v3 CLI to query, modify, and transform structured data (JSON, YAML, TOML, XML, CSV, HCL, INI). Load this skill whenever the user wants to: read/write/convert data files with dasel, write dasel query expressions, filter/map/transform structured data on the command line, edit config files in place using dasel, pipe data through dasel in shell scripts, or asks about dasel syntax, functions, or CLI flags. Even if they just say "use dasel to..." or "dasel query for...", load this skill.

🇯🇵 日本人クリエイター向け解説

一言でいうと

JSON、YAMLなどの構造化データを、コマンドラインツールdaselを使って抽出・変換・編集し、設定ファイルの変更やシェルスクリプトでのデータ処理を可能にするSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o dasel.zip https://jpskill.com/download/8672.zip && unzip -o dasel.zip && rm dasel.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/8672.zip -OutFile "$d\dasel.zip"; Expand-Archive "$d\dasel.zip" -DestinationPath $d -Force; ri "$d\dasel.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して dasel.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → dasel フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Dasel v3

Dasel (Data-Select) は、構造化データファイルを、フォーマット間で一貫したクエリ構文を使用して、クエリ、変更、および変換するための CLI ツールです。

ドキュメントは references/ にバンドルされています。トピックについてより深く知りたい場合は、それらをお読みください。


CLI の基本

# stdin から読み込み、入力フォーマットを指定
echo '{"name":"Tom"}' | dasel -i json 'name'
# => "Tom"

# stdin リダイレクト経由でファイルから読み込み
dasel -i yaml 'database.host' < config.yaml

# フォーマットを変換: JSON を読み込み、YAML を出力
cat data.json | dasel -i json -o yaml

# ドキュメント全体を出力 (変更時に必要)
echo '{"a":1}' | dasel -i json --root 'a = 2'
# => {"a": 2}

主要なフラグ:

フラグ 短縮形 目的
--in FORMAT -i 入力フォーマット (json, yaml, toml, xml, csv, hcl, ini)
--out FORMAT -o 出力フォーマット
--root 選択された値だけでなく、ドキュメント全体を出力
--var name=fmt:file:path 名前付き変数としてファイルを渡す
--read-flag key=val パーサー固有の読み込みオプション
--write-flag key=val パーサー固有の書き込みオプション
--config PATH -c dasel 設定ファイルへのパス (デフォルト: ~/dasel.yaml)
--unstable 不安定/実験的な機能を有効にする

クエリ構文

クエリはドットで連結された アクセサー関数呼び出し であり、複数のステートメントを使用する場合は ; で終了します。

# ネストされたフィールドにアクセス
user.address.city

# 配列インデックス (ゼロベース)
users[0].name

# 範囲スライス
users[0:4]

# 代入 (ドキュメント内の値を変更)
user.name = "Alice"

# 変数 - $root は stdin, $this は現在の要素
$root.users.filter(active == true).map(name)

複数ステートメントのクエリ (; で区切り、最後のステートメントが出力):

$active = $root.users.filter(active == true);
$active.map(name)

環境変数

GREETING=hello NAME=tom dasel '$GREETING + " " + $NAME'
# => "hello tom"

一般的なパターン

値を読み取る

echo '{"foo":{"bar":"baz"}}' | dasel -i json 'foo.bar'
# => "baz"

値を変更する (ドキュメント全体を出力)

echo '{"foo":"old"}' | dasel -i json --root 'foo = "new"'
# => {"foo": "new"}

ファイルをインプレースで編集する

dasel -i yaml --root 'server.port = 9090' < config.yaml > config.yaml.tmp \
  && mv config.yaml.tmp config.yaml

注: v3 ではデータファイル用の -f フラグはありません。常に stdin (< file または cat file |) を使用してください。 注: 常に一時ファイルを経由してください — bash は dasel が読み込む前にターゲットを切り捨てます。

配列をフィルタリングする

echo '{"users":[{"name":"Alice","active":true},{"name":"Bob","active":false}]}' \
  | dasel -i json 'users.filter(active == true).map(name)'
# => ["Alice"]

マップ / 変換

echo '[1,2,3]' | dasel -i json 'map($this * 2)'
# => [2, 4, 6]

each を使用して要素をインプレースで変更する

echo '[1,2,3]' | dasel -i json 'each($this = $this + 1)'
# => [2, 3, 4]

デフォルト / 合体

# パスが見つからない場合はデフォルトにフォールバック
dasel -f config.yaml 'server.timeout ?? 30'

条件

dasel -f data.json 'if(count > 5) { "many" } else { "few" }'

再帰的下降 — キーですべての値を検索

# 任意の深さでキー "name" を持つすべての値
dasel -f data.json '..name'

# 任意の深さのすべての値
dasel -f data.json '..*'

述語ベースのディープサーチ

dasel -f data.json 'search(has("id") && has("name"))'

フォーマット変換

cat file.json | dasel -i json -o yaml
cat file.yaml | dasel -i yaml -o toml

新しいオブジェクトを構築する

echo '{"first":"Tom","last":"Wright"}' \
  | dasel -i json '{"fullName": first + " " + last}'

スプレッド演算子

# オブジェクトをマージ
echo '{"a":1}' | dasel -i json '{$this..., "b": 2}'
# => {"a":1,"b":2}

# 配列に追加
echo '[1,2,3]' | dasel -i json '[$this..., 4, 5]'
# => [1,2,3,4,5]

サポートされているフォーマット

フォーマット 読み込み 書き込み
json
yaml
xml --read-flag xml-mode=structured を参照
csv すべての値は文字列として扱われます。--read-flag csv-delimiter=;
hcl --read-flag hcl-block-format=array
toml 一般的に動作しますが、マップはソートされません
ini 基本的なセクション + キーと値のみ

主要な関数

関数 説明
filter(pred) 述語で配列をフィルタリング arr.filter($this > 1)
map(expr) 各要素を変換 arr.map($this * 2)
each(expr) インプレースで反復処理と変更 arr.each($this = $this+1)
search(pred) 再帰的な述語検索 search(has("key"))
has(key) キー/インデックスが存在するかどうかを確認 has("name")
len(x) 配列/文字列の長さ len($root.items)
keys(obj) マップのキー keys($root.config)
add(a,b) 加算 / 連結 add(1, 2)
join(arr, sep) 配列を文字列に結合 join(tags, ",")
replace(str,old,new) 文字列置換 replace(name,"_"," ")
sortBy(key) オブジェクトの配列をソート users.sortBy(name)
reverse(arr) 配列を反転 reverse(items)
min(arr) / max(arr) 数値の最小/最大 min(scores)
sum(arr) 数値を合計 sum(prices)
toString(x) 文字列に変換 toString(id)
toInt(x) 整数に変換 toInt(count)
typeOf(x) 型名 typeOf(value)
parse(fmt, str) 文字列をフォーマットとして解析 parse("json", raw)
readFile(path) ファイルを読み込む readFile("x.json")
base64e(str) Base64 エンコード base64e(token)
base64d(str) Base64 デコード base64d(encoded)

関数の完全なシグネチャと例については、references/functions.md を参照してください。


参照ファイル

ファイル いつ読むか
references/syntax.md 深掘り: 型、配列、オブジェクト、条件、スプレッド、合体、分岐、正規表現、再帰的下降
`refer
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Dasel v3

Dasel (Data-Select) is a CLI tool for querying, modifying, and converting structured data files using a consistent query syntax across formats.

Docs are bundled in references/. Read them when you need deeper detail on a topic.


CLI basics

# Read from stdin, specify input format
echo '{"name":"Tom"}' | dasel -i json 'name'
# => "Tom"

# Read from a file via stdin redirection
dasel -i yaml 'database.host' < config.yaml

# Convert formats: read JSON, output YAML
cat data.json | dasel -i json -o yaml

# Output the whole document (needed when modifying)
echo '{"a":1}' | dasel -i json --root 'a = 2'
# => {"a": 2}

Key flags:

Flag Short Purpose
--in FORMAT -i Input format (json, yaml, toml, xml, csv, hcl, ini)
--out FORMAT -o Output format
--root Output the full document, not just the selected value
--var name=fmt:file:path Pass a file as a named variable
--read-flag key=val Parser-specific read options
--write-flag key=val Parser-specific write options
--config PATH -c Path to dasel config file (default: ~/dasel.yaml)
--unstable Enable unstable/experimental features

Query syntax

Queries are dot-chained accessors and function calls, terminated with ; when using multiple statements.

# Access nested fields
user.address.city

# Array index (zero-based)
users[0].name

# Range slice
users[0:4]

# Assign (modifies the value in the document)
user.name = "Alice"

# Variables - $root is stdin, $this is current element
$root.users.filter(active == true).map(name)

Multi-statement queries (use ; to separate, last statement is the output):

$active = $root.users.filter(active == true);
$active.map(name)

Environment variables

GREETING=hello NAME=tom dasel '$GREETING + " " + $NAME'
# => "hello tom"

Common patterns

Read a value

echo '{"foo":{"bar":"baz"}}' | dasel -i json 'foo.bar'
# => "baz"

Modify a value (output full document)

echo '{"foo":"old"}' | dasel -i json --root 'foo = "new"'
# => {"foo": "new"}

Edit a file in place

dasel -i yaml --root 'server.port = 9090' < config.yaml > config.yaml.tmp \
  && mv config.yaml.tmp config.yaml

Note: there is no -f flag for data files in v3. Always use stdin (< file or cat file |). Note: always go via a temp file — bash truncates the target before dasel reads it.

Filter an array

echo '{"users":[{"name":"Alice","active":true},{"name":"Bob","active":false}]}' \
  | dasel -i json 'users.filter(active == true).map(name)'
# => ["Alice"]

Map / transform

echo '[1,2,3]' | dasel -i json 'map($this * 2)'
# => [2, 4, 6]

Modify elements in place with each

echo '[1,2,3]' | dasel -i json 'each($this = $this + 1)'
# => [2, 3, 4]

Default / coalesce

# Fall back to a default if path missing
dasel -f config.yaml 'server.timeout ?? 30'

Conditional

dasel -f data.json 'if(count > 5) { "many" } else { "few" }'

Recursive descent — find all values by key

# All values with key "name" at any depth
dasel -f data.json '..name'

# All values at any depth
dasel -f data.json '..*'

Predicate-based deep search

dasel -f data.json 'search(has("id") && has("name"))'

Format conversion

cat file.json | dasel -i json -o yaml
cat file.yaml | dasel -i yaml -o toml

Build a new object

echo '{"first":"Tom","last":"Wright"}' \
  | dasel -i json '{"fullName": first + " " + last}'

Spread operator

# Merge objects
echo '{"a":1}' | dasel -i json '{$this..., "b": 2}'
# => {"a":1,"b":2}

# Append to array
echo '[1,2,3]' | dasel -i json '[$this..., 4, 5]'
# => [1,2,3,4,5]

Supported formats

Format Read Write Notes
json
yaml
xml See --read-flag xml-mode=structured
csv All values as strings; --read-flag csv-delimiter=;
hcl --read-flag hcl-block-format=array
toml Generally working; unsorted maps
ini Basic sections + key values only

Key functions

Function Description Example
filter(pred) Filter array by predicate arr.filter($this > 1)
map(expr) Transform each element arr.map($this * 2)
each(expr) Iterate and modify in place arr.each($this = $this+1)
search(pred) Recursive predicate search search(has("key"))
has(key) Check key/index exists has("name")
len(x) Length of array/string len($root.items)
keys(obj) Keys of a map keys($root.config)
add(a,b) Add / concatenate add(1, 2)
join(arr, sep) Join array to string join(tags, ",")
replace(str,old,new) String replace replace(name,"_"," ")
sortBy(key) Sort array of objects users.sortBy(name)
reverse(arr) Reverse array reverse(items)
min(arr) / max(arr) Min/max of numbers min(scores)
sum(arr) Sum numbers sum(prices)
toString(x) Convert to string toString(id)
toInt(x) Convert to int toInt(count)
typeOf(x) Type name typeOf(value)
parse(fmt, str) Parse a string as a format parse("json", raw)
readFile(path) Read a file readFile("x.json")
base64e(str) Base64 encode base64e(token)
base64d(str) Base64 decode base64d(encoded)

For full function signatures and examples, see references/functions.md.


Reference files

File When to read
references/syntax.md Deep dive: types, arrays, objects, conditionals, spread, coalesce, branches, regex, recursive descent
references/functions.md All function signatures with examples
references/input-output.md Stdin/stdout, file editing, variables, format flags

Tips

  • Always use --root when modifying data and wanting the full document back.
  • Use ; to write multi-statement queries for clarity.
  • $root is the stdin document; $this is the current element inside functions.
  • For in-place file edits, always redirect to a .tmp file first, then mv.
  • The ternary operator (? :) is not yet implemented — use if/else form instead.
  • branch is unstable — requires --unstable flag.