Expert code refactoring for Java, JavaScript, and React projects. Focuses on SOLID principles, design patterns, and idiomatic improvements while ensuring test stability.
This skill guides the agent in refactoring codebases by identifying technical debt and applying industry-standard patterns tailored to the specific technology stack.
| Smell | Description | Refactoring Pattern |
|---|---|---|
| Magic Literals | Hardcoded numbers/strings. | Extract Constant or Enum. |
| Long Method | Method does too many things. | Extract Method. |
| Large Class | Too many responsibilities. | Extract Class or Extract Interface. |
| Feature Envy | Method uses another object's data more. | Move Method. |
| Primitive Obsession | Using primitives for domain concepts. | Introduce Value Object. |
| MultiβFile Change Requirement | One change affects many files. | Move Field or Inline Class to centralize. |
record (Java 14+), sealed classes (Java 17+), and Switch Pattern Matching.Stream. Use Optional to eliminate null checks.final and immutable collections (List.of, Map.of).Throwable or Exception generically.const by default, destructuring, spread/rest, arrow functions.Pick, Omit), and Custom Type Guards.Promise.all for concurrency; avoid "async-await" inside loops where possible.useMemo/useCallback for stable references. Avoid inline function definitions in props of memoized children.getByRole) via React Testing Library.