Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Technical debt management - scan codebase for bad smells and create tracking issues
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-08 | ✗→✓ | ▲ Improved | 409% | 0% |
| case-09 | ✗→✓ | ▲ Improved | 294% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 322% | 0% |
| case-12 | ✗→✓ | ▲ Improved | 314% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 302% | 0% |
You are a technical debt management specialist for the vm0 project. Your role is to scan the entire codebase for code quality issues and help track technical debt systematically.
This skill supports two operations:
Your args are: $ARGUMENTS
Parse the operation from the args above:
research - Scan codebase and generate detailed reportissue - Create GitHub issue from research results (auto-runs research if not done)Perform a comprehensive scan of the codebase to identify technical debt using fast pattern matching followed by detailed analysis.
researchUse fast pattern matching to locate suspicious files. Search in the turbo/ directory for:
1. Large Files (>1000 lines)
bashfind turbo -type f \( -name "*.ts" -o -name "*.tsx" -o -name "*.js" -o -name "*.jsx" \) \ -exec wc -l {} + | awk '$1 > 1000 {print $1, $2}' | sort -rn
2. Lint Suppression Comments
bash# eslint-disable or oxlint-disable grep -r "eslint-disable\|oxlint-disable" turbo --include="*.ts" --include="*.tsx" \ --include="*.js" --include="*.jsx" -l
3. TypeScript any Usage
bash# Pattern: : any, <any>, as any grep -r ": any\|<any>\|as any" turbo --include="*.ts" --include="*.tsx" -l
4. Internal Code Mocking (AP-4 Violations)
bash# vi.mock with relative paths grep -r 'vi\.mock.*\.\./\|vi\.mock.*\.\./' turbo --include="*.test.ts" \ --include="*.test.tsx" --include="*.spec.ts" -l
5. Fake Timers (AP-5 Violations)
bashgrep -r "useFakeTimers\|advanceTimersByTime\|setSystemTime" turbo \ --include="*.test.ts" --include="*.test.tsx" -l
6. Direct Fetch Mocking (AP-2 Violations)
bashgrep -r 'vi\.fn.*fetch\|vi\.stubGlobal.*fetch\|vi\.spyOn.*fetch' turbo \ --include="*.test.ts" --include="*.test.tsx" -l
7. Filesystem Mocking (AP-3 Violations)
bashgrep -r 'vi\.mock.*["\x27]fs["\x27]\|vi\.mock.*["\x27]fs/promises["\x27]' turbo \ --include="*.test.ts" --include="*.test.tsx" -l
8. Dynamic Imports
bashgrep -r "await import\|import(.*)" turbo --include="*.ts" --include="*.tsx" \ --include="*.js" --include="*.jsx" -l
9. Hardcoded URLs
bash# Pattern: http:// or https:// in strings (exclude comments) grep -r 'https\?://' turbo --include="*.ts" --include="*.tsx" \ --include="*.js" --include="*.jsx" | grep -v '^\s*//' | cut -d: -f1 | sort -u
10. Try-Catch Blocks (Defensive Programming)
bashgrep -r "try {" turbo --include="*.ts" --include="*.tsx" \ --include="*.js" --include="*.jsx" -l
11. Fallback Patterns
bash# Pattern: || with fallback values grep -r "process\.env\.[A-Z_]*\s*||" turbo --include="*.ts" --include="*.tsx" \ --include="*.js" --include="*.jsx" -l
12. @ts-ignore and @ts-nocheck
bashgrep -r "@ts-ignore\|@ts-nocheck\|@ts-expect-error" turbo \ --include="*.ts" --include="*.tsx" -l
13. Testing Mock Calls (AP-1 Violations)
bashgrep -r "toHaveBeenCalled\|toHaveBeenCalledWith" turbo \ --include="*.test.ts" --include="*.test.tsx" -l
14. Console Mocking Without Assertions (AP-9)
bashgrep -r "console\.log\s*=\s*vi\.fn\|console\.error\s*=\s*vi\.fn" turbo \ --include="*.test.ts" --include="*.test.tsx" -l
15. Missing --max-warnings 0 in Lint Scripts
bash# All lint scripts MUST use --max-warnings 0 to prevent warnings from passing CI # Find package.json files with lint scripts that don't enforce zero warnings grep -r '"lint"' turbo --include="package.json" | grep -v "max-warnings 0"
16. ESLint Config "off" Rules (Rule Suppression Audit)
bash# Find rules set to "off" or 0 in ESLint configs — each must be justified grep -r '"off"\|: 0[,}]' turbo/packages/eslint-config --include="*.js" --include="*.mjs" # Also check app-level eslint configs grep -r '"off"\|: 0[,}]' turbo/apps/*/eslint.config.* turbo/packages/*/eslint.config.*
17. Oxlint Config "allow" Rules (Rule Suppression Audit)
bash# Find rules set to "allow" in oxlint configs — each must be justified # Focus on non-test overrides which are more suspicious grep -r '"allow"' turbo --include=".oxlintrc.json"
18. Partial Internal Mocks (AP-6 Violations)
bash# vi.importActual is a sign of partial mocking — usually wrong grep -r 'vi\.importActual' turbo --include="*.test.ts" --include="*.test.tsx" -l
19. Direct Component Rendering (AP-10 Violations)
bash# Platform test files using render() instead of setupPage — misses production bootstrap grep -r 'render(' turbo/apps/platform --include="*.test.tsx" -l
20. Direct Database Operations in Tests
bash# Tests should use API helpers, not direct DB insert/update/delete grep -r 'globalThis\.services\.db\.\(insert\|update\|delete\)' turbo \ --include="*.test.ts" --include="*.test.tsx" -l
21. Tests Importing Internal Services
bash# Test files importing from internal lib/ — means testing implementation, not behavior grep -rE "from.*['\"].*lib/infra|from.*['\"].*lib/zero" turbo \ --include="*.test.ts" --include="*.test.tsx" -l
22. initServices() in Tests
bash# Route tests should never call initServices() directly — API helpers handle it grep -r 'initServices()' turbo --include="*.test.ts" --include="*.test.tsx" -l
23. ccstate-react/experimental in Views (eslint-disable)
bash# Views files suppressing ccstate/no-use-ccstate-in-views — pending migration grep -rl "eslint-disable ccstate/no-use-ccstate-in-views" turbo/apps/platform/src/views/
24. void Instead of detach() for Floating Promises
bash# Using void to suppress floating promise lint — should use detach() with Reason grep -rEn 'void [a-zA-Z_$][a-zA-Z0-9_$]*\(' turbo/apps/platform --include="*.ts" --include="*.tsx" -l
25. Manual Loading Boolean in Signals
bash# Manual loading/saving boolean state — should use useLoadableSet or loadable pattern # Match signal names following the loading$/saving$/submitting$/creating$/deleting$ convention grep -rEn '\b(loading|saving|submitting|creating|deleting)\$\s*=\s*state\(' turbo/apps/platform/src/signals --include="*.ts" -l
26. Orphaned resetSignal (No Parent Signal)
bash# resetSignal called without parent signal — causes polling loops that never stop # Match set(resetXxx$) calls with no arguments after the signal name (no comma = no parent) grep -rEn 'set\(reset[A-Za-z0-9_]*\$\)' turbo/apps/platform/src/signals --include="*.ts"
For each file identified in Phase 1, perform detailed analysis:
Analysis Criteria (reference from docs/bad-smell.md and docs/testing.md):
Testing Anti-Patterns:
Code Quality Issues:
ccstate Anti-Patterns:
Severity Levels:
any usage--max-warnings 0 in lint scriptsCreate detailed report in /tmp/tech-debt-YYYYMMDD/:
Directory Structure:
/tmp/tech-debt-YYYYMMDD/
├── summary.md # Executive summary
├── statistics.md # Statistics and metrics
├── critical/ # P0 issues
│ ├── typescript-any.md
│ ├── lint-suppressions.md
│ ├── dynamic-imports.md
│ └── ap4-internal-mocking.md
├── high/ # P1 issues
│ ├── large-files.md
│ ├── defensive-programming.md
│ ├── hardcoded-urls.md
│ └── fetch-mocking.md
├── medium/ # P2 issues
│ ├── fallback-patterns.md
│ ├── testing-mock-calls.md
│ └── fake-timers.md
└── low/ # P3 issues
├── over-testing.md
└── console-mocking.mdFile Format for Each Issue:
markdown# [Issue Type] - [Severity] ## Overview - **Total Files Affected:** {count} - **Total Violations:** {count} - **Estimated Effort:** {hours/days} ## Affected Files ### {file-path} **Lines:** {line-count} **Violations:** {count} **Issues:** 1. Line {number}: {description} ```typescript {code-snippet} ``` **Remediation:** {suggestion} 2. Line {number}: {description} ... --- ### {next-file} ... ## Remediation Strategy {overall-strategy-for-this-issue-type} ## References - Bad Smell: #{number} - Testing Anti-Pattern: #{number} - Related Documentation: {link}
Summary Report Format:
markdown# Technical Debt Analysis Summary **Scan Date:** {date} **Scan Scope:** turbo/ directory **Total Files Scanned:** {count} **Total Files with Issues:** {count} ## Executive Summary {2-3 paragraph overview of findings} ## Statistics by Severity | Severity | Files | Violations | Est. Effort | |----------|-------|------------|-------------| | Critical | {n} | {n} | {hours} | | High | {n} | {n} | {hours} | | Medium | {n} | {n} | {hours} | | Low | {n} | {n} | {hours} | | **Total**| {n} | {n} | {hours} | ## Top Issues ### Critical Issues (Must Fix) 1. **TypeScript any:** {count} files, {violations} violations 2. **Lint Suppressions:** {count} files, {violations} violations 3. **Dynamic Imports:** {count} files, {violations} violations 4. **AP-4 Internal Mocking:** {count} files, {violations} violations 5. **Missing --max-warnings 0:** {count} lint scripts 6. **Unjustified ESLint/oxlint rule suppressions:** {count} rules ### High Priority Issues 1. **Large Files (>1500 lines):** {count} files 2. **Defensive Programming:** {count} files, {violations} try/catch blocks 3. **Hardcoded URLs:** {count} files, {violations} URLs 4. **Direct Fetch Mocking:** {count} test files 5. **Partial Internal Mocks (AP-6):** {count} test files 6. **Direct DB Operations in Tests:** {count} test files 7. **Internal Service Imports in Tests:** {count} test files 8. **initServices() in Tests:** {count} test files 9. **ccstate-react/experimental in Views:** {count} view files 10. **void Instead of detach():** {count} files 11. **Manual Loading Boolean:** {count} signal files 12. **Orphaned resetSignal:** {count} occurrences ### Medium Priority Issues 1. **Fallback Patterns:** {count} files 2. **Testing Mock Calls:** {count} test files 3. **Fake Timers:** {count} test files 4. **Direct Component Rendering (AP-10):** {count} test files 5. **Manual State Synchronization:** {count} signal files ## File Statistics ### Largest Files (Top 10) 1. {file-path} - {lines} lines 2. {file-path} - {lines} lines ... ### Most Violations (Top 10) 1. {file-path} - {count} violations 2. {file-path} - {count} violations ... ## Recommended Action Plan ### Phase 1: Critical Issues (1-2 weeks) - [ ] Fix all TypeScript any usage - [ ] Remove all lint suppressions - [ ] Replace dynamic imports with static - [ ] Fix AP-4 internal mocking violations - [ ] Ensure all lint scripts use --max-warnings 0 - [ ] Audit and justify all ESLint "off" / oxlint "allow" rules ### Phase 2: High Priority (2-4 weeks) - [ ] Refactor files >1500 lines - [ ] Remove defensive try/catch blocks - [ ] Replace hardcoded URLs with config - [ ] Convert fetch mocks to MSW ### Phase 3: Medium Priority (1-2 months) - [ ] Remove fallback patterns - [ ] Fix testing mock call assertions - [ ] Replace fake timers ### Phase 4: Low Priority (ongoing) - [ ] Address over-testing patterns - [ ] Clean up console mocking ## Detailed Reports - [Critical Issues](./critical/) - [High Priority Issues](./high/) - [Medium Priority Issues](./medium/) - [Low Priority Issues](./low/) --- *Generated by tech-debt skill on {date}*
After generating detailed reports, provide a medium-detail summary to the user:
markdown# Technical Debt Scan Complete ## Scan Results **Total Files Scanned:** {count} **Files with Issues:** {count} **Total Violations:** {count} ## By Severity - **Critical (P0):** {count} files, {violations} violations - **High (P1):** {count} files, {violations} violations - **Medium (P2):** {count} files, {violations} violations - **Low (P3):** {count} files, {violations} violations ## Top 5 Critical Issues 1. **TypeScript any** - {count} files - {file-path}:{line} - {brief-description} - {file-path}:{line} - {brief-description} 2. **Lint Suppressions** - {count} files - {file-path}:{line} - {brief-description} - {file-path}:{line} - {brief-description} 3. **Dynamic Imports** - {count} files - {file-path}:{line} - {brief-description} 4. **AP-4 Internal Mocking** - {count} files - {file-path}:{line} - {brief-description} 5. **Large Files** - {count} files - {file-path} - {lines} lines - {file-path} - {lines} lines ## Detailed Reports All detailed analysis has been saved to `/tmp/tech-debt-{date}/` - Summary: `/tmp/tech-debt-{date}/summary.md` - Statistics: `/tmp/tech-debt-{date}/statistics.md` - Critical issues: `/tmp/tech-debt-{date}/critical/` - High priority: `/tmp/tech-debt-{date}/high/` ## Next Steps Run `tech-debt issue` to create a GitHub issue tracking these findings.
Efficiency Tips:
grep -l (files only) for fast scanningwc -l for line countsAccuracy Tips:
node_modules and .git directories\b) for precisionCreate a GitHub issue based on research findings. If research hasn't been run, automatically run it first.
issuebash# Check if research was already done today LATEST_REPORT=$(ls -td /tmp/tech-debt-* 2>/dev/null | head -1) if [ -z "$LATEST_REPORT" ]; then echo "No research found. Running research first..." # Run research operation else echo "Using existing research from: $LATEST_REPORT" fi
Read research reports and prepare GitHub issue content:
Issue Title:
[Tech Debt] Codebase Quality Scan - {date}Issue Body Structure:
markdown# Technical Debt Analysis - {date} This issue tracks technical debt identified through automated codebase scanning. ## Executive Summary {paste-from-summary.md} ## Statistics {paste-from-statistics.md} ## Critical Issues (P0) - Must Fix {paste-critical-issues-summary} <details> <summary>Detailed Critical Issues</summary> {paste-from-critical/*.md} </details> ## High Priority Issues (P1) {paste-high-issues-summary} <details> <summary>Detailed High Priority Issues</summary> {paste-from-high/*.md} </details> ## Medium Priority Issues (P2) {paste-medium-issues-summary} <details> <summary>Detailed Medium Priority Issues</summary> {paste-from-medium/*.md} </details> ## Action Plan ### Phase 1: Critical Issues (Target: 1-2 weeks) - [ ] Fix TypeScript any usage ({count} files) - [ ] Remove lint suppressions ({count} files) - [ ] Replace dynamic imports ({count} files) - [ ] Fix internal mocking violations ({count} files) - [ ] Ensure all lint scripts use --max-warnings 0 ({count} scripts) - [ ] Audit ESLint "off" / oxlint "allow" rules ({count} rules) ### Phase 2: High Priority (Target: 2-4 weeks) - [ ] Refactor large files ({count} files) - [ ] Remove defensive programming ({count} blocks) - [ ] Replace hardcoded URLs ({count} files) - [ ] Convert fetch mocks to MSW ({count} files) - [ ] Remove vi.importActual usage ({count} files) - [ ] Replace direct DB operations in tests with API helpers ({count} files) - [ ] Remove internal service imports from tests ({count} files) - [ ] Remove initServices() from tests ({count} files) - [ ] Migrate ccstate-react/experimental out of views ({count} files) - [ ] Replace void with detach() ({count} files) - [ ] Replace manual loading booleans with useLoadableSet ({count} files) - [ ] Fix orphaned resetSignal calls ({count} occurrences) ### Phase 3: Medium Priority (Target: 1-2 months) - [ ] Remove fallback patterns ({count} files) - [ ] Fix testing mock assertions ({count} files) - [ ] Replace fake timers ({count} files) - [ ] Replace direct component rendering with setupPage ({count} files) - [ ] Refactor manual state synchronization to computed ({count} files) ## Labels `tech-debt` `quality` `refactoring` --- **Scan Details:** - Date: {date} - Scope: turbo/ directory - Total files scanned: {count} - Total violations: {count} **References:** - Bad Smell Documentation: `/docs/bad-smell.md` - Testing Guidelines: `/docs/testing.md`
Single Issue Strategy:
If total content is under GitHub issue size limit (~65K characters):
bashgh issue create \ --title "[Tech Debt] Codebase Quality Scan - $(date +%Y-%m-%d)" \ --body-file /tmp/tech-debt-{date}/github-issue-body.md \ --label "tech-debt,quality,refactoring"
Multiple Comments Strategy:
If content exceeds size limit, create issue with summary and post detailed sections as comments:
bash# 1. Create issue with executive summary ISSUE_URL=$(gh issue create \ --title "[Tech Debt] Codebase Quality Scan - $(date +%Y-%m-%d)" \ --body-file /tmp/tech-debt-{date}/github-issue-summary.md \ --label "tech-debt,quality,refactoring") ISSUE_NUMBER=$(echo $ISSUE_URL | grep -oP '\d+$') # 2. Post critical issues as comment gh issue comment $ISSUE_NUMBER \ --body-file /tmp/tech-debt-{date}/github-comment-critical.md # 3. Post high priority issues as comment gh issue comment $ISSUE_NUMBER \ --body-file /tmp/tech-debt-{date}/github-comment-high.md # 4. Post medium priority issues as comment gh issue comment $ISSUE_NUMBER \ --body-file /tmp/tech-debt-{date}/github-comment-medium.md # 5. Post action plan as comment gh issue comment $ISSUE_NUMBER \ --body-file /tmp/tech-debt-{date}/github-comment-action-plan.md
Comment Size Limits:
markdown# GitHub Issue Created **Issue URL:** {url} **Issue Number:** #{number} ## Content Posted ✅ Issue created with executive summary ✅ Posted {n} comments with detailed findings ## Issue Structure - Main issue: Executive summary and statistics - Comment 1: Critical Issues (P0) - Comment 2: High Priority Issues (P1) - Comment 3: Medium Priority Issues (P2) - Comment 4: Action Plan ## Next Steps 1. Review the GitHub issue 2. Prioritize which issues to tackle first 3. Create separate issues for specific refactoring tasks if needed 4. Track progress using the checklist in the action plan ## Local Reports Detailed reports are also available in: `/tmp/tech-debt-{date}/`
GitHub CLI Usage:
gh issue create to create issuesgh issue comment to add commentsgh auth status--body-file for large content if neededContent Preparation:
<details>) for long contentError Handling:
Zero Tolerance Issues (P0):
any usage--max-warnings 0 in lint scriptsHigh Priority Issues (P1):
Medium Priority Issues (P2):
Low Priority Issues (P3):
To User:
In Reports:
In GitHub Issues:
When encountering errors:
# Run research scan
args: "research"
# Create GitHub issue from research
args: "issue"/docs/bad-smell.md/docs/testing.md/docs/testing/anti-patterns.md/docs/testing/api-testing.md/docs/testing/app-testing.md/.claude/skills/ccstate/SKILL.md/.claude/skills/code-quality/SKILL.md/CLAUDE.mdOther measured skills in the registry, with their headline benchmark lift.