lombok-patterns

Generate getters, setters, builders, and common methods with Lombok annotations.

Updated Feb 27, 2026
One-click install
npx skills add https://github.com/cooker/wx-apartment-ledger --skill lombok-patterns-cooker
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lombok-patterns
Source: https://github.com/cooker/wx-apartment-ledger/tree/main/.agents/skills/lombok-patterns
Command: npx skills add https://github.com/cooker/wx-apartment-ledger --skill lombok-patterns-cooker

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Lombok annotations and best practices for Java projects help reduce boilerplate by generating common code at compile time, enabling developers to focus on business logic and design.

Core Features & Use Cases

  • Generate getters, setters, toString, equals, and hashCode automatically with @Data, @Getter, @Setter, and @EqualsAndHashCode
  • Build robust object construction with @Builder, @Value, and @With for immutable patterns
  • Improve entity and DTO design in Spring/JPA apps while balancing Java Records when appropriate

Quick Start

Install Lombok in your project and annotate a class with @Getter, @Setter, and @Builder to generate boilerplate automatically.

Frequently Asked Questions about lombok-patterns

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

FAQPage Schema
How do I reduce boilerplate code in Java using Lombok annotations?

Reduce Java boilerplate by applying Lombok annotations like @Getter, @Setter, and @Data to auto-generate standard methods at compile time. This eliminates repetitive code for getters, setters, toString, equals, and hashCode, letting you focus on business logic.

What is the best way to create immutable objects in Java with Lombok?

Create immutable objects in Java using Lombok annotations like @Value, @With, and @Builder. These annotations automatically generate immutable construction patterns and safe object modification methods, ensuring robust domain modeling without manual boilerplate.

Should I use Lombok or Java Records for DTOs in Spring Boot?

For simple DTOs in Spring Boot, prefer Java Records for native immutability and simplicity. Use Lombok @Data or @Builder for complex domain models and entities requiring mutable fields, inheritance, or flexible construction patterns.

Does Lombok work with Java 21 and Spring Boot JPA entities?

Lombok works with Java 21 and Spring Boot JPA entities to generate getters, setters, and equals methods. It is compatible with Java 21+ and effectively optimizes entity design and DTO creation while considering modern Java features.

When should I avoid using @Data in my Java domain models?

Avoid using Lombok @Data in Java domain models when you need strict immutability or when dealing with JPA entities, as it generates mutable setters and can cause equals/hashCode issues with lazy-loaded relationships. Prefer @Value or @Getter/@Setter.

How do I build complex Java objects without writing long constructors?

Build complex Java objects without long constructors by applying the Lombok @Builder annotation. It auto-generates a fluent builder API, allowing flexible and readable object construction while eliminating boilerplate code.