npx skills add https://github.com/alienfast/claude --skill 'Deprecation Handler'此技能有助于安全地识别、评估过时代码并将其迁移至现代替代方案。它确保对已弃用的 API、类型、函数和模块进行系统性处理。
在以下情况调用此技能:
自动检测:
# TypeScript 编译器警告
npx tsc --noEmit
# 依赖项审计
npm outdated
pnpm outdated
# 检查已弃用的包
npm deprecate-check
手动检测:
输出:创建所有检测到的弃用项目录,包含:
按优先级分类:
分析范围:
风险评估:
对于立即/高优先级:
对于中/低优先级:
输出:迁移计划,包含:
安全迁移模式:
// 1. 在旧实现旁边添加新实现
const newImplementation = modernApi.newMethod(params);
// 2. 在测试中验证等价性
expect(newImplementation).toEqual(oldImplementation);
// 3. 替换使用
// const result = legacyApi.deprecatedMethod(params); // 已弃用
const result = modernApi.newMethod(params);
// 4. 验证后移除旧代码
增量方法:
对于简单情况(同一文件):
// 之前
import { deprecatedFunc } from 'old-package';
deprecatedFunc(arg);
// 之后
import { newFunc } from 'new-package';
newFunc(arg);
对于复杂情况(单独的提交/PR):
自动验证:
# 类型检查
npx tsc --noEmit
# 代码检查(应显示更少的弃用警告)
npx eslint . --ext .ts,.tsx,.js,.jsx
# 运行测试套件
npm test
pnpm test
# 构建验证
npm run build
pnpm build
手动验证:
回归预防:
有关详细示例,请参阅 resources/migration-patterns.md:
当弃用项无法立即修复时:
/**
* TODO: 当 v3 迁移完成时,迁移到 newApi.modernMethod()
*
* 当前使用 deprecatedMethod() 的原因是:
* - 依赖于旧版身份验证系统
* - 破坏性变更需要协调更新
*
* 迁移指南:https://docs.example.com/v2-to-v3
* 淘汰日期:2026-Q2
* 跟踪问题:#1234
*/
legacyApi.deprecatedMethod(params);
必需元素:
更新更新日志或迁移说明:
## 弃用修复
- 将 `React.createClass` 替换为函数组件
- 从 `componentWillMount` 迁移到 `useEffect` 钩子
- 将已弃用的 `request` 包更新为 `axios`
- 移除使用已弃用的 `moment`,改用 `date-fns`
在完成迁移之前:
// 记录为何没有替代方案以及替代方法
// 已弃用:myLib.removedFeature() 没有直接替代方案
// 替代方法:使用 myLib.lowerLevelApi() 实现自定义逻辑
// 参见:https://github.com/mylib/issues/5678
const customImplementation = (params) => {
// 使用可用 API 的自定义逻辑
};
// 当一个依赖项需要另一个依赖项的已弃用 API 时:
// TODO:被 outdated-package@2.x 需要已弃用 API 所阻止
// 在 outdated-package 发布 v3.x 之前无法升级
// 跟踪:https://github.com/outdated-package/issues/123
deprecatedApi.requiredByDependency();
// 当在大型代码库中增量迁移时:
// 迁移进行中:完成 45%(33 个文件中的 15 个已迁移)
// 参见迁移计划:docs/deprecation-migration-plan.md
// 此文件:尚未迁移(计划在 Sprint 5 中)
legacyPattern.stillInUse();
此技能实现了以下模式:
每周安装次数
0
仓库
首次出现
1970年1月1日
安全审计
This skill helps safely identify, assess, and migrate deprecated code to modern alternatives. It ensures systematic handling of deprecated APIs, types, functions, and modules.
Invoke this skill when:
Automated Detection :
# TypeScript compiler warnings
npx tsc --noEmit
# Dependency audit
npm outdated
pnpm outdated
# Check for deprecated packages
npm deprecate-check
Manual Detection :
Output : Create a catalog of all detected deprecations with:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
Classify by Priority :
Analyze Scope :
Risk Assessment :
For Immediate/High Priority :
For Medium/Low Priority :
Output : Migration plan with:
Safe Migration Pattern :
// 1. Add new implementation alongside old
const newImplementation = modernApi.newMethod(params);
// 2. Validate equivalence in tests
expect(newImplementation).toEqual(oldImplementation);
// 3. Replace usage
// const result = legacyApi.deprecatedMethod(params); // DEPRECATED
const result = modernApi.newMethod(params);
// 4. Remove old code after validation
Incremental Approach :
For Simple Cases (same file):
// Before
import { deprecatedFunc } from 'old-package';
deprecatedFunc(arg);
// After
import { newFunc } from 'new-package';
newFunc(arg);
For Complex Cases (separate commit/PR):
Automated Validation :
# Type checking
npx tsc --noEmit
# Linting (should show fewer deprecation warnings)
npx eslint . --ext .ts,.tsx,.js,.jsx
# Run test suite
npm test
pnpm test
# Build verification
npm run build
pnpm build
Manual Validation :
Regression Prevention :
See resources/migration-patterns.md for detailed examples of:
When deprecations cannot be immediately fixed:
/**
* TODO: Migrate to newApi.modernMethod() when v3 migration is complete
*
* Current usage of deprecatedMethod() due to:
* - Dependency on legacy authentication system
* - Breaking changes require coordinated update
*
* Migration guide: https://docs.example.com/v2-to-v3
* Sunset date: 2026-Q2
* Tracking issue: #1234
*/
legacyApi.deprecatedMethod(params);
Required Elements :
Update changelog or migration notes:
## Deprecation Fixes
- Replaced `React.createClass` with functional components
- Migrated from `componentWillMount` to `useEffect` hooks
- Updated deprecated `request` package to `axios`
- Removed usage of deprecated `moment` in favor of `date-fns`
Before completing migration:
// Document why no replacement exists and alternative approach
// DEPRECATED: myLib.removedFeature() has no direct replacement
// Alternative: Implement custom logic using myLib.lowerLevelApi()
// See: https://github.com/mylib/issues/5678
const customImplementation = (params) => {
// Custom logic using available APIs
};
// When one dependency requires deprecated API from another:
// TODO: Blocked by outdated-package@2.x requiring deprecated API
// Cannot upgrade until outdated-package releases v3.x
// Tracking: https://github.com/outdated-package/issues/123
deprecatedApi.requiredByDependency();
// When migrating incrementally across large codebase:
// MIGRATION IN PROGRESS: 45% complete (15/33 files migrated)
// See migration plan: docs/deprecation-migration-plan.md
// This file: Not yet migrated (scheduled for Sprint 5)
legacyPattern.stillInUse();
This skill implements patterns from:
Weekly Installs
0
Repository
First Seen
Jan 1, 1970
Security Audits
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
147,400 周安装