Agent skill
jq
Lightweight and flexible JSON processor. Core Scenario: When the AI needs to filter, transform, format, or extract JSON data in the terminal. x-cmd version provides zero-dependency auto-installation.
Install this agent skill to your Project
npx add-skill https://github.com/x-cmd/skill/tree/main/data/x-cmd/jq
SKILL.md
x jq - JSON Processor (AI Optimized)
x jq is an enhanced module based on jq, with the core advantage of zero-dependency auto-installation and optimization for scripted tasks. It ensures JSON can be processed immediately in any environment.
When to Activate
- When specific fields need to be extracted from complex JSON responses.
- When JSON structures need to be filtered, restructured, or transformed.
- When unformatted JSON strings need to be beautified for further analysis.
- When processing results need to be output as raw strings (
-r) for other commands.
Core Principles & Rules
- Non-interactive First: AI should avoid the interactive
replmode and use jq expressions directly. - Pipe Integration: Recommended for use with pipes, e.g.,
cat data.json | x jq '.field'. - Format Control:
- Use
-r(raw-output) for raw values without quotes (ideal for getting single string values). - Use
-c(compact-output) for compact one-line JSON to save context Tokens.
- Use
- Environment Isolation:
x jqautomatically downloads and runs jq when necessary, without polluting the system environment.
Patterns & Examples
Extract and Output Raw String
# Get the value of the 'version' field (no quotes, suitable for script use)
x jq -r '.version' package.json
Filter Array and Compact Output
# Filter and output as a compact one-line JSON to save Tokens
x jq -c '.items[] | select(.status == "active")' data.json
Construct New JSON Object
# Construct a new object containing status and timestamp
x jq -n --arg ts "$(date)" '{"status": "ok", "timestamp": $ts}'
Process Multiple Files
# Merge and process multiple JSON files
x jq -s '.[0] * .[1]' config1.json config2.json
Checklist
- Confirm that a non-interactive command is used (no
rorrepl). - Consider if
-ris needed for plain text values. - Consider if
-cis needed to reduce output volume.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
pufferlib
High-performance reinforcement learning framework optimized for speed and scale. Use when you need fast parallel training, vectorized environments, multi-agent systems, or integration with game environments (Atari, Procgen, NetHack). Achieves 2-10x speedups over standard implementations. For quick prototyping or standard algorithm implementations with extensive documentation, use stable-baselines3 instead.
fluidsim
Framework for computational fluid dynamics simulations using Python. Use when running fluid dynamics simulations including Navier-Stokes equations (2D/3D), shallow water equations, stratified flows, or when analyzing turbulence, vortex dynamics, or geophysical flows. Provides pseudospectral methods with FFT, HPC support, and comprehensive output analysis.
metabolomics-workbench-database
Access NIH Metabolomics Workbench via REST API (4,200+ studies). Query metabolites, RefMet nomenclature, MS/NMR data, m/z searches, study metadata, for metabolomics and biomarker discovery.
geniml
This skill should be used when working with genomic interval data (BED files) for machine learning tasks. Use for training region embeddings (Region2Vec, BEDspace), single-cell ATAC-seq analysis (scEmbed), building consensus peaks (universes), or any ML-based analysis of genomic regions. Applies to BED file collections, scATAC-seq data, chromatin accessibility datasets, and region-based genomic feature learning.
zinc-database
Access ZINC (230M+ purchasable compounds). Search by ZINC ID/SMILES, similarity searches, 3D-ready structures for docking, analog discovery, for virtual screening and drug discovery.
astropy
Comprehensive Python library for astronomy and astrophysics. This skill should be used when working with astronomical data including celestial coordinates, physical units, FITS files, cosmological calculations, time systems, tables, world coordinate systems (WCS), and astronomical data analysis. Use when tasks involve coordinate transformations, unit conversions, FITS file manipulation, cosmological distance calculations, time scale conversions, or astronomical data processing.
Didn't find tool you were looking for?