| name | query-files |
| description | This skill SHOULD be used for structured extraction or batch queries against JSON (use jq), YAML (use yq), or Markdown (use mq), and for advanced text search with ripgrep flags or pipe composition (use rg). |
Context-Efficient Extraction
Extract specific data from files using CLI tools instead of built-in Read/Grep. Saves 80-95% of context tokens on large files and enables features the built-in tools lack.
Route by Task
| Task | Tool | When to use over built-in |
|---|
| JSON field extraction | jq | File >50 lines, need specific fields |
| YAML field extraction | yq | File >50 lines, need specific fields |
| Markdown element extraction | mq | Need code blocks, links, headers, tables |
| Text search with advanced flags | rg | Need -F, -v, -w, -C, pipe composition |
Fall back to Read when the file is small (<50 lines), the overall structure matters, or edits follow immediately. Fall back to built-in Grep for straightforward pattern matching (handles 95% of search needs).
jq: JSON Extraction
jq -r '.version' package.json
jq -r '.compilerOptions.target' tsconfig.json
jq -r '.dependencies.react' package.json
jq -r '.scripts | keys[]' package.json
jq -r '.dependencies | keys[]' package.json
jq '{name, version}' package.json
jq '.items[] | select(.active == true)' data.json
jq '.dependencies | length' package.json
jq -r '.data[].name' response.json
jq -r '.dependencies | to_entries[] | select(.value | startswith("^")) | "\(.key): \(.value)"' package.json
Common files: package.json, tsconfig.json, package-lock.json, .eslintrc.json, API responses.
For detailed patterns (package.json, tsconfig, API responses), load jq reference.
yq: YAML Extraction
yq '.version' pubspec.yaml
yq '.services.web.image' docker-compose.yml
yq '.services | keys' docker-compose.yml
yq '.jobs.build.steps[0].name' .github/workflows/ci.yml
yq '.services.[] | select(.ports)' docker-compose.yml
yq '.name, .version' pubspec.yaml
yq '.services.*.image' docker-compose.yml
yq -o=json '.' config.yaml
Common files: docker-compose.yml, .github/workflows/*.yml, kubernetes manifests, Helm charts, pubspec.yaml.
For detailed patterns (Docker Compose, GitHub Actions, Kubernetes), load yq reference.
mq: Markdown Extraction
mq '.code' README.md
mq '.code("python")' README.md
mq '.h' README.md
mq '.h2' README.md
mq '.link.url' README.md
mq '.[][]' README.md
mq '.list' README.md
mq '.yaml.value' file.md
mq '.yaml.value' file.md | yq -o json
mq '.code | select(contains("import"))' file.md
mq -F json '.code' README.md | jq '.[0]'
Common files: README.md, CHANGELOG.md, documentation, API docs, specs.
For detailed patterns (selectors, filtering, output formats, frontmatter), load mq reference.
rg: Advanced Text Search
Use rg via Bash when the built-in Grep tool lacks the flag or composition needed.
rg -F 'console.log(' .
rg -w 'function' .
rg -v 'test' -t js .
rg -n -C 2 'pattern' .
rg -t js 'import' .
rg -t py 'def ' .
rg -t go 'func ' .
rg --glob '!node_modules' 'pattern' .
rg -c 'TODO' .
rg -l 'pattern' .
rg 'pattern' . | head -10
rg -l 'pattern' . | sort -u
For detailed patterns (function defs, imports, file types, pipe composition), load rg reference.
Cross-Tool Pipelines
mq '.yaml.value' file.md | yq '.description'
mq -F json '.link' README.md | jq '.[].url'
rg -l 'apiVersion' -t yaml | xargs -I {} yq '.kind' {}
fd -e md | xargs -I {} mq '.code("bash")' {}
yq -o=json '.' config.yaml | jq '.services | keys[]'
Core Principle
One command, exact data, minimal context. Built-in tools load everything; these tools load only what matters.