Skip to content

smell-catalog

A smell is a surface symptom that usually points to a deeper structural problem. Each entry names the smell, how to spot it, and the canonical behavior-preserving refactoring that addresses it. Apply one at a time, tests green between each.

From plugin
vanara-agents-skills
954 skills54 agents
Install
$ npx -y skills add vanara-agents/skills --agent claude-code

How it fires

How this agent gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.

Context preview

The summary Claude sees to decide when to auto-load this agent.

A smell is a surface symptom that usually points to a deeper structural problem. Each entry names the smell, how to spot it, and the canonical behavior-preserving refactoring that addresses it. Apply one at a time, tests green between each.

Agent definition

smell-catalog.md

Code Smell Catalogue

A smell is a surface symptom that usually points to a deeper structural problem. Each entry names the smell, how to spot it, and the canonical behavior-preserving refactoring that addresses it. Apply one at a time, tests green between each.

Bloaters

Long function

  • **Spot it:** more than ~20–50 lines, multiple levels of abstraction in one body, comments that

section it into "phases".

  • **Fix:** **Extract Function** for each phase; name each by *what* it does, not *how*.

Large class / module

  • **Spot it:** a file past ~800 lines doing several unrelated jobs.
  • **Fix:** **Extract Class / Extract Module** along responsibility lines; move related fields and the

methods that use them together.

Long parameter list

  • **Spot it:** four or more parameters, especially several passed as a group everywhere.
  • **Fix:** **Introduce Parameter Object** or **Preserve Whole Object**.

Primitive obsession

  • **Spot it:** raw strings/ints carrying domain meaning (a `string currency`, a `number cents`).
  • **Fix:** **Replace Primitive with Value Object**; centralize validation in the new type.

Conditional complexity

Deep nesting

  • **Spot it:** arrow-shaped code, 3+ nested `if`s, the happy path buried at the bottom.
  • **Fix:** **Replace Nested Conditional with Guard Clauses**; return/throw early, flatten the rest.

Switch / type-code dispatch

  • **Spot it:** the same `switch` on a type field repeated in several places.
  • **Fix:** **Replace Conditional with Polymorphism** (or a lookup table / strategy map).

Repeated boolean expressions

  • **Spot it:** the same compound condition spelled out multiple times.
  • **Fix:** **Extract Function** with an intention-revealing name (`isEligible(order)`).

Duplication

Duplicated code

  • **Spot it:** the same statements (or near-identical) in two or more places.
  • **Fix:** **Extract Function** and call it; if duplicated across classes, **Pull Up Method**.

Shotgun surgery

  • **Spot it:** one logical change forces edits in many scattered files.
  • **Fix:** **Move Method / Move Field** to gather the responsibility into one place.

Naming and clarity

Mysterious name

  • **Spot it:** `data2`, `tmp`, `doStuff`, single-letter non-loop variables.
  • **Fix:** **Rename** to reveal intent. Cheap, high value, almost always safe with tooling.

Comments compensating for unclear code

  • **Spot it:** a comment explaining *what* a block does.
  • **Fix:** **Extract Function** named after the comment, then delete the comment.

Coupling

Feature envy

  • **Spot it:** a method that reaches into another object's data more than its own.
  • **Fix:** **Move Method** to the class that owns the data.

Message chains / inappropriate intimacy

  • **Spot it:** `a.getB().getC().getD()`; objects knowing each other's internals.
  • **Fix:** **Hide Delegate**; expose intent-level methods instead of chains.

How to use this catalogue

1. Find the smell that matches what you see. 2. Confirm tests cover the code (add characterization tests if not). 3. Apply only the canonical fix, in small steps, re-running tests after each. 4. Stop when the targeted smell is gone — do not chase every smell in the file at once.

Read more
Ships withvanara-agents-skills

🐒 Free agents, skills & packs for Claude Code One subscription. An army of Claude Code agents. 30 production-grade agents, skills, and packs for Claude Code — free, Apache-2.0, install with one command.

Get the whole plugin, auto-invoked
Stats
9
Stars
0
Views
3
Forks
Active
Maintenance
JavaScript
Language
Apache-2.0
License
10d ago
Last commit
24d ago
Created

Repo: vanara-agents/skills

Other agents on vanara-agents-skills.