jq

xdg's avatarfrom xdg

Extract specific fields from JSON files efficiently using jq instead of reading entire files, saving 80-95% context.

⭐2stars🔀0forks📁View on GitHub🕐Updated Nov 23, 2025

When & Why to Use This Skill

This Claude skill integrates the powerful jq command-line utility to enable precise JSON data extraction and transformation. By allowing the agent to query specific fields instead of reading entire files, it optimizes performance by saving 80-95% of the context window, making it an essential tool for handling large configuration files and complex API responses efficiently.

Use Cases

  • Extracting specific versioning or dependency information from large package.json or lock files without consuming excessive tokens.
  • Filtering and isolating relevant data points from massive API response payloads to streamline downstream processing.
  • Navigating deeply nested JSON structures in configuration files like tsconfig.json or cloud infrastructure templates to find specific settings.
  • Optimizing agent context management by retrieving only the necessary subset of structured data required for a specific task.
namejq
descriptionExtract specific fields from JSON files efficiently using jq instead of reading entire files, saving 80-95% context.

jq: JSON Data Extraction Tool

Use jq to extract specific fields from JSON files without loading entire file contents into context.

When to Use jq vs Read

Use jq when:

  • Need specific field(s) from structured data file
  • File is large (>50 lines) and only need subset
  • Querying nested structures
  • Filtering/transforming data
  • Saves 80-95% context vs reading entire file

Just use Read when:

  • File is small (<50 lines)
  • Need to understand overall structure
  • Making edits (need full context anyway)

Common File Types

JSON files where jq excels:

  • package.json, tsconfig.json
  • Lock files (package-lock.json, yarn.lock in JSON format)
  • API responses
  • Configuration files

Quick Examples

# Get version from package.json
jq -r .version package.json

# Get nested dependency version
jq -r '.dependencies.react' package.json

# List all dependencies
jq -r '.dependencies | keys[]' package.json

Core Principle

Extract exactly what is needed in one command - massive context savings compared to reading entire files.

Detailed Reference

For comprehensive jq patterns, syntax, and examples, load jq guide:

  • Core patterns (80% of use cases)
  • Real-world workflows
  • Advanced patterns
  • Pipe composition
  • Error handling
  • Integration with other tools