.claude/skills/tech-debt-check/SKILL.md
Identify code duplication, cyclomatic complexity, large files, and maintainability anti-patterns. Use at phase checkpoints or on-demand to quantify technical debt.
npx skillsauth add benjaminshoemaker/ai_coding_project_base tech-debt-checkInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze the codebase for technical debt patterns that commonly accumulate during AI-assisted development.
Research shows AI-generated code creates:
This skill catches these issues before they compound.
Copy this checklist and track progress:
Tech Debt Check Progress:
- [ ] Step 1: Detect project type
- [ ] Step 2: Run duplication analysis
- [ ] Step 3: Run complexity analysis
- [ ] Step 4: Run file size analysis
- [ ] Step 5: Check for AI code smells
- [ ] Step 6: Generate report
| Category | Metric | Good | Warning | Critical | |----------|--------|------|---------|----------| | Duplication | Duplicate % | <3% | 3-7% | >7% | | | Duplicate blocks | <5 | 5-15 | >15 | | | Lines per block | <10 | 10-20 | >20 | | Complexity | Avg complexity | <5 | 5-10 | >10 | | | Max complexity | <15 | 15-25 | >25 | | | Functions >10 | 0 | 1-3 | >3 | | File Size | Max file lines | <300 | 300-500 | >500 | | | Avg file lines | <150 | 150-250 | >250 | | | Files >300 lines | 0 | 1-3 | >3 |
Identify the project's primary language and available tooling:
| File | Language | Tools Available |
|------|----------|-----------------|
| package.json | JavaScript/TypeScript | jscpd, eslint |
| requirements.txt / pyproject.toml | Python | pylint, radon, flake8 |
| Cargo.toml | Rust | cargo clippy |
| go.mod | Go | staticcheck |
If no package manager found, fall back to file extension analysis.
Check for duplicate code blocks (a primary AI coding failure mode).
# Install if needed
npm list -g jscpd || npm install -g jscpd
# Run analysis
jscpd src/ --min-lines 5 --min-tokens 50 --reporters json --output .tech-debt-report/
Parse output for total duplicate lines, percentage, and specific blocks (file, start line, end line).
If jscpd unavailable, use grep-based pattern matching for repeated code blocks.
Use eslint with complexity rules:
npx eslint src/ --rule '{"complexity": ["error", 10]}' --format json
Or check manually for:
Use radon for cyclomatic complexity:
radon cc src/ -a -s --json
Or use pylint:
pylint src/ --disable=all --enable=R0912,R0915 --output-format=json
Large files often indicate poor separation of concerns. Find files exceeding thresholds:
find src/ -name "*.ts" -o -name "*.js" -o -name "*.py" | xargs wc -l | sort -rn | head -20
Check for patterns commonly produced by AI:
# Check try-catch density (ratio > 1:1 suggests over-defensive code)
echo "try blocks: $(grep -r 'try {' src/ | wc -l)"
echo "catch blocks: $(grep -r 'catch' src/ | wc -l)"
# TypeScript/JavaScript
npx eslint src/ --rule '{"no-unused-vars": "error"}' --format json
# Python
pylint src/ --disable=all --enable=W0611,W0612 --output-format=json
Look for multiple implementations of the same concern (date formatting, HTTP clients, validation):
grep -r "new Date\|moment\|dayjs\|date-fns" src/ | cut -d: -f1 | sort | uniq -c
grep -r "fetch\|axios\|got\|request" src/ | cut -d: -f1 | sort | uniq -c
Healthy ratio is 10-20%. AI tends to over-comment or under-comment.
TECHNICAL DEBT REPORT
=====================
Project: {name}
Analyzed: {timestamp}
Files scanned: {N}
SUMMARY
-------
Overall Health: GOOD | WARNING | CRITICAL
Tech Debt Score: {0-100} (lower is better)
DUPLICATION ({status})
----------------------
Duplicate code: {N} blocks, {X}% of codebase
Largest duplicates:
1. {file1}:{lines} ↔ {file2}:{lines} ({N} lines)
2. {file1}:{lines} ↔ {file2}:{lines} ({N} lines)
Action: Consider extracting to shared utility
COMPLEXITY ({status})
---------------------
Average complexity: {N}
High complexity functions:
1. {file}:{function} — complexity {N}
2. {file}:{function} — complexity {N}
Action: Refactor functions with complexity >15
FILE SIZE ({status})
--------------------
Large files (>300 lines):
1. {file} — {N} lines
2. {file} — {N} lines
Action: Split into smaller, focused modules
AI CODE SMELLS ({status})
-------------------------
- Excessive try-catch: {found/not found}
- Unused code: {N} instances
- Inconsistent patterns: {list}
Action: Review flagged patterns for consolidation
RECOMMENDATIONS
---------------
Priority fixes:
1. {specific action with file reference}
2. {specific action with file reference}
3. {specific action with file reference}
Deferred items:
- {lower priority items}
When invoked from /phase-checkpoint:
| Result | Condition | |--------|-----------| | PASSED | All metrics in GOOD range | | PASSED WITH NOTES | Some WARNING, no CRITICAL | | FAILED | Any CRITICAL metric |
If multiple CRITICAL thresholds are exceeded:
If required tools are not installed:
npm install -g jscpd, pip install radon, etc.If codebase is too large for analysis:
git diff --name-only HEAD~10If analysis reveals overwhelming debt:
/add-todo for each deferred fixSee references/example-output.md for a full example of tech debt check output on a TypeScript project with WARNING status.
testing
Audit project alignment with VISION.md, identify SDLC gaps, and generate feature proposals. Use when reviewing strategic direction or planning new features.
development
Run code-verification on a specific task. Use to verify a single task's acceptance criteria after implementation.
testing
Resolve Vercel preview deployment URL for the current git branch. Invoked by browser-verification when deployment.enabled is true, or directly to check deployment status. Use to check deployment status or when browser verification needs a URL.
tools
Discover and sync all toolkit-using projects with the latest skills. Use when skills are modified, after the post-commit hook reminds you, or to batch-sync multiple projects.