crush/skills/jq/SKILL.md
Process, query, and transform JSON data using jq. Use when working with JSON files, API responses, or any JSON data that needs filtering, extracting, reshaping, or analyzing. Triggers include mentions of "jq", JSON processing, JSON filtering, JSON transformation, extracting data from JSON, or any task involving jq commands or expressions.
npx skillsauth add meowgorithm/dotfiles jqInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Command-line JSON processor. Filter, transform, and analyze JSON data with concise expressions.
# Pretty-print
jq '.' data.json
# Extract field
jq '.name' data.json
# Extract nested
jq '.user.email' data.json
# Array element
jq '.items[0]' data.json
# All array elements
jq '.items[]' data.json
# From stdin
curl -s https://api.example.com | jq '.results'
# Select objects matching condition
jq '.[] | select(.status == "active")'
jq '.[] | select(.age >= 18)'
# Select with multiple conditions
jq '.[] | select(.role == "admin" and .active)'
# Has key check
jq '.[] | select(has("email"))'
# Unique values
jq 'unique' # unique sorted
jq 'unique_by(.name)' # unique by field
# Create new object
jq '{name: .user.name, email: .user.email}'
# Map over array
jq '.items | map(.price)'
# Map with transform
jq '.items | map({name: .title, cost: .price * 1.1})'
# Flatten nested arrays
jq '[.[] | .tags[]]'
# Group and count
jq 'group_by(.category) | map({key: .[0].category, count: length})'
# Sort
jq 'sort_by(.age)'
jq 'sort_by(.name | ascii_downcase)'
# Reverse
jq 'reverse'
# Min/max
jq '. | max_by(.score)'
jq '. | min_by(.price)'
# Stats
jq '[.[].score] | add / length' # average
jq '[.[].price] | add' # sum
jq 'length' # count
# Format strings
jq '.name | "Hello, \(.)!"'
# Split/join
jq '.csv | split(",")'
jq '.tags | join(", ")'
# Regex
jq '.url | capture("https://(?<host>[^/]+)")'
jq '.names | map(select(test("^admin"; "i")))'
# Case
jq '.name | ascii_downcase'
jq '.name | ascii_upcase'
# Trim
jq '.name | ltrimstr("prefix-") | rtrimstr("-suffix")'
# Recursive descent
jq '..'
# Paths to matching values
jq '[paths(.score > 90)]'
# Get value at path
jq 'getpath([0, "name"])'
# Reduce
jq 'reduce .[] as $x (0; . + $x.value)'
# Variables
jq '.items | to_entries | map(.key + "=" + (.value | tostring))'
# Conditionals
jq 'if .score >= 90 then "A" elif .score >= 80 then "B" else "C" end'
# Try-catch
jq '.[] | try .code catch "N/A"'
# Read from multiple files
jq -s '.[0] + .[1]' file1.json file2.json
# Slurp (wrap multiple objects into array)
jq -s '.' objects*.json
# Raw string output (no quotes)
jq -r '.name'
# Raw input (each line as string, not JSON)
jq -R '.'
| Flag | Purpose |
|------|---------|
| -r | Output raw strings (no quotes) |
| -R | Read raw input (each line as string) |
| -s | Slurp all inputs into array |
| -e | Exit with error if result is null/false |
| -n | Don't read input (use with jq -n '...') |
| -f file | Read filter from file |
| -c | Compact output |
| -C | Color output |
| -M | Monochrome output |
| --arg name val | Pass variable |
| --argjson name val | Pass JSON variable |
| (pipe), like Unix pipesselect() to filter — it's jq's grepmap(f) is shorthand for [.[] | f]to_entries / from_entries to iterate object key-value pairshas("key") checks for key existence; .key // "default" provides fallbacksjq '.foo' not jq .foojq with head/tail for inspection before full processingjq -n with --arg to construct JSON: jq -n --arg name "foo" '{name: $name}'For recursive operations, complex merging, date/time handling, stream processing, and debugging — see references/advanced.md.
tools
Convert video files (MP4, MOV, WebM, GIF, MKV, AVI, etc.) into animated WebP images with control over fps, size, quality, loop count, and trimming. Use when the user wants to turn a video or screen recording into an animated WebP, create a lightweight demo loop, replace an animated GIF with a smaller WebP, or produce a short clip as a .webp.
development
Convert images between formats (PNG, JPEG, WebP, GIF, BMP, TIFF, AVIF, HEIC) with quality control and resizing. Use when the user needs to convert images, batch process multiple files, optimize image sizes, or convert to modern formats like WebP or AVIF.
tools
Use charmtone colors via the `charmtone` CLI or Go API (`github.com/charmbracelet/x/exp/charmtone`). Triggers when the user asks to use charmtone colors, generate color palettes, get hex values, create CSS/SCSS/Vim color variables, or work with the CharmTone palette in Go code. Also triggers on mentions of specific charmtone color names (Cherry, Charple, Julep, Hazy, etc.) or requests to pick/choose/apply charmtone colors.
testing
Stage and commit changes with a Conventional Commits message. Invoke with /commit "optional scope hint". Inspects the diff, picks an appropriate type and scope, writes a concise message, and commits. Does not push.