| name | yq |
| description | Safely parse, edit, merge, and transform YAML files using yq, providing robust command-line examples for extraction and in-place modifications. You MUST load this skill when using the yq tool. |
| license | MIT |
yq
Safely parse, edit, merge, and transform YAML files using yq, providing robust command-line examples for extraction and in-place modifications.
WHEN TO USE
- Automating modifications to YAML configuration files in CI/CD pipelines.
- Extracting specific values from complex or deeply nested YAML structures.
- Merging multiple YAML files programmatically.
- Converting between JSON and YAML formats in shell scripts.
WHEN NOT TO USE
- When writing full-fledged Python or Node.js scripts (use native YAML parsing libraries instead).
- When dealing with malformed or non-compliant YAML files (fix the files first).
- Simple string replacements where the YAML structure is flat and strictly controlled (though
yq is still safer).
- Simple text files that are not YAML (use
sed instead).
- JSON files where
jq is preferred (though yq works).
- Writing complex logic better suited for
python.
Core Principles
- Use yq: Rely on
yq (mikefarah/yq) for robust, correct YAML parsing rather than fragile tools like grep or sed to avoid breaking structure or indentation.
- In-Place Modification: Use the flag for editing YAML files in-place cleanly, which preserves comments and structure where supported.