prefer-jq

prefer-jq is a skill for Claude Code from ncaq/konoka. It costs 58 tokens per session (1,172 once invoked), scanned A, original, Apache-2.0.

A rule to use jq, a command-line tool for reading and transforming JSON data, instead of general-purpose scripting languages for simple JSON tasks.

In plain words
What is it for?
Use it to extract values, filter records, transform JSON, and calculate simple summaries from JSON input.
Why use it?
It keeps small data operations shorter and more limited in scope, reducing review and approval effort for shell commands.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Part of the programming-tasuke plugin — 7 skills shipped together

Good fit Use it to extract values, filter records, transform JSON, and calculate simple summaries from JSON input.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ncaq/konoka/prefer-jq
View source ↗ ncaq/konoka
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ncaq/konoka --skill prefer-jq
Clone the repo
git clone --depth 1 https://github.com/ncaq/konoka

Made for: Claude Code.

Or install programming-tasuke, the plugin that ships this one along with the rest of its 7 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prefer-jq

README.md
[![agentmods](https://agentmods.dev/badge/skills/ncaq/konoka/prefer-jq/github.svg)](https://agentmods.dev/skills/ncaq/konoka/prefer-jq)
Your own site
<a href="https://agentmods.dev/skills/ncaq/konoka/prefer-jq"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/prefer-jq/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for prefer-jq

Your own site · 80×15
<a href="https://agentmods.dev/skills/ncaq/konoka/prefer-jq"><img src="https://agentmods.dev/badge/skills/ncaq/konoka/prefer-jq.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,172 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00058 $0.01172
Opus 5.5 $0.00023 $0.00469
Sonnet 5.5 $0.00012 $0.00234
Haiku 4.5 $0.00006 $0.00117

Measured 1mo ago against content hash 5cd6595b2dac, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

prefer-jq scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/programming-tasuke/skills/prefer-jq/SKILL.md · 105 lines

What it actually says

JSONの処理にはjqを優先する

JSONを読み取ったり、 絞り込んだり、 変換したりするだけの用事に、 Pythonなどの汎用スクリプト言語を持ち出さないでください。 jqを使ってください。

理由

汎用スクリプト言語は何でも出来てしまいます。 コマンドの実行を承認する人間は毎回スクリプトの中身を読んで安全性を判断しなければならず、 Bash(python:*)のような包括的な許可を出すことも危険です。 jqの出来ることはデータの変換にほぼ限られていて副作用が少ないため、 包括的な許可を出しやすく、 承認の手間が発生しません。

単にJSONを取り出したり整形したりするだけなら、 jqの方が短く書けて読みやすいという利点もあります。

汎用スクリプト言語のワンライナーは、 シェルのクォートとスクリプト側のクォートが干渉して壊れやすく、 リトライを繰り返す原因にもなります。

対比

値の取り出し。

# 避ける
python3 -c 'import json,sys; print(json.load(sys.stdin)["items"][0]["name"])'
# 使う
jq -r '.items[0].name'

絞り込み。

# 避ける
python3 -c 'import json,sys; d=json.load(sys.stdin); print("\n".join(x["name"] for x in d["items"] if x["active"]))'
# 使う
jq -r '.items[] | select(.active) | .name'

集計。

# 避ける
python3 -c 'import json,sys; print(sum(x["size"] for x in json.load(sys.stdin)["items"]))'
# 使う
jq '[.items[].size] | add'

Pythonに限った話ではありません。 node -eやruby -eやperl -eのような他の汎用言語のワンライナーも同様に避けてください。

よく使うオプション

  • -r: 文字列をクォートなしの生の値として出力します。シェル変数へ代入する時に使います。
  • -e: 出力に応じて終了ステータスを変えます。最後の出力がfalseかnullなら1、出力が一つも無ければ4になります。条件判定に使えます。
  • -n: 入力を読まずにJSONを組み立てます。
  • -s: 複数の入力をひとつの配列にまとめます。
  • --arg name valueと--argjson name json: シェルの値をフィルタへ安全に渡します。

シェルの値をフィルタの文字列へ連結してJSONを組み立てるのは避けてください。 クォートやエスケープが壊れます。

# 避ける
jq ".name = \"$name\"" data.json
# 使う
jq --arg name "$name" '.name = $name' data.json

ファイルの書き換え

リポジトリ内のファイルを書き換える時はEditツールを優先してください。 差分が読みやすく、 意図しない整形の変化も起きません。

jqは読み取りと抽出とパイプでの加工に使ってください。 jqは入力ファイルを直接書き換えないため、 別のファイルへ書き出してから置き換える必要があり、 その手間に見合うのは機械が生成した巨大なJSONを一括変換するような場合だけです。

例外

以下の場合はPythonなどを使って構いません。

  • HTTP通信やファイルシステムの操作など、JSONの変換以外の副作用が処理の本体である場合。
  • 統計処理や複雑な日時計算など、jqの標準機能では表現が極端に複雑になる場合。
  • 既存のPythonプロジェクトの一部としてコードを書く場合。
  • 実行環境にjqが入っていない場合。

例外に当たる場合でも、 JSONを抽出する部分だけをjqへ切り出せるなら切り出してください。

YAMLやXMLやTOMLやCSVについてはprogramming-tasuke:prefer-yqスキルを参照してください。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 105 lines · 58 tokens per session scan A 5cd6595b2dac

Subscribe to this mod's changes

prefer-jq is a skill published in the GitHub repository ncaq/konoka (3 stars, last pushed yesterday), licensed Apache-2.0. It adds 58 tokens to every session and 1,172 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-05.