[FEATURE] Automated duplicate detection & fixing
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Very often when Claude Code works on stuff, it reimplements already existing functionality or types. This is one of the most frustrating issues with the code quality on Claude Code.
Proposed Solution
Claude Code should have better context awareness and be able to automatically detect and fix duplicates. Claude should independently decide if the duplicate is warranted or not. This would help Claude code to be better aware of the code base and produce less slop.
Many IDEs already have duplicate detection, and some simple vector store & embedding implementation with semantic search could also be an option.
Alternative Solutions
_No response_
Priority
High - Significant impact on productivity
Feature Category
File operations
Use Case Example
- Let Claude Code write code
- It writers
type User = {id: number, name: string} - It should detect that in another file we already have a centralized
type User = {id: number, name: string}or maybe something close enough such astype User = {id: number, name: string, email: string} - It should make a decision to consolidate
Additional Context
This tends to happen all the time with types, zod schemas & utility functions etc etc.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗