AgentSkillsCN

tech-debt

技术债务的识别、追踪与修复策略。 适用场景:在分析代码库健康状况、规划重构工作,或当用户提及“技术债务”“重构”“遗留系统”“清理”“代码健康”时启用此技能。

SKILL.md
--- frontmatter
name: tech-debt
description: |
  Technical debt identification, tracking, and remediation strategies.
  Activate when: analyzing codebase health, planning refactoring, or when user mentions
  "tech debt", "refactor", "legacy", "cleanup", "code health".
triggers: ["tech debt", "technical debt", "refactor", "legacy code", "code health", "cleanup"]

Technical Debt Management

Identify, quantify, and strategically address technical debt.

Debt Categories

CategoryDescriptionImpact
Design DebtArchitectural shortcutsHard to extend, test
Code DebtImplementation shortcutsBugs, maintenance cost
Test DebtMissing/poor testsRisk, slow changes
Doc DebtMissing documentationOnboarding, knowledge loss
Dependency DebtOutdated packagesSecurity, compatibility
Infrastructure DebtManual processesSlow releases, errors

Quick Assessment

Code Smells → Debt Indicators

SmellDebt TypePriority
God ClassDesignHigh
Long MethodCodeMedium
Copy-PasteCodeHigh
No TestsTestHigh
TODO/FIXMECodeLow-Medium
Magic NumbersCodeLow

Debt Scoring Formula

code
Score = Severity × Spread × Fix Effort

Severity: Critical=4, High=3, Medium=2, Low=1
Spread: Pervasive=3, Common=2, Isolated=1
Effort: Major=3, Moderate=2, Minor=1

Remediation Strategy

Priority Matrix

Low EffortHigh Effort
High ValueDo FirstPlan Sprint
Low ValueQuick WinsDefer/Skip

The Boy Scout Rule

Leave code cleaner than you found it

When touching code:

  1. Fix obvious issues
  2. Add missing tests
  3. Improve naming
  4. Remove dead code

Critical Don'ts

  • Don't accumulate debt without tracking
  • Don't refactor without tests
  • Don't gold-plate (over-engineer solutions)
  • Don't ignore security-related debt

References

  • For debt patterns: Read references/debt-patterns.md
  • For refactoring strategies: Read references/refactoring-strategies.md