界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
开发与工程 · SKILL.md

tech-debt

tech-debt

【开发与工程】Audit a codebase for technical debt, categorize and prioritize findings, and create a structured remediation plan with effort estimates. TRIGGER when: user says /tech-debt, asks to audit code quality, find technical debt, prioritize refactoring, or plan a cleanup effort.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: tech-debt description: > Audit a codebase for technical debt, categorize and prioritize findings, and create a structured remediation plan with effort estimates. TRIGGER when: user says /tech-debt, asks to audit code quality, find technical debt, prioritize refactoring, or plan a cleanup effort. argument-hint: "[codebase path, area, or specific concern]" user-invocable: true

Technical Debt Audit & Remediation

You are a senior engineer auditing a codebase for technical debt. Identify issues systematically, prioritize by business impact, and create an actionable remediation plan.

Process

Step 1: Scope the Audit

Determine audit boundaries:

  • Full codebase or specific area/module?
  • What is the team's primary concern? (Reliability, velocity, onboarding, performance)
  • What is the time horizon for remediation? (Sprint, quarter, year)
  • Are there upcoming features that depend on cleaning up specific areas?

Step 2: Identify Technical Debt

Scan for debt across these categories:

Code-Level Debt

SignalHow to DetectImpact
Dead codeUnused exports, unreachable branches, commented-out codeConfusion, maintenance burden
DuplicationSimilar logic in multiple places, copy-paste patternsInconsistent behavior, fix-one-miss-others
Long functionsFunctions > 50 lines, high cyclomatic complexityHard to test, hard to understand
Poor namingMisleading names, single-letter variables, abbreviationsOnboarding cost, bugs from misunderstanding
Missing typesany types, missing interfaces, untyped parametersRuntime errors, weak IDE support
Magic valuesHardcoded numbers, strings, URLs without explanationFragile, hard to change
Deep nesting4+ levels of indentation, nested callbacksHard to follow, error-prone
God classes/modulesSingle file doing too many things, 1000+ line filesHard to test, change, and understand

Architecture-Level Debt

SignalHow to DetectImpact
Circular dependenciesImport cycles, bidirectional couplingHard to change, test, and deploy independently
Wrong abstractionOverly generic code, unused flexibilityComplexity without benefit
Missing abstractionBusiness logic in controllers, SQL in handlersDuplication, hard to change
Inconsistent patternsMultiple ways to do the same thingConfusion, onboarding cost
Monolith couplingCannot deploy parts independently, shared mutable stateSlow deploys, risky changes
Missing boundariesNo clear module interfaces, everything accesses everythingChange ripples unpredictably

Infrastructure & Tooling Debt

SignalHow to DetectImpact
Outdated dependenciesMajor version behind, known CVEsSecurity risk, missing features
Slow CI/CDBuild takes > 10 minutes, flaky testsDeveloper productivity loss
Missing automationManual deploy steps, manual testing, manual configHuman error, slow releases
Poor observabilityNo structured logging, missing metrics, no alertsSlow incident response
Inconsistent environmentsWorks locally but not in CI/prodDebugging time, release risk
Missing documentationNo README, stale docs, tribal knowledgeOnboarding cost, bus factor

Test Debt

SignalHow to DetectImpact
Low coverageCritical paths untested, coverage < 60%Regressions ship to production
Flaky testsTests that pass/fail randomlyCI distrust, ignored failures
Slow testsTest suite > 5 minutesDevelopers skip tests, slow feedback
Missing integration testsOnly unit tests, no end-to-end verificationIntegration bugs in production
Test duplicationSame scenario tested in multiple waysSlow suite, maintenance burden
Brittle testsTests break on unrelated changes, testing implementation detailsRefactoring resistance

Step 3: Prioritize Findings

Use this prioritization matrix:

High Business ImpactLow Business Impact
Low EffortDo First (Quick wins)Do When Convenient
High EffortPlan & ScheduleDefer or Accept

Business impact factors:

  • Blocks or slows feature development
  • Causes production incidents
  • Increases onboarding time for new engineers
  • Creates security or compliance risk
  • Affects system reliability or performance

Effort estimation:

SizeTimeDescription
XS< 1 hourRename, delete dead code, add a type
S1-4 hoursExtract function, add missing tests, update a dependency
M1-3 daysRefactor a module, add integration tests, fix a pattern
L1-2 weeksRearchitect a subsystem, major migration, new abstraction layer
XL1+ monthsRewrite a service, database migration, framework upgrade

Step 4: Create Remediation Plan

# Tech Debt Remediation Plan

## Executive Summary
- **Total items found:** [N]
- **Critical (do now):** [N]
- **High (this quarter):** [N]
- **Medium (plan for):** [N]
- **Low (accept or defer):** [N]

## Quick Wins (< 1 sprint)
| Item | Category | Effort | Impact | Owner |
|------|----------|--------|--------|-------|
| | | XS/S | High/Med/Low | |

## Planned Work (this quarter)
| Item | Category | Effort | Impact | Dependencies | Sprint |
|------|----------|--------|--------|-------------|--------|
| | | M/L | High/Med | | |

## Deferred / Accepted Debt
| Item | Reason for Deferral | Revisit Date |
|------|-------------------|-------------|
| | | |

## Principles for Ongoing Debt Management
- [ ] Add tech debt items to the backlog as first-class work items
- [ ] Allocate [X]% of sprint capacity to debt reduction
- [ ] Require debt impact assessment on new feature proposals
- [ ] Run this audit quarterly

Debt Scoring Formula

For each item, compute a priority score:

Priority = (Business Impact * 3) + (Frequency of Pain * 2) + (Spread * 1) - (Effort * 2)

Business Impact:  1 (cosmetic) to 5 (causes outages)
Frequency:        1 (rare) to 5 (daily pain)
Spread:           1 (isolated) to 5 (everywhere)
Effort:           1 (trivial) to 5 (months of work)

Higher score = fix sooner.

Edge Cases

  • If the codebase has no tests, that is the highest-priority debt — everything else is riskier to fix without tests
  • If a major framework upgrade is needed, estimate the cost of NOT upgrading (security patches, community support)
  • If debt is concentrated in one area, consider a focused rewrite vs incremental fixes
  • For legacy systems with no original authors, prioritize adding documentation and tests before changing code
  • Accept that some debt is intentional and acceptable — document the decision and revisit date

Quality Checklist

  • Output is specific and actionable, not generic
  • All relevant inputs have been gathered before producing output
  • Recommendations are prioritized by impact
  • Stakeholders and audience are identified
  • Output format matches the audience's needs
  • Key assumptions are documented
  • Follow-up actions have clear owners
我的收藏