/rust-skills:rust-lombok-macrosfrom rust-skills
Generates Rust getters, setters, constructors, and Debug implementations via lombok-macros derives. Use for DTOs and data carriers; avoid for domain entities requiring validation.
Ships in rust-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Treat lombok-macros as a procedural-macro dependency and API generator, not as a complete Rust equivalent of Java Lombok. Confirm every generated method's signature, visibility, failure behavior, and compatibility boundary before removing boilerplate.
Use this skill for:
Getter, GetterMut, Setter, Data, or New;CustomDebug;Do not generate methods blindly for:
Option or Result access paths that must preserve absence or error information;2.0.32 does not provide these capabilities.Route dependency versions, features, and supply-chain policy to rust-cargo-build; general procedural-macro implementation to rust-macros; API and security review to rust-code-review; and broader test design to rust-testing.
Inspect the project instead of assuming a version:
rustc --version --verbose
cargo metadata --format-version 1
cargo tree -i lombok-macros -e features
Check Cargo.toml, Cargo.lock, the edition, rust-version, and supported targets. Version 2.0.32 uses Edition 2024 and does not declare a Rust version, so compile it on the project's actual MSRV. Do not infer the selected version only from the current crates.io page or a GitHub release badge.
When adding the dependency, use cargo add lombok-macros or an explicit reviewed version such as cargo add [email protected]. Never copy lombok-macros = "latest" into Cargo.toml; Cargo dependencies use semantic version requirements, not a latest keyword.
Do not assume that a blog post, generated answer, or older snippet matches the locked crate. In particular, 2.0.32 does not export a Lombok derive. Rewrite examples such as #[derive(Lombok, Debug, Clone)] with the smallest current derives, for example #[derive(Getter, Setter, Debug, Clone)], or use Data only when mutable getters are also intended.
Keep capability ownership explicit:
Debug and Clone are standard-library derives, not features generated by lombok-macros.CustomDebug is the crate-provided alternative when selected fields must be skipped.DisplayDebug and DisplayDebugFormat implement Display from an existing Debug representation; they do not make Debug output a stable presentation format.Record each field's existing method signature, visibility, ownership behavior, validation, side effects, errors, and callers. Replace a method only when the generated interface is equivalent or the contract change has been accepted.
Select the smallest derive:
| Requirement | Derive | Default risk |
|---|---|---|
| Read-only access | Getter | Default Option and Result getters unwrap and return the inner value |
| Mutable borrowing | GetterMut | Callers can bypass field invariants |
| Direct replacement | Setter | Setters do not validate and add write access |
| All three accessor types | Data | The API surface is often wider than necessary |
| All-field construction | New | The constructor is public by default; skipped fields use Default |
| Redacted debug output | CustomDebug | New sensitive fields still require explicit review |
| Debug reused as Display | DisplayDebug* | Structural output leaks easily and is not a stable user contract |
Write attributes against the locked version's source and documentation. For 2.0.32:
use lombok_macros::{CustomDebug, Getter, New, Setter};
#[derive(Getter, Setter, New, CustomDebug)]
#[new(pub(crate))]
struct WorkerConfig {
#[get(pub)]
#[set(pub, type(Into<String>))]
name: String,
#[get(pub, type(copy))]
#[set(pub)]
workers: usize,
#[debug(skip)]
#[new(skip)]
token: String,
}
&T for expensive values unless callers require ownership.type(clone) only when cloning is part of the API contract.type(copy) when value semantics are required for a Copy field.#[get(pub, clone)] shorthand shown in part of the documentation; the 2.0.32 parser requires type(clone).type(Into<T>) or type(AsRef<T>) for setter conversion, then compile the exact target type.Read Macro Reference for the complete derive and attribute matrix.
new or try_new functions when construction validates state.Setter or GetterMut for those fields.Option and Result, write explicit as_ref, as_deref, or container-returning methods. Reject default getters and type(deref) when they introduce panic paths.#[debug(skip)], then test formatted output. Review every new field later.Display manually for CLI, user-facing error, or protocol output. Restrict DisplayDebug to internal diagnostics.Read Adoption and Review when replacing existing methods or reviewing a pull request.
Add tests that call generated methods instead of only checking that the derive compiles:
cargo fmt --all --check
cargo check --workspace --all-targets --all-features
cargo test --workspace --all-targets --all-features
cargo clippy --workspace --all-targets --all-features -- -D warnings
Cover method visibility, return types, setter chaining, constructor argument order, new(skip) defaults, Debug redaction, and the continued enforcement of handwritten invariants. Rerun these contract tests after dependency upgrades. Use cargo expand for manual inspection when useful, but do not make a nightly-only tool the sole quality gate.
Data.examples/golden-lombok/: a compilable contract example locked to 2.0.32.latest URL during implementation.If prose, rustdoc examples, and behavior disagree, treat the source included in the selected crates.io package as authoritative for generated code, reproduce the behavior in a minimal compile test, and document the discrepancy. Never silently substitute GitHub master behavior for the version in Cargo.lock.
This skill does not collect, store, or transmit user data. Dependency changes may access a registry. Confirm authorization before accessing a private registry, changing credentials, or publishing a crate.
agents/openai.yaml (opens in a new tab)examples/examples.md (opens in a new tab)examples/golden-lombok/Cargo.lock (opens in a new tab)examples/golden-lombok/Cargo.toml (opens in a new tab)examples/golden-lombok/src/lib.rs (opens in a new tab)references/adoption-and-review.md (opens in a new tab)references/macro-reference.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (full-stack-skills/rust-skills) — no native marketplace selected
npx claudepluginhub p/full-stack-skills-rust-skills29 skills in this plugin
/rust-api-designDesign Rust library APIs that follow the Rust API Guidelines — naming (C-CASE, C-CONV, C-GETTER), interop traits (C-COMMON-TRAITS, C-CONVERT, C-ITER, C-SERDE), predictability (C-INTUITIVE, C-CONST), flexibility (C-GENERIC, C-NEWTYPE, C-EXT), type safety (C-BOOL, C-NONZERO, C-WRAPPER, C-STR), dependability (C-PANIC, C-UNWRAP), debuggability (C-DEBUG), and future-proofing (C-SEALED, C-STRUCT-FIELD, C-NON-EXHAUSTIVE). Use when users design a public crate API, choose between generics/concrete/newtype, decide trait bounds, hide implementation, avoid breakage, or ask "what is idiomatic Rust API design"; hand semver and publish workflow to rust-semver, lint config to rust-style-clippy, and in-crate layout to rust-module-layout./rust-by-exampleShow Rust patterns through short compilable examples — type conversions (From/Into/TryFrom/as/Deref), flow control (if let/while let/match/loop), functions and closures (Fn/FnMut/FnOnce, captures), modules (mod/use/pub/super/self), generics and traits (bounds/associated types/trait objects), error handling (?/Result/thiserror/anyhow), attributes (derive/cfg/inline/allow), unsafe (raw pointers/unions/ABI), procedural macros (derive/attribute/function-like), and inline asm. Use when users ask "how do I write X in Rust", need a concrete pattern with copy-pasteable code, or are migrating from Java/Python/Go/C++ and want the Rust equivalent; hand architecture decisions to rust-api-design/rust-workspace, std API selection to rust-stdlib, and async runtime to rust-concurrency.Other plugins' skills for the same job