← ClaudeAtlas

java-patternslisted

Chooses and implements a design pattern in Java/Spring from the symptom that justifies it. Use when the request involves a design pattern, Strategy, Factory, Decorator, Builder, Specification, "how to structure this class", a growing if/switch chain, or refactoring a class with too many responsibilities.
ice-lfernandes/claude-spring-architect · ★ 3 · AI & Automation · score 79
Install: claude install-skill ice-lfernandes/claude-spring-architect
# Java Patterns A pattern is not a rule. A rule says *always*; a pattern says *when*. That's why this is a skill and not `rules/` — it only costs context when invoked. **Entry rule: no pattern without an observed symptom in the code.** Applying a pattern preemptively is overengineering — a Factory for two lines, a Strategy for a single `if`, an interface with one implementation that will never have a second. If you can't point to the file and line that hurts, the answer is "apply no pattern at all". ## Procedure 1. Name the symptom in the actual code (`file:line`), not in the abstract. 2. Look up the symptom in the table. No matching row, stop — write simple code. 3. Confirm the pattern doesn't collide with the active blueprint's `packages.map`. 4. Generate from the exemplar in `templates/`, with the names from `@.claude/rules/naming.md`. Size limits: `@.claude/rules/code-quality.md`. 5. Record it in an ADR if the pattern changes the shape of an entire module. ## Catalog | Symptom in code | Pattern | When **not** | |---|---|---| | `switch`/`if-else` over a type or enum, repeated in ≥ 2 places, growing with each new rule | Strategy | Two stable branches that have never grown | | Construction with invariants, many steps, or possible invalid combinations | Static factory (`of`, `from`) | A record with validation in the compact constructor is already enough | | ≥ 4 optional constructor parameters | Builder | Record + `with*`; Lombok `@Builder` on a domain object hides in