Skip to content
cccskills
FreePublished on GitHub

jq

Extract fields, filter records, and reshape JSON from API responses, configuration files, or logs using Crush’s built-in jq. Get help writing and debugging transformations, constructing new JSON, and formatting output for other commands.

OriginalShow the original 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.

See how to install

Good for

  • Extract selected fields from API responses
  • Filter JSON arrays by conditions
  • Reshape configuration data or construct JSON
  • Debug transformations and format output

Files included (1)

  • SKILL.md2.9 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

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

FlagDescription
-r, --raw-outputOutput strings without quotes
-j, --join-outputLike -r but no trailing newline
-c, --compact-outputOne-line JSON output
-s, --slurpRead all inputs into an array
-n, --null-inputUse null as input (ignore stdin)
-e, --exit-statusExit 1 if last output is false or null
-R, --raw-inputRead each line as a string, not JSON
--arg name valueBind $name to a string value
--argjson name valueBind $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:

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 try to suppress errors on missing keys: jq 'try .foo.bar'
  • Use // "default" for fallback values: jq '.name // "unknown"'
  • Use @csv, @tsv, @base64, @html, @uri for format strings.

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

builtin-skills

FreeSummary

Add or edit skills bundled with Crush, following guidance on file placement, required metadata, compile-time embedding, and discovery tests. It also explains how built-in skills are loaded and how user skills override them.

  • Adding a skill bundled with Crush
  • Editing an existing built-in skill
  • Understanding skill discovery and overrides
charmbracelet/crush28.7KUpdated Oct 19, 2026

crush-config

FreeSummary

Configure Crush with Bash or JSON files to choose AI providers and models, connect external tools, set permissions, and adjust behavior. Understand how project and global settings combine when customizing your working environment.

  • Set up AI providers and model selections
  • Connect MCP servers and language servers
  • Configure tool permissions and execution hooks
charmbracelet/crush28.7KUpdated Oct 19, 2026

crush-hooks

FreeSummary

Create, configure, and troubleshoot Crush hooks, commands that run before tool execution. Use them to block or approve calls, rewrite tool input, or add context for the agent, with guidance on configuration and troubleshooting.

  • Blocking destructive shell commands
  • Automatically approving read-only tools
  • Adding editing reminders for the agent
charmbracelet/crush28.7KUpdated Oct 19, 2026

shell-builtins

FreeSummary

Add or modify commands handled inside Crush's embedded shell before they reach the operating system. The guidance covers command routing, input and output streams, exit codes, and cancellation so commands work with pipes, redirection, and hook timeouts.

  • Adding a command to Crush's embedded shell
  • Modifying an existing built-in command
  • Supporting pipes and output redirection
charmbracelet/crush28.7KUpdated Oct 19, 2026

See all skills by charmbracelet

Report a problem with this skill