yq-yaml-processing
yq YAML processing: query, filter, transform YAML. Use when parsing configs, modifying Kubernetes manifests or GitHub Actions workflows, or transforming YAML.
What this skill does
# yq YAML Processing
Expert knowledge for processing, querying, and transforming YAML data using yq v4+, the lightweight command-line YAML processor with jq-like syntax.
## When to Use This Skill
| Use this skill when... | Use another tool instead when... |
|------------------------|----------------------------------|
| Querying or modifying YAML files | Processing JSON only (use jq) |
| Updating Kubernetes manifests | Full Kubernetes management (use kubectl) |
| Processing GitHub Actions workflows | XML processing (use xmlstarlet) |
| Merging YAML configurations | Complex data transformations (use scripting) |
## Core Expertise
**YAML Operations**
- Query and filter YAML with path expressions
- Transform YAML structure and shape
- Multi-document YAML support
- Convert between YAML, JSON, XML, and other formats
**Configuration Management**
- Modify Kubernetes manifests
- Update GitHub Actions workflows
- Process Helm values files
- Manage application configurations
## Essential Commands
### Basic Querying
```bash
# Pretty-print YAML
yq '.' file.yaml
# Extract specific field
yq '.fieldName' file.yaml
# Extract nested field
yq '.spec.containers[0].name' pod.yaml
# Access array element
yq '.[0]' array.yaml
yq '.items[2]' data.yaml
```
### Reading YAML
```bash
# Read specific field
yq '.metadata.name' deployment.yaml
# Read nested structure
yq '.spec.template.spec.containers[].image' deployment.yaml
# Read with default value
yq '.optional // "default"' file.yaml
# Check if field exists
yq 'has("fieldName")' file.yaml
```
### Modifying YAML (In-Place)
```bash
# Update field value
yq -i '.metadata.name = "new-name"' file.yaml
# Update nested field
yq -i '.spec.replicas = 3' deployment.yaml
# Add new field
yq -i '.metadata.labels.app = "myapp"' file.yaml
# Delete field
yq -i 'del(.spec.nodeSelector)' file.yaml
# Append to array
yq -i '.items += {"name": "new-item"}' file.yaml
# Update all matching elements
yq -i '(.items[] | select(.name == "foo")).status = "active"' file.yaml
```
### Multi-Document YAML
```bash
# Split multi-document YAML
yq -s '.metadata.name' multi-doc.yaml
# Select specific document (0-indexed)
yq 'select(document_index == 0)' multi-doc.yaml
# Process all documents
yq eval-all '.' multi-doc.yaml
# Filter documents
yq 'select(.kind == "Deployment")' k8s-resources.yaml
# Combine YAML files
yq eval-all '. as $item ireduce ({}; . * $item)' file1.yaml file2.yaml
```
### Object Operations
```bash
# Get all keys
yq 'keys' file.yaml
# Select specific fields
yq '{name, version}' file.yaml
# Merge objects
yq '. * {"updated": true}' file.yaml
yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' base.yaml override.yaml
# Deep merge
yq eval-all '. as $item ireduce ({}; . *+ $item)' base.yaml override.yaml
```
## Agentic Optimizations
| Context | Command |
|---------|---------|
| Read field | `yq '.field' file.yaml` |
| Update in-place | `yq -i '.field = "value"' file.yaml` |
| YAML to JSON | `yq -o=json '.' file.yaml` |
| Compact JSON | `yq -o=json -I=0 '.' file.yaml` |
| Filter documents | `yq 'select(.kind == "Deployment")' file.yaml` |
| Merge configs | `yq eval-all 'select(fileIndex == 0) * select(fileIndex == 1)' base.yaml override.yaml` |
| Validate YAML | `yq '.' file.yaml` |
## Quick Reference
### Operators
- `.field` - Access field
- `.[]` - Iterate array/object
- `|` - Pipe (chain operations)
- `,` - Multiple outputs
- `//` - Alternative operator (default value)
- `*` - Merge objects (shallow)
- `*+` - Deep merge objects
### Functions
- `keys`, `values` - Object keys/values
- `length` - Array/object/string length
- `select()` - Filter
- `sort_by()` - Sort
- `group_by()` - Group
- `unique` - Remove duplicates
- `has()` - Check field existence
- `type` - Get value type
- `add` - Sum or concatenate
- `del()` - Delete field
### Flags
| Flag | Description |
|------|-------------|
| `-i` | In-place edit |
| `-o` | Output format (json, yaml, xml, csv, tsv, props) |
| `-p` | Input format (json, yaml, xml) |
| `-I` | Indent (default: 2) |
| `-r` | Raw output (no quotes) |
| `-n` | Null input (create from scratch) |
| `-s` | Split multi-document YAML |
### String Functions
- `split()`, `join()` - String/array conversion
- `contains()` - String/array contains
- `test()` - Regex match
- `sub()`, `gsub()` - String substitution
- `upcase`, `downcase` - Case conversion
For detailed examples, advanced patterns, and best practices, see [REFERENCE.md](REFERENCE.md).
## Resources
- **Official Documentation**: https://mikefarah.gitbook.io/yq/
- **GitHub Repository**: https://github.com/mikefarah/yq
- **Try with Docker**: `docker run --rm -i mikefarah/yq '.key' <<< 'key: value'`
- **Operators Reference**: https://mikefarah.gitbook.io/yq/operators/
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.