jq
What it does
This skill helps you pull out, filter and reshape information from JSON data. It is for anyone working with API responses, config files or logs who needs one specific piece of data.
When to use it
- βWhen you need to pull one field or a filtered list out of a JSON response.
- βWhen you want to reshape JSON data into a different structure.
- βWhen you are reading a config file or log in JSON and need a quick answer.
Skill link
https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/jq/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βFrom this API response, give me just the names and email addresses of all active users as a list.β
5 new skills a week. 1 minute to read.
How it works
The agent writes a jq filter that selects, filters or rebuilds the JSON and returns the result. The built-in jq supports common flags such as raw output and compact output.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
jq β Built-in JSON Processor
Crush ships a built-in jq command (via github.com/itchyny/gojq) available
in the bash tool. No external binary is required.
Supported Flags
| Flag | Description |
|---|---|
-r, --raw-output |
Output strings without quotes |
-j, --join-output |
Like -r but no trailing newline |
-c, --compact-output |
One-line JSON output |
-s, --slurp |
Read all inputs into an array |
-n, --null-input |
Use null as input (ignore stdin) |
-e, --exit-status |
Exit 1 if last output is false or null |
-R, --raw-input |
Read each line as a string, not JSON |
--arg name value |
Bind $name to a string value |
--argjson name value |
Bind $name to a parsed JSON value |
File arguments after the filter are also supported: jq '.foo' file.json.
Differences from Standard jq
The built-in uses gojq, which is a pure-Go jq implementation. Key differences:
- No object key ordering β keys are sorted by default;
keys_unsortedand-Sare unavailable. - Arbitrary-precision integers β large integers keep full precision (addition, subtraction, multiplication, modulo, division when divisible).
- String indexing β
"abcde"[2]returns"c". - Not supported β
--ascii-output,--seq,--stream,--stream-errors,-f/--from-file,--slurpfile,--rawfile,--args,--jsonargs,input_line_number,$__loc__, some regex features (backreferences, look-around). - YAML β gojq supports
--yaml-input/--yaml-outputbut the built-in does not currently expose these flags.
Common Patterns
Extract a field:
echo '{"name":"crush"}' | jq '.name'
Filter an array:
echo '[1,2,3,4,5]' | jq '[.[] | select(. > 3)]'
Reshape objects:
echo '{"first":"Ada","last":"Lovelace"}' | jq '{full: (.first + " " + .last)}'
Use variables:
echo '{}' | jq --arg host localhost --argjson port 8080 '{host: $host, port: $port}'
Slurp multiple JSON values:
echo '{"a":1}{"b":2}' | jq -s '.'
Compact output for piping:
echo '{"a":1}' | jq -c '.a += 1'
Raw string output:
echo '["one","two","three"]' | jq -r '.[]'
Process a file:
jq '.dependencies | keys' package.json
Null input for constructing JSON:
jq -n --arg msg hello '{"message": $msg}'
Tips
- Pipe jq output to other commands:
jq -r '.url' data.json | xargs curl - Chain filters with
|inside the expression, not shell pipes. - Use
tryto suppress errors on missing keys:jq 'try .foo.bar' - Use
// "default"for fallback values:jq '.name // "unknown"' - Use
@csv,@tsv,@base64,@html,@urifor format strings.
FAQ
Do I need to install jq separately?
No. The jq command is built in and needs no external program.
Does it work exactly like standard jq?
Mostly, but object keys are sorted by default, and some standard flags are not available.
Can it read files as well as piped data?
Yes. You can pass a file name after the filter.
Details
Original description by the author
Use when the user needs to query, filter, reshape, extract, create, or construct JSON data β including API responses, config files, log output, or any structured data β or when helping the user write or debug JSON transformations.
repo: charmbracelet/crush
Popularity
- GitHub stars
- 29k
- Ranking position
- #9767
- License
- β
- Updated
- 11/2/2026
Comments
- β¦
More skills from this repository
crush-config
29kHelps your agent set up Crush by writing its crushrc or crush.json config, including providers, models, MCP servers, hooks and permissions.
crush-hooks
29kHelps your agent write and debug Crush hooks that check, block or change tool calls before they run, using settings in crush.json.
Similar skills
gitcrawl
394kLets your agent search a saved archive of GitHub issues and pull requests, group duplicates, and check their current status on GitHub.
slacrawl
394kLets your agent search and count messages in a local Slack archive, check how fresh that archive is, and refresh it when needed.
goplaces
394kHelps your agent search for places, get their details and reviews, and resolve place names using Google Places, with JSON output for scripts.