From refactor
Apply Change Reference to Value when you see Mutable Data. An object treated as a sharable record (with setters) becomes a value object — immutable, equal by content, replaced rather than mutated.
How this skill is triggered — by the user, by Claude, or both
Slash command
/refactor:change-reference-to-valueThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Target state:** An object treated as a sharable record (with setters) becomes a value object — immutable, equal by content, replaced rather than mutated.
Target state: An object treated as a sharable record (with setters) becomes a value object — immutable, equal by content, replaced rather than mutated.
Why apply it: Concurrency hazards disappear; the type system can mark fields readonly; the object can travel safely across boundaries.
Pitfall: Comparison semantics shift from identity to equality — every call site that depended on === or identity caches needs review.
// Avoid:
class Phone {
constructor() { this.area = null; this.number = null; }
}
phone.area = '617';
// Prefer:
class Phone {
constructor(area, number) { this._area = area; this._number = number; }
area() { return this._area; }
number() { return this._number; }
withArea(area) { return new Phone(area, this._number); }
}
Removes smells: Mutable Data
npx claudepluginhub wallacedrew/ritl --plugin refactorGuides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.