
Techdebt Finder
- 9 installs
- 35 repo stars
- Updated April 29, 2026
- spences10/claude-code-toolkit
Helps with ai & agent building tasks.
About
techdebt-finder is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- techdebt-finder
- AI & Agent Building
- AI-coding skill
Techdebt Finder by the numbers
- 9 all-time installs (skills.sh)
- Ranked #12,152 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/spences10/claude-code-toolkit --skill techdebt-finderAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 9 |
|---|---|
| repo stars | ★ 35 |
| Last updated | April 29, 2026 |
| Repository | spences10/claude-code-toolkit ↗ |
What it does
Helps with ai & agent building tasks.
Files
Tech Debt Finder
Identify duplicated code, inconsistent patterns, and refactoring opportunities.
When to Use
- "Find duplicate code"
- "What needs refactoring?"
- "Are there inconsistent patterns?"
- Code review prep
- Pre-refactor analysis
Detection Process
1. Scan - Grep for common debt indicators 2. Cluster - Group similar issues 3. Prioritize - Rank by frequency × impact 4. Report - Show findings with locations
Quick Patterns
| Debt Type | Detection Method |
|---|---|
| Duplicated code | Hash-compare function bodies |
| Similar-but-diff | Fuzzy match on structure |
| Inconsistent naming | Regex for mixed conventions |
| Dead code | Unreferenced exports/functions |
| TODO/FIXME | Grep for comment markers |
| Magic numbers | Literals outside const/config |
| Long functions | Line count > threshold |
| Deep nesting | Indentation level analysis |
Output Format
## Technical Debt Report
### High Priority (fix soon)
- [DUPLICATE] src/utils/format.ts:23 ↔ src/helpers/fmt.ts:45
Similar: 87% | Impact: High (called 12 places)
### Medium Priority (plan for)
- [INCONSISTENT] Mixed naming: getUserData vs fetch_user
Files: api.ts, service.ts, handler.ts
### Low Priority (track)
- [TODO] 23 TODO comments, oldest: 2023-01-15References
- detection-patterns.md - Pattern matching rules
- prioritization.md - Scoring and ranking
- refactoring-strategies.md - Fix suggestions
Detection Patterns
Rules for identifying technical debt in codebases.
Code Duplication
Exact Duplicates
Find identical code blocks:
# Find functions with identical bodies (simplified)
grep -rn "function\|const.*=.*=>" --include="*.ts" | sort | uniq -dStructural Similarity
Compare AST-like patterns:
| Similarity | Classification | Action |
|---|---|---|
| 95-100% | Exact duplicate | Extract shared |
| 80-94% | Near duplicate | Parameterize |
| 60-79% | Similar pattern | Consider DRY |
| <60% | Different | Ignore |
Duplication Indicators
- Same function name in multiple files
- Identical import blocks
- Copy-pasted error handling
- Repeated validation logic
- Similar API call patternsInconsistency Detection
Naming Conventions
| Pattern | Regex | Issue |
|---|---|---|
| Mixed case | get_user.*getUser | snake vs camel |
| Prefix inconsist | handleX.*onX.*processX | Handler naming |
| Bool naming | isX.*hasX.*shouldX.*canX | Boolean prefix |
Pattern Variations
Find same concept, different implementation:
- Multiple date formatting approaches
- Different error handling styles
- Varied logging patterns
- Inconsistent null checksDead Code Detection
Unreferenced Exports
# Find exports not imported elsewhere
grep -rh "export.*function\|export.*const" --include="*.ts" | \
while read exp; do
name=$(echo "$exp" | grep -oP '(?<=function |const )\w+')
count=$(grep -r "$name" --include="*.ts" | wc -l)
[ "$count" -eq 1 ] && echo "Unused: $name"
doneIndicators
- Functions with no callers
- Commented-out code blocks
- Unused imports
- Unreachable branches
Code Smell Markers
Comment-Based
| Marker | Meaning | Priority |
|---|---|---|
| TODO | Planned work | Track |
| FIXME | Known bug | High |
| HACK | Temporary workaround | Medium |
| XXX | Needs attention | Medium |
| @ts-ignore | Type workaround | Review |
Structural
| Smell | Detection |
|---|---|
| Long function | >50 lines |
| Deep nesting | >4 indent levels |
| Many parameters | >5 function params |
| God object | Class with >20 methods |
| Feature envy | Excessive external calls |
Magic Values
Detection
# Find hardcoded numbers (excluding 0, 1, common ports)
grep -rn "[^0-9][2-9][0-9]\{2,\}[^0-9]" --include="*.ts" | \
grep -v "const\|port\|status"Common Offenders
- Timeouts (3000, 5000, 30000)
- Array indices beyond 0/1
- Status codes inline
- Retry counts
- Buffer sizes
File-Level Patterns
Large Files
# Files over 500 lines
find . -name "*.ts" -exec wc -l {} \; | awk '$1 > 500'High Churn Files
# Most frequently modified (git)
git log --pretty=format: --name-only | sort | uniq -c | sort -rn | head -20High churn + high complexity = refactor priority.
Prioritization
Scoring and ranking technical debt for action.
Priority Matrix
| Impact | Frequency | Priority | Action |
|---|---|---|---|
| High | High | Critical | Fix now |
| High | Low | High | Plan sprint |
| Low | High | Medium | Batch fix |
| Low | Low | Low | Track only |
Impact Scoring
Change Risk
| Factor | Score | Rationale |
|---|---|---|
| Core business logic | +3 | Bugs = revenue loss |
| API surface | +2 | Breaking changes |
| Internal util | +1 | Contained blast radius |
| Test code | +0 | No prod impact |
Coupling
| Factor | Score | Rationale |
|---|---|---|
| >10 dependents | +3 | High ripple effect |
| 5-10 dependents | +2 | Moderate coordination |
| 1-4 dependents | +1 | Limited scope |
| 0 dependents | +0 | Safe to change |
Complexity
| Factor | Score | Rationale |
|---|---|---|
| Cyclomatic >20 | +3 | Hard to reason about |
| Cyclomatic 10-20 | +2 | Needs focus |
| Cyclomatic 5-10 | +1 | Manageable |
| Cyclomatic <5 | +0 | Simple |
Frequency Scoring
Code Churn
# Commits touching file in last 6 months
git log --since="6 months ago" --oneline -- path/to/file | wc -l| Commits | Score | Classification |
|---|---|---|
| >20 | +3 | Hot spot |
| 10-20 | +2 | Actively changed |
| 5-10 | +1 | Occasionally |
| <5 | +0 | Stable |
Usage Frequency
| Factor | Score | Rationale |
|---|---|---|
| Called per request | +3 | Every user hits this |
| Daily feature | +2 | Regular use |
| Weekly feature | +1 | Occasional use |
| Rare/admin only | +0 | Low exposure |
Composite Score
Priority = (Impact × 2) + Frequency + Urgency Modifier
Urgency Modifiers:
+5 Security vulnerability
+3 Causes prod errors
+2 Blocks feature work
+1 Developer frictionPriority Buckets
Critical (Score 12+)
- Address in current sprint
- May warrant hotfix
- Examples: security issues, data corruption risks
High (Score 8-11)
- Plan for next sprint
- Track in backlog with deadline
- Examples: performance bottlenecks, major duplication
Medium (Score 4-7)
- Address opportunistically
- Bundle with related work
- Examples: naming inconsistencies, minor duplication
Low (Score 0-3)
- Track but don't prioritize
- Fix if touching area anyway
- Examples: old TODOs, style inconsistencies
Batch Grouping
Group related debt for efficient fixing:
Group by:
1. Same file/module
2. Same pattern type
3. Same fix approach
4. Same reviewer neededExample Batch
Batch: "Standardize error handling"
Files: api.ts, service.ts, handler.ts
Pattern: Inconsistent try/catch
Effort: 2 hours
Impact: Medium (Score 6)
→ Fix together in single PRReporting Template
## Tech Debt Summary
**Total Items**: 47
**Critical**: 2 | **High**: 8 | **Medium**: 22 | **Low**: 15
### Top 5 Priority Items
| Rank | Issue | Score | Location | Est. Effort |
| ---- | ----------------------- | ----- | ----------------- | ----------- |
| 1 | SQL injection risk | 15 | api/query.ts:45 | 1h |
| 2 | 6x duplicate validation | 12 | src/validators/\* | 3h |
| ... | ... | ... | ... | ... |
### Recommended Batches
1. **Error handling** (3 files, 2h) - Score 8
2. **Naming cleanup** (12 files, 1h) - Score 5Refactoring Strategies
Fix patterns for common technical debt types.
Duplication Fixes
Extract Shared Function
Before:
// file1.ts
function processUserA(user) {
validate(user);
normalize(user.name);
save(user);
}
// file2.ts
function processUserB(user) {
validate(user);
normalize(user.name);
save(user);
}After:
// shared/user-processing.ts
export function processUser(user) {
validate(user);
normalize(user.name);
save(user);
}Parameterize Variations
When duplicates differ slightly:
// Before: 3 similar functions
function fetchUsers() {
return fetch("/users");
}
function fetchPosts() {
return fetch("/posts");
}
function fetchComments() {
return fetch("/comments");
}
// After: one parameterized
function fetchResource(type: "users" | "posts" | "comments") {
return fetch(`/${type}`);
}Template Method
For process variations:
abstract class DataProcessor {
process(data) {
this.validate(data); // shared
this.transform(data); // varies
this.save(data); // shared
}
abstract transform(data); // subclass implements
}Inconsistency Fixes
Naming Standardization
1. Choose convention (document in style guide) 2. Find all variants: grep -rn "getUserData\|fetch_user\|loadUser" 3. Pick canonical name 4. Global rename (IDE or sed) 5. Update imports
Pattern Consolidation
// Before: mixed error handling
try {
} catch (e) {
console.log(e);
}
try {
} catch (e) {
throw new Error(e);
}
try {
} catch (e) {
return null;
}
// After: consistent approach
try {
} catch (e) {
logger.error(e);
throw new AppError(e.message, { cause: e });
}Dead Code Removal
Safe Deletion Process
1. Verify unused: Search all references 2. Check dynamic usage: Grep for string references 3. Review git history: Why was it added? 4. Delete in stages: Comment first, delete next sprint 5. Monitor: Watch for errors post-deploy
Unused Export Pattern
# Find export, count usages
export_name="unusedHelper"
usages=$(grep -r "$export_name" --include="*.ts" | wc -l)
# If usages == 1 (just the export), safe to removeLong Function Fixes
Extract Method
// Before: 80-line function
function processOrder(order) {
// 20 lines: validate
// 30 lines: calculate
// 30 lines: persist
}
// After: composed
function processOrder(order) {
validateOrder(order);
const totals = calculateTotals(order);
persistOrder(order, totals);
}Extract Class
When function has too many responsibilities:
// Before: function with 10 helpers
function handlePayment(payment) { ... }
function validateCard() { ... }
function checkFraud() { ... }
// ...
// After: cohesive class
class PaymentProcessor {
handle(payment) { ... }
private validateCard() { ... }
private checkFraud() { ... }
}Magic Number Fixes
// Before
if (retries > 3) { ... }
setTimeout(fn, 30000);
// After
const MAX_RETRIES = 3;
const TIMEOUT_MS = 30_000;
if (retries > MAX_RETRIES) { ... }
setTimeout(fn, TIMEOUT_MS);Config Extraction
// config/limits.ts
export const LIMITS = {
maxRetries: 3,
timeoutMs: 30_000,
maxFileSize: 10_485_760,
} as const;Deep Nesting Fixes
Early Return
// Before
function process(x) {
if (x) {
if (x.valid) {
if (x.ready) {
return doWork(x);
}
}
}
return null;
}
// After
function process(x) {
if (!x) return null;
if (!x.valid) return null;
if (!x.ready) return null;
return doWork(x);
}Extract Conditions
// Before
if (user.role === 'admin' && user.active && !user.suspended) { ... }
// After
const canAccess = user.role === 'admin' && user.active && !user.suspended;
if (canAccess) { ... }
// Or
function canAccess(user) {
return user.role === 'admin' && user.active && !user.suspended;
}Safe Refactoring Checklist
Before refactoring:
- [ ] Tests exist for affected code
- [ ] Understand all callers
- [ ] Check for reflection/dynamic usage
- [ ] Plan rollback strategy
During:
- [ ] Small commits (one change per commit)
- [ ] Run tests after each step
- [ ] Keep behavior identical (no features)
After:
- [ ] All tests pass
- [ ] Review for missed references
- [ ] Update documentation if needed
- [ ] Monitor prod for regressions