openrewrite-recipe-writer

Automate authoring of OpenRewrite recipes in TypeScript for code transformations.

54|78|Updated Aug 21, 2020
One-click install
npx skills add https://github.com/openrewrite/rewrite-docs --skill openrewrite-recipe-writer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: openrewrite-recipe-writer
Source: https://github.com/openrewrite/rewrite-docs/tree/main/claude-skill
Command: npx skills add https://github.com/openrewrite/rewrite-docs --skill openrewrite-recipe-writer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Writing OpenRewrite recipes for automated code refactoring can be complex, requiring deep knowledge of recipe types, Lossless Semantic Tree (LST) manipulation, testing strategies, and best practices. This Skill simplifies the entire process, guiding you from concept to a fully tested, production-ready recipe.

Core Features & Use Cases

  • Intelligent Recipe Type Selection: Get expert advice on choosing between Declarative YAML, Refaster, or Imperative Java recipes based on your specific refactoring needs.
  • Structured Code Generation: Access templates and best practices for structuring your recipe classes, implementing visitors, and leveraging JavaTemplate for complex code modifications.
  • Comprehensive Testing Guidance: Learn how to write robust tests using RewriteTest, covering positive cases, negative cases, and multi-file scenarios to ensure your recipes are reliable.
  • Use Case: Imagine you need to migrate a deprecated API across hundreds of files in a large codebase. This Skill helps you quickly author an OpenRewrite recipe that automates the entire migration, saving countless hours of manual refactoring and ensuring consistency.

Quick Start

Navigate to the skill directory

cd claude-skill

Set your Anthropic API key (if not already set)

echo "your-anthropic-api-key" > anthropic.key

Upload or update the skill to Claude API

./upload-skill.sh

Frequently Asked Questions about openrewrite-recipe-writer

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

FAQPage Schema
How do I automate code refactoring across a large codebase?

Automate code refactoring by writing OpenRewrite recipes that apply transformations across hundreds of files consistently. This Skill guides you through recipe authoring, from selecting the right recipe type to testing and deployment, eliminating manual refactoring work.

What's the difference between declarative YAML, Refaster, and imperative Java recipes?

OpenRewrite offers three recipe types: Declarative YAML for simple transformations, Refaster for pattern-based changes, and Imperative Java for complex logic. This Skill helps you choose the right type based on your refactoring complexity and API migration needs.

How do I write and test OpenRewrite recipes for TypeScript code transformations?

Write OpenRewrite recipes in TypeScript using template-based patterns, visitors, and type attribution via configure(). This Skill provides scaffolding with RecipeSpec for testing positive cases, negative cases, and multi-file scenarios to ensure production-ready recipes.

Can I use OpenRewrite recipes to migrate deprecated APIs?

Yes, OpenRewrite recipes automate API migrations across your codebase by applying consistent transformations. This Skill walks you through authoring recipes that identify deprecated calls and replace them systematically, saving hours of manual migration work.

What do I need to know about the Lossless Semantic Tree before writing recipes?

The Lossless Semantic Tree (LST) is OpenRewrite's core data structure that preserves code formatting while enabling transformations. This Skill teaches LST manipulation fundamentals, visitor patterns, and JavaTemplate usage so your recipes modify code correctly and consistently.

How do I structure and document a production-ready OpenRewrite recipe?

Structure recipes using best-practice class layouts, implement visitors for code traversal, and document decision logic. This Skill covers recipe class organization, testing scaffolding, and documentation patterns required for reliable, maintainable recipes in production environments.