yq
$ yq Community Low RiskMike Farah's yq is a single-binary Go processor for YAML, JSON, XML, TOML, INI, and properties files using jq-inspired expressions. Agents rely on yq -o=json to normalize Kubernetes/Helm/CI configs cleanly and yq -i for surgical YAML edits without breaking formatting.
brew install yq yq runs locally in milliseconds to query or patch YAML/TOML/XML files without wasting context tokens reading entire manifests.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Supports -o=json/yaml/toml/xml, -M (no-colors), -e exit status on null/false, and clean stdin/stdout streaming.
- Supports
-o=json,-p/-omulti-format conversion,-Mmonochrome, and-e
Read-only stdout by default; mutations require explicit -i (--inplace) and work strictly on local files.
- Pure local stream processor; explicit
-irequired for file mutation
Zero-dependency static Go binary across macOS, Linux, and Windows.
- Static Go binary via Homebrew, GitHub Releases, and
go install
Essential companion to jq for YAML, TOML, XML, and INI configs while preserving comments on edits.
- Multi-format query/patch with comment preservation
Widely adopted mikefarah/yq v4 project under MIT license.
- Active
mikefarah/yqrepository
Comprehensive GitBook documentation with operator recipes.
- Official docs at mikefarah.gitbook.io/yq/
Security, Auth & Guardrails
None; operates purely on local files and stdin/stdout streams.
100% free and MIT open-source.
# yq Agent Rules - Preview expression output on stdout before adding `-i` (`--inplace`). - Verify you are running Mike Farah's Go `yq` v4 (`yq --version`) rather than the Python `kislyuk/yq` wrapper. - Pass `-o=json` when feeding extracted config into downstream tools or `jq`.
Agent-Ready Command Recipes
Safe Read-Only Queries
yq -o=json '.services | keys' docker-compose.yml
Reads only service names from a Compose file and emits clean JSON.
yq -o=json '[.kind, .metadata.name]' manifests.yaml
Summarizes resource kinds and names across multi-document YAML streams.
Controlled Writes & Previews
yq -i '.services.web.image = "nginx:1.27"' docker-compose.yml
Performs a targeted YAML mutation while preserving existing comments and structure.
Strengths for Agents
- + Converts effortlessly between YAML, JSON, TOML, XML, and INI with
-p/-o. - + Preserves YAML comments and formatting during
-isurgical edits. - + Zero-dependency static Go binary with sub-10ms startup.
Caveats & Pitfalls
- ! Distinct from Python's
kislyuk/yqwrapper (which usesjqsyntax); checkyq --versionin mixed environments.