openrewrite

openrewrite is a skill for Claude Code, Codex from motlin/claude-code-plugins. It costs 32 tokens per session (1,267 once invoked), scanned A, original, Apache-2.0.

A set of guidelines for maintaining tests for OpenRewrite recipes, which are automated Java code transformations. It covers test failures caused by import order, type checks, and editor warnings.

In plain words
What is it for?
Use it when fixing OpenRewrite recipe tests, validating generated Java code, or writing broader tests for transformation rules.
Why use it?
It helps distinguish formatting or import-order differences from real transformation bugs, so recipe tests can be corrected efficiently.

Skill for Claude CodeCodex

Part of the java plugin — 7 skills, 3 commands, 1 agent shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/motlin/claude-code-plugins/openrewrite
Any agent
npx skills add motlin/claude-code-plugins --skill openrewrite
Clone the repo
git clone --depth 1 https://github.com/motlin/claude-code-plugins

Made for: Claude Code, Codex.

Or install java, the plugin that ships this one along with the rest of its 7 skills, 3 commands, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for openrewrite

README.md
[![agentmods](https://agentmods.dev/badge/skills/motlin/claude-code-plugins/openrewrite.svg)](https://agentmods.dev/skills/motlin/claude-code-plugins/openrewrite)
Your own site
<a href="https://agentmods.dev/skills/motlin/claude-code-plugins/openrewrite"><img src="https://agentmods.dev/badge/skills/motlin/claude-code-plugins/openrewrite.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,267 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00032 $0.01267
Opus 5 $0.00016 $0.00633
Sonnet 5 $0.00006 $0.00253
Haiku 4.5 $0.00003 $0.00127

Measured yesterday against content hash 13f0dcff0bdd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

openrewrite scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/java/skills/openrewrite/SKILL.md · 223 lines

How it starts

The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.

OpenRewrite Recipe Development

This skill provides guidelines for developing OpenRewrite recipes and maintaining their tests, with a focus on import ordering issues.

Fixing Import Ordering Test Failures

🔧 OpenRewrite recipe tests often fail due to import order differences, not actual transformation issues.

Problem

OpenRewrite recipe tests fail with diffs showing only import order differences:

-import java.util.List;
-import org.assertj.core.api.Assertions;
+import org.assertj.core.api.Assertions;
+import java.util.List;

Root Cause

OpenRewrite manages imports automatically based on:

  • Existing imports in the file
  • JavaTemplate configuration
  • Import optimization rules
  • The order may differ from test expectations

Solution Approach

1. Fix the Recipe (if imports are missing)

Ensure your JavaTemplate is properly configured:

JavaTemplate template = JavaTemplate
    .builder("Your.template.code()")
    .imports(
        "org.assertj.core.api.Assertions",
        "org.eclipse.collections.impl.utility.Iterate"
    )
    .contextSensitive()  // Important for proper context handling
    .javaParser(JavaParser.fromJavaVersion()
        .classpath("assertj-core", "eclipse-collections", "eclipse-collections-api")
    )
    .build();

Don't forget to call:

maybeAddImport("org.assertj.core.api.Assertions");
maybeAddImport("org.eclipse.collections.impl.utility.Iterate");
maybeRemoveImport("old.package.OldClass");
2. Fix the Test Expectations

Accept the actual import order that OpenRewrite produces:

❌ Instead of forcing a specific order:

// DON'T expect a specific order you want
"import java.util.List;\n" +
"import org.assertj.core.api.Assertions;\n"

✅ Use the actual order OpenRewrite produces:

// DO accept the order OpenRewrite generates
"import org.assertj.core.api.Assertions;\n" +
"import org.eclipse.collections.impl.utility.Iterate;\n" +
"\n" +
"import java.util.List;\n"

Read the full file on GitHub · 223 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 223 lines · 32 tokens per session scan A 13f0dcff0bdd

Subscribe to this mod's changes

openrewrite is a skill published in the GitHub repository motlin/claude-code-plugins (15 stars, last pushed today), licensed Apache-2.0. It adds 32 tokens to every session and 1,267 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-04.

Related

Other skills, from other repositories