jq
JSON processing with jq for filtering, transforming, aggregating, and reshaping data from files, APIs, and command output on the command line. Use when…
от lanej★ 41 звезда на GitHub
Установить jq в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
jq
Filter syntax works as documented. This file covers tool selection and the idioms that prevent the common failure modes.
When not to reach for jq
- CSV/TSV →
xsv; YAML →yq; analytical SQL over JSON →duckdb(read_json_auto). - No in-place editing. Write to a temp file and move it;
jq '...' f.json > f.jsontruncates the input before jq reads it.
Idioms that matter
jq -r '.name' # raw string output — no surrounding quotes
jq -c '.' # compact; required when piping NDJSON onward
jq '.field // "default"' # alternative operator — survives null/missing
jq '.maybe?' # suppress "cannot index" instead of erroring out
jq --arg env prod '.[$env]' # inject shell values; never interpolate into the filter string
jq -n --argjson d "$JSON" '$d.x' # no input, build from arguments
jq -r '.[] | [.a, .b] | @csv' # @csv / @tsv / @sh handle quoting correctly
jq 'to_entries | map(...) | from_entries' # operate on keys
jq 'walk(if type == "object" then del(.secret) else . end)' # recursive edit
Slurp vs. stream
-s reads the whole input into one array — convenient, but loads everything into memory. For large
or NDJSON input, process record-by-record instead:
jq -c 'select(.important)' stream.ndjson # one object per line, streaming
jq --stream 'select(length == 2)' huge.json # leaf-level streaming for a single huge document
Filter early, before any group_by/sort_by, which must materialize the whole set.
Diagnosing errors
| Message | Cause |
|---|---|
parse error: Invalid numeric literal |
Malformed JSON — validate with jq empty file.json |
Cannot index string with string |
Field access on a non-object; check with jq 'type' |
Cannot iterate over null |
Missing field; use .field // [] |
jq empty file.json is the fast validity check — silence means valid. debug prints intermediate
values to stderr without disturbing the output stream.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл jq?
JSON processing with jq for filtering, transforming, aggregating, and reshaping data from files, APIs, and command output on the command line. Use when processing JSON via command-line filters. Don't use for CSV/TSV (use xsv), YAML (use yq), or analytical queries requiring SQL (use duckdb).
Как установить скилл jq?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл jq запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…