# Jq

Use when the user needs to query, filter, reshape, extract, create, or construct JSON...

- Repository: https://github.com/charmbracelet/crush (28908 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add charmbracelet/crush --skill jq -g -a claude-code -y`
Codex: `npx skills add charmbracelet/crush --skill jq -g -a codex -y`
Cursor: `npx skills add charmbracelet/crush --skill jq -g -a cursor -y`
Gemini CLI: `npx skills add charmbracelet/crush --skill jq -g -a gemini-cli -y`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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_unsorted`
  and `-S` are 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-output` but the
  built-in does not currently expose these flags.

## Common Patterns

Extract a field:
```sh
echo '{"name":"crush"}' | jq '.name'
```

Filter an array:
```sh
echo '[1,2,3,4,5]' | jq '[.[] | select(. > 3)]'
```

Reshape objects:
```sh
echo '{"first":"Ada","last":"Lovelace"}' | jq '{full: (.first + " " + .last)}'
```

Use variables:
```sh
echo '{}' | jq --arg host localhost --argjson port 8080 '{host: $host, port: $port}'
```

The rest: https://github.com/charmbracelet/crush/blob/HEAD/internal/skills/builtin/jq/SKILL.md
