yq
CLI>=4.0A lightweight YAML, JSON, and XML processor.
Query and edit YAML/JSON/XML files like jq for YAML
Verified commands
Executed by our harness on the platforms shown; the assertion checked the actual result, not just the exit code.
Read a YAML value
yq '.services.web.ports[0]' compose.ymlCommon failures (1)
- Error: unknown command / different syntaxthese recipes target mikefarah yq v4 (brew/apt yq). The Python yq (pip) uses jq syntax instead.
Edit a YAML value in place
yq -i '.spec.replicas = 3' deploy.yamlAppend an item to a YAML list in place
yq -i '.list += ["c"]' config.yamlConvert YAML to JSON
yq -o=json '.' config.yamlConvert JSON to YAML
yq -p=json -o=yaml '.' data.jsonInstall
Homebrew
brew install yqAgent notes
- When to use
- Editing Kubernetes manifests, CI config, or any YAML files
- Quick examples
yq '.spec.replicas' deploy.yamlyq -i '.version = "2.0"' config.yaml
Use from an agent
curl -s https://clihub.com/api/tools/yq | jq '.agentHints.provenRecipes[] | {task, command, verified}'Or call get_tool with slug yq on the MCP server at https://clihub.com/mcp.