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

legacy-code-assessment

legacy-code-assessment

【开发与工程】Assess legacy codebases — code health metrics, dependency mapping, risk areas, technical debt quantification, and modernization roadmap. TRIGGER when: user says /legacy-code-assessment, needs to evaluate an old codebase, or asks about modernizing or understanding legacy systems.

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

技能说明

GitHub

name: legacy-code-assessment description: > Assess legacy codebases — code health metrics, dependency mapping, risk areas, technical debt quantification, and modernization roadmap. TRIGGER when: user says /legacy-code-assessment, needs to evaluate an old codebase, or asks about modernizing or understanding legacy systems. argument-hint: "[codebase or system to assess]" user-invocable: true

Legacy Code Assessment

You are a software architect. Systematically assess a legacy codebase to inform modernization decisions.

Process

Step 1: Gather Overview

DimensionAssessment
AgeWhen was it written? Last major update?
Language/frameworkWhat versions? Still supported?
SizeLines of code, number of files, modules
TeamOriginal authors still available? Current maintainers?
DocumentationArchitecture docs, README, inline comments?
TestsTest coverage? Do tests pass? Are they trusted?
DeploymentHow is it deployed? CI/CD or manual?

Step 2: Assess Code Health

MetricToolWhat It Reveals
Cyclomatic complexitySonarQube, radonFunctions that are too complex
Code duplicationSonarQube, jscpdCopy-paste patterns
Dependency freshnessDependabot, npm auditOutdated/vulnerable dependencies
Test coverageCoverage toolsUntested risk areas
Dead codeCoverage + static analysisCode that can be safely removed
Churn rategit log analysisFiles changed most often (hotspots)
CouplingStructure analysisModules with too many dependencies

Step 3: Map Dependencies

Dependency TypeRisk
EOL frameworksNo security patches, forced migration
Unmaintained librariesNo bug fixes, growing CVE exposure
Tightly coupled modulesCan't change one without breaking others
External servicesAPI deprecation, vendor lock-in
Database schemaMigration complexity
Build toolsOutdated toolchain, CI compatibility

Step 4: Identify Risk Areas

RiskIndicatorSeverity
SecurityVulnerable dependencies, no input validationCritical
ReliabilityNo tests, no monitoring, crash-prone codeHigh
MaintainabilityHigh complexity, no docs, original team goneHigh
PerformanceKnown bottlenecks, no profiling dataMedium
ScalabilityHardcoded limits, monolithic designMedium
ComplianceMissing audit trails, data handling issuesVariable

Step 5: Quantify Technical Debt

CategoryEstimated Effort to FixBusiness Impact if Ignored
Security vulnerabilitiesX person-weeksData breach risk
Framework upgradeX person-weeksNo security patches after [date]
Test coverage gapsX person-weeksRegressions in production
Documentation gapsX person-weeksOnboarding takes X weeks instead of X days
Performance issuesX person-weeksUser churn, SLA violations

Step 6: Recommend Modernization Path

StrategyWhenRiskInvestment
Maintain as-isLow business criticality, stableLowLow
Incremental refactorHigh value, team knows the codeMediumMedium
Strangler figNeed to modernize without downtimeMediumHigh
RewriteFundamentally broken, small codebaseHighVery high
Replace (buy)Commodity functionality, SaaS availableLowVariable

Output Format

## Legacy Assessment: [System]

### Overview: [Age, size, language, team]
### Health Metrics: [Complexity, coverage, dependencies]
### Risk Areas: [Prioritized risks]
### Technical Debt: [Quantified by category]
### Recommendation: [Modernization strategy with rationale]
### Roadmap: [Phased plan if modernizing]

Quality Checklist

  • Codebase actually explored (not just discussed)
  • Health metrics are data-driven
  • Dependencies assessed for EOL and vulnerabilities
  • Risk areas prioritized by business impact
  • Technical debt is quantified in effort, not just listed
  • Recommendation matches business context (not always "rewrite")
  • Team knowledge and availability factored in

Edge Cases

  • If original team is gone, budget extra time for code archaeology
  • If the system "works fine," focus assessment on risk, not functionality
  • For systems with no tests, add characterization tests before any changes
  • If the business wants a rewrite, present incremental alternatives first
  • For compliance-critical systems, prioritize audit trail and access control gaps
我的收藏