rewrite-yaml

Create OpenRewrite YAML recipes using LST, visitor patterns, and JsonPath matching.

13|1|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/sjungling/claude-plugins --skill rewrite-yaml
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rewrite-yaml
Source: https://github.com/sjungling/claude-plugins/tree/main/plugins/openrewrite-author/skills/rewrite-yaml
Command: npx skills add https://github.com/sjungling/claude-plugins --skill rewrite-yaml

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires OpenRewrite, Python, and includes scripts (resource) and references (resource) components.

What problem does it solve?

Manually writing and maintaining complex YAML transformations is error-prone and time-consuming. This Skill automates the test-first development of robust OpenRewrite recipes, ensuring high-quality, maintainable YAML refactoring.

Core Features & Use Cases

  • Test-First Recipe Development: Guides you through writing failing tests before implementing YAML transformations.
  • LST-Based Manipulation: Leverages OpenRewrite's Lossless Semantic Tree for precise, formatting-preserving YAML changes.
  • JsonPath Matching: Utilizes powerful JsonPath expressions for targeted modifications in GitHub Actions, Kubernetes, and other YAML configs.
  • Use Case: Automatically migrate all GitHub Actions workflows from actions/checkout@v2 to actions/checkout@v3 across a large repository, ensuring all YAML formatting and comments are preserved.

Quick Start

Example: Generate boilerplate for a new recipe

python ./scripts/init_recipe.py --name MyYamlRecipe --package com.example.rewrite --description "My new YAML recipe"

Frequently Asked Questions about rewrite-yaml

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate YAML refactoring across GitHub Actions and Kubernetes files?

YAML refactoring automates bulk transformations of configuration files using OpenRewrite recipes. This Skill generates production-ready recipes that apply precise changes—like migrating action versions or updating Kubernetes manifests—while preserving formatting and comments across entire repositories.

What is the test-first approach to building OpenRewrite YAML recipes?

Test-first recipe development means writing failing tests that specify your desired YAML transformations before implementing the recipe logic. This ensures correctness and maintainability by validating each transformation against real YAML files in a RED-GREEN-REFACTOR workflow.

Can I use JsonPath matching to target specific YAML values in CI configurations?

Yes. JsonPath matching enables precise targeting of nested YAML values and structures in GitHub Actions workflows, Kubernetes configs, and other YAML files. You can search, modify, add, or delete keys and values based on JsonPath expressions without manual file-by-file editing.

Do I need Java knowledge to write OpenRewrite YAML recipes?

The recipes you create run on Java 8 and follow OpenRewrite conventions, but this Skill handles boilerplate generation and pattern guidance. You work with declarative recipe definitions and LST visitor patterns; Python scripts streamline the setup and testing workflow.

What are the limitations of LST-based YAML transformations?

LST-based transformations preserve formatting and comments precisely, but complex structural changes across deeply nested YAML require careful JsonPath expressions and thorough test coverage. The Java 8 compatibility requirement excludes modern language features like switch expressions and text blocks.