본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트29k · #9767

jq

하는 일

이 스킬은 JSON 데이터에서 정보를 뽑아내고, 걸러 내고, 다시 구성하도록 돕습니다. API 응답, 설정 파일, 로그를 다루며 특정 데이터 하나가 필요한 사람을 위한 스킬입니다.

사용하는 경우

  • ✓JSON 응답에서 필드 하나나 걸러진 목록을 뽑아야 할 때.
  • ✓JSON 데이터를 다른 구조로 다시 만들고 싶을 때.
  • ✓JSON 형식의 설정 파일이나 로그를 읽고 빠른 답이 필요한 경우.

스킬 링크

https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/jq/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/charmbracelet/crush/blob/main/internal/skills/builtin/jq/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 API 응답에서 활성 사용자의 이름과 이메일 주소만 목록으로 뽑아 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트가 JSON을 선택하고, 걸러 내고, 다시 만드는 jq 필터를 작성해 결과를 돌려줍니다. 내장 jq는 원시 출력이나 압축 출력 같은 일반적인 옵션을 지원합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 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_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.
자주 묻는 질문

jq를 따로 설치해야 하나요?

아니요, jq 명령이 내장되어 있어 외부 프로그램이 필요하지 않습니다.

표준 jq와 똑같이 작동하나요?

대부분 같지만, 객체 키가 기본적으로 정렬되며 일부 표준 옵션은 사용할 수 없습니다.

파이프로 받은 데이터뿐 아니라 파일도 읽을 수 있나요?

네, 필터 뒤에 파일 이름을 넘길 수 있습니다.

상세 정보

작성자의 원본 설명

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

인기도

GitHub 스타
29k
순위
#9767
라이선스
—
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬