Skip to main content
skill CX Codex

145-java-refactoring-high-performance — Claude Code skill

145-java-refactoring-high-performance — a skill for refactoring Java code for performance: reduce memory allocations, optimize CPU hot paths, and improve syntax. Works with Claude Code, Cursor, GitHub Copilot, and other AI editors.

Apache-2.0 327 installs ★ 465 updated 2026-10-21

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add jabrena/plinth --skill 145-java-refactoring-high-performance -a claude-code
Open on GitHub

What 145-java-refactoring-high-performance does

This skill guides Java performance optimization through profiling-driven techniques. It covers three reference areas: memory allocation (primitives vs. wrappers, escape analysis, data layout), CPU-bound code (loop unrolling, bitwise operations, SIMD), and code shape (APIs, control flow, concurrency, I/O). The workflow starts by identifying a bottleneck and establishing a baseline, then selects the relevant reference section, applies minimal changes, and validates results against real throughput or latency gains.

The skill enforces a measure-first principle: optimize only where profiling shows actual hot spots. Includes bad/good code examples, validation workflows, and safety constraints. Part of the Plinth Toolkit by Juan Antonio Breña Moral.

What it helps with

  • optimize Java hot paths based on profiling results
  • reduce memory pressure: lower allocations, tune primitives and data layout
  • improve CPU-bound algorithms: unroll loops, apply bitwise tricks, explore SIMD
  • refactor syntax and control flow to cut latency
  • verify performance gains before committing changes

Example prompts for the agent

  • Optimize this Java method for performance using a measure-first approach
  • Review the code for avoidable memory allocations and object escapes
  • Simplify this hot path: reduce branching and unroll the loop

How to install 145-java-refactoring-high-performance

1Skills CLI (Vercel)

npx skills add jabrena/plinth --skill 145-java-refactoring-high-performance -a claude-code

2Manually: put the files in place

~/.claude/skills/145-java-refactoring-high-performance/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/145-java-refactoring-high-performance/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about 145-java-refactoring-high-performance

How do I install the 145-java-refactoring-high-performance skill in Claude Code?

Run npx skills add jabrena/plinth --skill 145-java-refactoring-high-performance -a claude-code, then open ~/.claude/skills/145-java-refactoring-high-performance/SKILL.md.

What does this skill do?

It guides Java code refactoring for performance: reducing memory allocations, optimizing CPU hot paths, and improving syntax and control flow. It works by analyzing profiling data and applying techniques from three reference modules with before/after examples.

When should I use this skill?

Use it when improving Java application performance and you already have profiling data (JFR, async-profiler, or similar) showing the bottleneck. The skill requires baseline measurements and applies only evidence-backed optimizations.

Source text

SKILL.md · Apache-2.0
---
name: 145-java-refactoring-high-performance
description: Use when you need to refactor Java code for high performance — including memory/allocation reduction, CPU hot-path optimization, and syntax/API/control-flow improvements. This should trigger for requests such as Review Java code for high performance; Optimize Java hot path; Reduce Java allocations; Improve Java latency/throughput. Part of Plinth Toolkit
license: Apache-2.0
metadata:
  author: Juan Antonio Breña Moral
  version: 0.19.0
---
# Java rules for High Performance

Identify and apply practical Java high-performance techniques using a measure-first approach, with emphasis on allocation reduction, data layout, concurrency discipline, and evidence-based validation.

**What is covered in this Skill?**

- Measure-first workflow for Java code optimization
- JVM/runtime-aware coding guidance
- Allocation reduction techniques with bad/good patterns
- CPU hot-path simplification and loop-level efficiency patterns
- Concurrency/backpressure and timeout/cancellation discipline
- I/O, parsing, and serialization efficiency patterns
- Persistence/query and caching strategy guidance
- Java-centric decision workflow: keep/revert based on measured impact

**Scope:** Practical optimization in application code and APIs. Apply only where profiling indicates real bottlenecks.

## Constraints

Performance optimization must be evidence-driven and safe, focused on Java code changes that preserve correctness and maintainability.

- **MEASURE-FIRST**: Establish baseline behavior and identify Java code hot paths before optimization
- **NO PREMATURE OPTIMIZATION**: Only optimize code paths identified by profiling evidence
- **BEFORE APPLYING**: Read the relevant reference(s) for bad/good examples and measurement workflow
- **EDGE CASE**: If hotspot evidence is unclear, ask clarifying questions before changing code

## When to use this skill

- Review Java code for high performance
- Optimize Java hot path
- Reduce Java allocations
- Improve Java latency
- Improve Java throughput

## Workflow

1. **Identify Java hotspot and baseline behavior**

Confirm the performance-sensitive Java path and baseline behavior before changing code.

2. **Select the relevant reference(s) by bottleneck**

Pick and read only the reference(s) matching the observed hotspot: `references/145-refactoring-high-performance-java-memory-allocation.md` for allocation pressure, primitives vs. wrappers, escape analysis, collection sizing, data layout, and deduplication; `references/145-refactoring-high-performance-java-cpu.md` for CPU-bound hot paths, bit-level parsing, branchless arithmetic, loop unrolling, Unsafe caution, and SIMD/vectorization; `references/145-refactoring-high-performance-java-code-syntax.md` for code shape, lambdas, API return conventions, parsing syntax, I/O strategy, concurrency, and control-flow improvements.

3. **Apply targeted optimizations**

Implement minimal, evidence-backed changes scoped to the chosen domain(s): memory/allocation, CPU/low-level, or code shape/control flow (and adjacent concurrency, I/O, and persistence/caching in Java code).

4. **Validate and compare code-level outcomes**

Compare before/after behavior and keep only Java code changes with meaningful, verified gains.

## Reference

For detailed guidance, examples, and constraints, see:

- [references/145-refactoring-high-performance-java-memory-allocation.md](references/145-refactoring-high-performance-java-memory-allocation.md)
- [references/145-refactoring-high-performance-java-cpu.md](references/145-refactoring-high-performance-java-cpu.md)
- [references/145-refactoring-high-performance-java-code-syntax.md](references/145-refactoring-high-performance-java-code-syntax.md)

© Juan Antonio Breña Moral · Apache-2.0 · jabrena/plinth

Similar skills

All skills for Code review and refactoring →

From the same set123

The whole set →
701-technologies-openapi 701-technologies-openapi guides you through an OpenAPI 3.x contract: spec structure, reusable schemas, security schemes, breaking-change checks. Useful when the contract lives apart from the code. CX Codex +1 331installs 042-planning-openspec 042-planning-openspec turns an issue, plan or ADR into OpenSpec proposal, design, spec and task artifacts. Handy when the requirements exist but the reviewable changes do not. CX Codex +1 330installs 423-frameworks-quarkus-testing-acceptance-tests Build Quarkus acceptance tests from Gherkin scenario facts reviewed and sanitized by a maintainer. Useful when a test needs to exercise the HTTP layer alongside its supporting infrastructure. CX Codex +1 330installs 304-frameworks-spring-boot-security 304-frameworks-spring-boot-security configures Spring Boot security, endpoint authorization, and SecurityFilterChain. It helps implement JWT resource servers, method security, and safe headers. CX Codex +1 328installs 303-frameworks-spring-boot-validation 303-frameworks-spring-boot-validation — a skill that tells your coding agent how to design and review Spring Boot validation: Bean Validation on DTOs, @Valid at API boundaries, constraint groups and consistent 400 responses. CX Codex +1 327installs 181-java-observability-logging 181-java-observability-logging is a Claude Code skill for improving Java logging and observability. It activates on requests to add, review, or refactor logging. CX Codex +1 325installs 521-frameworks-micronaut-testing-unit-tests 521-frameworks-micronaut-testing-unit-tests enforces unit testing standards for Micronaut apps: prefers fast Mockito tests without context boots and reserves @MicronautTest for HTTP or @MockBean setups. CX Codex +1 324installs 501-frameworks-micronaut-core 501-frameworks-micronaut-core — a skill that reviews and fixes Micronaut Java code: beans, configuration, @Requires, scheduling and blocking I/O. CX Codex +1 323installs

Project sponsors

Companies that keep this analytics open