Aller au contenu principal

Skill: qa-tech-debt

Fork

Technical debt management and prioritization. Trigger when the user wants to identify, prioritize, or plan the repayment of technical debt.

Configuration

PropertyValue
Contextfork
Allowed toolsRead, Grep, Glob, Bash
Keywordstech, debt, technical debt, tech debt, refactoring priority, legacy code, code quality

Detailed description

Tech Debt Management

Triggers

  • "technical debt"
  • "tech debt"
  • "refactoring priority"
  • "legacy code"
  • "code quality"

Identification

Code Smells to Detect

# TODOs and FIXMEs
grep -r "TODO\|FIXME\|HACK\|XXX" --include="*.ts" --include="*.tsx" src/

# Large files
find src -name "*.ts" -o -name "*.tsx" | xargs wc -l | sort -n | tail -20

# Complexity (nesting)
grep -r "if.*if.*if" --include="*.ts" src/

# any in TypeScript
grep -r ": any" --include="*.ts" --include="*.tsx" src/

Metrics

MetricThresholdCommand
LOC/file< 500wc -l
Functions/file< 15grep
Nesting depth< 4analysis
Test coverage> 70%npm test -- --coverage

Categorization

Impact

LevelDescriptionExamples
CriticalBlocks developmentCircular coupling
HighSignificantly slows downMassive duplication
MediumHinders maintenanceConfusing naming
LowCosmeticInconsistent style

Effort

LevelTimeExamples
Trivial< 1hRename variable
Low< 1 dayExtract function
Medium1-5 daysRestructure module
High> 1 weekRewrite component

Prioritization

Impact/Effort Matrix

Impact
^
| Quick Wins | Strategic
| (P1) | (P2)
+--------------+-------------
| Fill-in | Avoid
| (P3) | (P4)
+-------------------------> Effort

Remediation Plan

Template

## Item: [Name]

**Priority**: P[1-4]
**Impact**: [Critical/High/Medium/Low]
**Effort**: [Trivial/Low/Medium/High]

### Description
[Description of the problem]

### Files concerned
- path/to/file.ts:L42

### Proposed solution
[Refactoring approach]

### Success criteria
- [ ] Tests pass
- [ ] No regression
- [ ] Improved metrics

Workflow

  1. Identify - Scan the codebase
  2. Categorize - Impact and effort
  3. Prioritize - Decision matrix
  4. Plan - Integrate into the backlog
  5. Execute - Incremental refactoring
  6. Validate - Tests and metrics

Automatic triggering

This skill is automatically activated when:

  • The matching keywords are detected in the conversation
  • The task context matches the skill's domain

Triggering examples

  • "I want to tech..."
  • "I want to debt..."
  • "I want to technical debt..."

Context fork

Fork means the skill runs in an isolated context:

  • Does not pollute the main conversation
  • Results are returned cleanly
  • Ideal for autonomous tasks

Practical examples

1. Example: Tech Debt Inventory

Example: Tech Debt Inventory

Scenario

Audit a 2-year-old Node.js API to inventory and prioritize technical debt.

Debt Inventory

Critical (fix within 1 sprint)

IDCategoryDescriptionImpactEffort
TD-001SecurityExpress 4.17 has known CVEs, upgrade to 4.21+HighS
TD-002ReliabilityNo error handling middleware; unhandled rejections crash serverHighS
TD-003DataRaw SQL queries with string interpolation (SQL injection risk)HighM

High (fix within 1 month)

IDCategoryDescriptionImpactEffort
TD-004Maintainability3 god classes > 800 lines (OrderController, UserService, Utils)MediumL
TD-005TestingTest coverage at 23%, no integration testsMediumL
TD-006Types47 any types across codebase, no strict modeMediumM
TD-007Dependencies12 packages 2+ major versions behindMediumM

Medium (plan for next quarter)

IDCategoryDescriptionImpactEffort
TD-008ArchitectureCircular dependencies between 5 modulesLowL
TD-009DXNo linting or formatting configuredLowS
TD-010ObservabilityConsole.log only, no structured loggingLowM
TD-011APIInconsistent error response formats across 15 endpointsLowM

Metrics Summary

Total debt items: 11
Critical: 3 (fix immediately)
High: 4 (plan this month)
Medium: 4 (next quarter)

Estimated total effort: ~45 story points
Test coverage: 23% -> target 80%
TypeScript any count: 47 -> target 0
Outdated dependencies: 12 -> target 0

Sprint 1: Security & Stability

  • TD-001: Upgrade Express (1 point)
  • TD-002: Add error middleware (2 points)
  • TD-003: Parameterized queries (5 points)
  • TD-009: Setup ESLint + Prettier (2 points)

Sprint 2-3: Testing & Types

  • TD-006: Enable strict TypeScript, fix any types (8 points)
  • TD-005: Add tests for critical paths first (13 points)

Sprint 4+: Architecture

  • TD-004: Extract services from god classes (8 points)
  • TD-008: Resolve circular dependencies (5 points)

Key Decisions

  • Security first: SQL injection and CVEs before any feature work
  • 20% rule: Allocate 20% of each sprint to debt paydown
  • Metrics tracking: Re-run audit monthly, track trend in coverage and any count
  • Boy Scout rule: Improve any file you touch, even outside debt sprints

See also