ln-821-npm-upgrader by levnikolaevich/claude-code-skills
npx skills add https://github.com/levnikolaevich/claude-code-skills --skill ln-821-npm-upgrader路径说明: 文件路径(
shared/、references/、../ln-*)是相对于技能仓库根目录的。如果在当前工作目录未找到,请定位此 SKILL.md 文件所在目录并向上返回一级以找到仓库根目录。如果缺少shared/目录,请通过 WebFetch 从https://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}获取文件。
类型: L3 Worker 类别: 8XX 优化 父级: ln-820-dependency-optimization-coordinator
使用 npm、yarn 或 pnpm 升级 Node.js 依赖项,具备自动破坏性变更检测和迁移功能。
| 方面 | 详情 |
|---|---|
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 项目路径,包管理器类型 |
| 输出 | 更新后的 package.json,锁文件,迁移报告 |
| 支持 | npm,yarn(经典版 & berry),pnpm |
阶段: 预检 → 分析 → 安全审计 → 检查过时依赖 → 识别破坏性变更 → 应用升级 → 应用迁移 → 验证构建 → 报告
| 检查项 | 是否必需 | 缺失时的操作 |
|---|---|---|
| 锁文件(package-lock.json,yarn.lock,pnpm-lock.yaml) | 是 | 警告并先运行 npm install |
| package.json | 是 | 阻止升级 |
| Git 干净状态 | 是 | 阻止(需要干净的基线用于回滚) |
Workers 假设协调器(ln-820)已验证 git 状态并创建了备份。
强制阅读: 加载 shared/references/git_worktree_fallback.md — 使用 ln-821 行。
读取 package.json 并对依赖项进行分类,以确定升级优先级。
| 类别 | 示例 | 优先级 |
|---|---|---|
| 框架 | react,vue,angular | 2(在对等依赖之后) |
| 构建工具 | vite,webpack,esbuild | 3 |
| UI 库 | @radix-ui/*,tailwindcss | 4 |
| 状态管理 | @tanstack/react-query,zustand | 5 |
| 工具库 | lodash,date-fns | 6 |
| 开发依赖 | eslint,prettier,typescript | 7 |
| 对等依赖 | @types/*,typescript | 1(最先) |
| 管理器 | 命令 |
|---|---|
| npm | npm audit --audit-level=high |
| yarn | yarn audit --level high |
| pnpm | pnpm audit --audit-level high |
| 严重性 | 操作 |
|---|---|
| 严重 | 阻止升级,报告 |
| 高 | 警告,继续 |
| 中/低 | 仅记录 |
| 管理器 | 命令 |
|---|---|
| npm | npm outdated --json |
| yarn | yarn outdated --json |
| pnpm | pnpm outdated --json |
强制阅读: 加载 breaking_changes_patterns.md 查看完整模式。
| 包 | 破坏性版本 | 关键变更 |
|---|---|---|
| react | 18 → 19 | JSX 转换,ref 作为 prop |
| vite | 5 → 6 | 仅支持 ESM,Node 18+ |
| eslint | 8 → 9 | 需要扁平配置 |
| tailwindcss | 3 → 4 | 基于 CSS 的配置 |
| typescript | 5.4 → 5.5+ | 更严格的类型推断 |
| 管理器 | 命令 |
|---|---|
| npm | npm install <package>@latest --save |
| yarn | yarn add <package>@latest |
| pnpm | pnpm add <package>@latest |
| 情况 | 解决方案 |
|---|---|
| ERESOLVE 错误 | npm install --legacy-peer-deps |
| 仍然失败 | npm install --force(最后手段) |
| 优先级 | 工具 | 使用时机 |
|---|---|---|
| 1 | mcp__context7__query-docs | 库文档的首选 |
| 2 | mcp__Ref__ref_search_documentation | 官方文档和 GitHub |
| 3 | WebSearch | 最新信息,社区解决方案 |
| 步骤 | 工具 | 参数 |
|---|---|---|
| 1. 查找库 | mcp__context7__resolve-library-id | libraryName: "react", query: "migration guide" |
| 2. 查询文档 | mcp__context7__query-docs | libraryId: "/facebook/react", query: "react 18 to 19 migration" |
| 操作 | 工具 | 查询示例 |
|---|---|---|
| 搜索 | mcp__Ref__ref_search_documentation | "react 19 migration guide breaking changes" |
| 阅读 | mcp__Ref__ref_read_url | 来自搜索结果的 URL |
当 Context7/Ref 没有返回结果时使用:
"<package> <version> breaking changes migration {current_year}""<package> <error message> fix stackoverflow"请勿应用硬编码的迁移。始终通过 MCP 工具获取最新的指南。
| 检查项 | 命令 |
|---|---|
| TypeScript | npm run check 或 npx tsc --noEmit |
| 构建 | npm run build |
| 测试 | npm test(如果可用) |
| 字段 | 描述 |
|---|---|
| project | 项目路径 |
| packageManager | npm,yarn 或 pnpm |
| duration | 总耗时 |
| upgrades.major[] | 应用的破坏性变更 |
| upgrades.minor[] | 功能更新 |
| upgrades.patch[] | 错误修复 |
| migrations[] | 应用的迁移 |
| skipped[] | 已是最新版本 |
| buildVerification | 通过 或 失败 |
| warnings[] | 非阻塞性问题 |
Options:
# Upgrade scope
upgradeType: major # major | minor | patch
# Breaking changes
allowBreaking: true
autoMigrate: true
queryMigrationGuides: true # Use Context7/Ref
# Security
auditLevel: high # none | low | moderate | high | critical
minimumReleaseAge: 14 # days
# Peer dependencies
legacyPeerDeps: false
force: false
# Verification
runBuild: true
runTests: false
runTypeCheck: true
# Rollback
createBackup: true
rollbackOnFailure: true
| 错误 | 原因 | 解决方案 |
|---|---|---|
| ERESOLVE | 对等依赖冲突 | --legacy-peer-deps |
| ENOENT | 缺少锁文件 | 先运行 npm install |
| 构建失败 | 破坏性变更 | 通过 Context7 应用迁移 |
| 类型错误 | 版本不匹配 | 更新 @types/* |
从 git 恢复 package.json 和锁文件,然后运行干净的安装以恢复到之前的状态。
npm/yarn/pnpm outdated 识别出过时的包版本: 1.1.0 最后更新: 2026-01-10
每周安装数
77
仓库
GitHub 星标数
253
首次出现
2026年3月8日
安全审计
安装于
cursor74
gemini-cli72
github-copilot72
codex72
amp72
cline72
Paths: File paths (
shared/,references/,../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root. Ifshared/is missing, fetch files via WebFetch fromhttps://raw.githubusercontent.com/levnikolaevich/claude-code-skills/master/skills/{path}.
Type: L3 Worker Category: 8XX Optimization Parent: ln-820-dependency-optimization-coordinator
Upgrades Node.js dependencies using npm, yarn, or pnpm with automatic breaking change detection and migration.
| Aspect | Details |
|---|---|
| Input | Project path, package manager type |
| Output | Updated package.json, lock file, migration report |
| Supports | npm, yarn (classic & berry), pnpm |
Phases: Pre-flight → Analyze → Security Audit → Check Outdated → Identify Breaking → Apply Upgrades → Apply Migrations → Verify Build → Report
| Check | Required | Action if Missing |
|---|---|---|
| Lock file (package-lock.json, yarn.lock, pnpm-lock.yaml) | Yes | Warn and run npm install first |
| package.json | Yes | Block upgrade |
| Git clean state | Yes | Block (need clean baseline for revert) |
Workers assume coordinator (ln-820) already verified git state and created backup.
MANDATORY READ: Load shared/references/git_worktree_fallback.md — use ln-821 row.
Read package.json and categorize dependencies for upgrade priority.
| Category | Examples | Priority |
|---|---|---|
| framework | react, vue, angular | 2 (after peer deps) |
| build | vite, webpack, esbuild | 3 |
| ui | @radix-ui/*, tailwindcss | 4 |
| state | @tanstack/react-query, zustand | 5 |
| utils | lodash, date-fns | 6 |
| dev | eslint, prettier, typescript | 7 |
| peer | @types/*, typescript | 1 (first) |
| Manager | Command |
|---|---|
| npm | npm audit --audit-level=high |
| yarn | yarn audit --level high |
| pnpm | pnpm audit --audit-level high |
| Severity | Action |
|---|---|
| Critical | Block upgrade, report |
| High | Warn, continue |
| Moderate/Low | Log only |
| Manager | Command |
|---|---|
| npm | npm outdated --json |
| yarn | yarn outdated --json |
| pnpm | pnpm outdated --json |
MANDATORY READ: Load breaking_changes_patterns.md for full patterns.
| Package | Breaking Version | Key Changes |
|---|---|---|
| react | 18 → 19 | JSX Transform, ref as prop |
| vite | 5 → 6 | ESM only, Node 18+ |
| eslint | 8 → 9 | Flat config required |
| tailwindcss | 3 → 4 | CSS-based config |
| typescript | 5.4 → 5.5+ | Stricter inference |
| Manager | Command |
|---|---|
| npm | npm install <package>@latest --save |
| yarn | yarn add <package>@latest |
| pnpm | pnpm add <package>@latest |
| Situation | Solution |
|---|---|
| ERESOLVE error | npm install --legacy-peer-deps |
| Still fails | npm install --force (last resort) |
| Priority | Tool | When to Use |
|---|---|---|
| 1 | mcp__context7__query-docs | First choice for library docs |
| 2 | mcp__Ref__ref_search_documentation | Official docs and GitHub |
| 3 | WebSearch | Latest info, community solutions |
| Step | Tool | Parameters |
|---|---|---|
| 1. Find library | mcp__context7__resolve-library-id | libraryName: "react", query: "migration guide" |
| 2. Query docs | mcp__context7__query-docs | libraryId: "/facebook/react", query: "react 18 to 19 migration" |
| Action | Tool | Query Example |
|---|---|---|
| Search | mcp__Ref__ref_search_documentation | "react 19 migration guide breaking changes" |
| Read | mcp__Ref__ref_read_url | URL from search results |
Use when Context7/Ref return no results:
"<package> <version> breaking changes migration {current_year}""<package> <error message> fix stackoverflow"Do NOT apply hardcoded migrations. Always fetch current guides via MCP tools.
| Check | Command |
|---|---|
| TypeScript | npm run check or npx tsc --noEmit |
| Build | npm run build |
| Tests | npm test (if available) |
| Field | Description |
|---|---|
| project | Project path |
| packageManager | npm, yarn, or pnpm |
| duration | Total time |
| upgrades.major[] | Breaking changes applied |
| upgrades.minor[] | Feature updates |
| upgrades.patch[] | Bug fixes |
| migrations[] | Applied migrations |
| skipped[] | Already latest |
| buildVerification | PASSED or FAILED |
| warnings[] | Non-blocking issues |
Options:
# Upgrade scope
upgradeType: major # major | minor | patch
# Breaking changes
allowBreaking: true
autoMigrate: true
queryMigrationGuides: true # Use Context7/Ref
# Security
auditLevel: high # none | low | moderate | high | critical
minimumReleaseAge: 14 # days
# Peer dependencies
legacyPeerDeps: false
force: false
# Verification
runBuild: true
runTests: false
runTypeCheck: true
# Rollback
createBackup: true
rollbackOnFailure: true
| Error | Cause | Solution |
|---|---|---|
| ERESOLVE | Peer dep conflict | --legacy-peer-deps |
| ENOENT | Missing lock file | npm install first |
| Build fail | Breaking change | Apply migration via Context7 |
| Type errors | Version mismatch | Update @types/* |
Restore package.json and lock file from git, then run clean install to restore previous state.
npm/yarn/pnpm outdatedVersion: 1.1.0 Last Updated: 2026-01-10
Weekly Installs
77
Repository
GitHub Stars
253
First Seen
Mar 8, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
cursor74
gemini-cli72
github-copilot72
codex72
amp72
cline72
AWS Aurora 数据库连接最佳实践:RDS Proxy 与 Data API 无服务器架构指南
105 周安装
国际化i18n最佳实践:React i18next多语言支持、日期格式化和RTL语言处理
70 周安装
OpenAPI 专家指南:RESTful API 规范、文档与代码生成全解析
110 周安装
用户引导与激活优化指南:提升首次用户体验、缩短价值实现时间
106 周安装
AI音乐生成器 - 使用ElevenLabs API生成自定义音乐,支持器乐人声和详细作曲控制
108 周安装
RSS 代理发现工具 - AI 代理专用 RSS 源 JSON 输出
106 周安装