skills/lenses/smells.md
dan fb15000877 refactor: restructure for cross-repo deployment
- Rename reviews/ to lenses/ (clearer terminology)
- Add workflows/ for beads proto templates
- Extract code-review proto to workflows/molecules.jsonl
- Update ai-skills.nix module:
  - Add enableLenses option (deploys to ~/.config/lenses/)
  - Add enableWorkflows option (deploys to ~/.beads/molecules.jsonl)
  - Derive repoRoot from skillsPath for sibling directories
- Update lens paths in proto to use deployed location

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:18:19 -05:00

1.6 KiB

Code Smells Review Lens

Review the provided code for code smells and readability issues.

What to Look For

Control Flow Smells

  • Deep nesting (if inside if inside if...)
  • Complex boolean expressions without named variables
  • Early returns that could simplify flow vs. arrow code
  • Switch/match statements that should be polymorphism or lookup tables

Data Smells

  • Primitive obsession (passing 5 strings instead of an object)
  • Data clumps (same group of variables passed together repeatedly)
  • Feature envy (function uses another module's data more than its own)
  • Mutable state where immutable would work

Naming & Clarity

  • Names that lie (function does more/less than name suggests)
  • Abbreviated names that obscure meaning
  • Generic names (data, info, result, tmp, val)
  • Inconsistent naming conventions within the file

Structure Smells

  • Comments that explain "what" instead of "why" (code should be self-documenting)
  • Dead parameters (passed but never used)
  • Flag arguments (boolean that changes function behavior)
  • Speculative generality (abstraction without current need)

Output Format

For each finding:

[SMELL] <severity:HIGH|MED|LOW> <file:line>
Smell: <name of the smell>
Issue: <what's wrong>
Suggest: <refactoring technique - extract method, rename, introduce parameter object, etc.>

Guidelines

  • Reference established refactoring patterns (Fowler's catalog) when applicable
  • Distinguish style preferences from genuine smells
  • Consider the language idioms (what's a smell in Java may be fine in Python)
  • HIGH = actively misleading or bug-prone, MED = maintainability drag, LOW = polish