Duplicate Code Detector
When to Trigger
- •Code similarity >70%
- •Copy-paste detected
- •Similar patterns in multiple places
What to Do
- •Find: Functions or blocks that differ only by a few values (e.g. status, filter).
- •Refactor: Single function with parameters (e.g. getBookingsByStatus(status)) or generic helper with options object.
- •Reuse: Extract to shared util, hook, or service; call from original call sites.
- •Types: Use shared types/interfaces so refactor stays type-safe.
Prefer small, focused helpers over large generic functions. Preserve behavior and add/run tests if touching critical paths.