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.
$ npx -y skills add vanara-agents/skills --agent claude-codeHow 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.mdCode 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
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.
🐒 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.
Repo: vanara-agents/skills
Other agents on vanara-agents-skills.
- AGENT
Use when designing a new HTTP/GraphQL API or changing an existing one — modeling resources, defining endpoint contracts, choosing status codes, pagination, filtering, error envelopes, versioning, and idempotency. Produces a reviewable API contract plus an OpenAPI snippet, not
Open agent - review-notes
This shows how the api-designer agent reviews a flawed draft. Findings are severity-ranked so the implementer fixes the contract-breakers first. Severity legend: **CRITICAL** (breaks clients / data risk), **HIGH** (real bug or inconsistency), **MEDIUM** (maintainability),
Open agent - contract-and-openapi
The contract is the deliverable. Express it as an **OpenAPI 3.1** document so it is human-readable *and* machine-checkable. This reference covers how to structure that document and what `scripts/lint-openapi.mjs` enforces.
Open agent - design-checklist
Run through this before declaring an API contract done. It is ordered the way you should *design*: resources first, cross-cutting rules last. Every box is a place real APIs go wrong in production.
Open agent - versioning-and-evolution
APIs are forever once published: a consumer you've never met may depend on any field you expose. Design so you can **add without breaking**, and version explicitly when you must break.
Open agent - pr-comment-template
Copy-paste templates for leaving review comments. Keep each comment to one finding: an anchor, the problem, and the fix.
Open agent

