dep-update

Automate npm audit and dependency updates with backup branches and validation tests.

1|Updated Apr 6, 2026
One-click install
npx skills add https://github.com/zhu637882-stack/jiaoyi --skill dep-update
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dep-update
Source: https://github.com/zhu637882-stack/jiaoyi/tree/main/qoder-config-backup/skills/dep-update
Command: npx skills add https://github.com/zhu637882-stack/jiaoyi --skill dep-update

SYSTEM DOCUMENTATION & REQUIREMENTS

漏洞扫描

# 扫描安全漏洞
npm audit
pnpm audit

# 查看详细报告
npm audit --audit-level=moderate

更新策略

分级更新(推荐顺序)

# 1. Patch 更新(安全修复)
npm update --save

# 2. Minor 更新(向下兼容功能)
npx npm-check-updates --target minor -u
npm install

# 3. Major 更新(谨慎操作,可能不兼容)
npx npm-check-updates --target major
# 手动检查每个 major 更新的变更日志后再更新

安全更新流程

1. 创建备份分支

git checkout -b deps/update-$(date +%Y%m%d)

2. 执行更新

# 查看可更新项
npx npm-check-updates

# 交互式选择更新
npx npm-check-updates -i

# 安装更新
npm install

3. 验证测试

# 类型检查
npx tsc --noEmit

# 编译验证
npm run build

# 运行测试
npm test

Monorepo 多包更新

# pnpm workspace
pnpm -r update

# 更新特定包
pnpm --filter <package-name> update <dependency>

# 递归审计
pnpm audit --recursive

更新报告模板

## 依赖更新报告

### 更新时间
2024-XX-XX

### 更新内容
| 包名 | 旧版本 | 新版本 | 类型 |
|------|--------|--------|------|
| pkg-a | 1.0.0 | 1.0.1 | patch |
| pkg-b | 2.0.0 | 2.1.0 | minor |

### 风险评估
- **低风险**: patch 更新,仅修复bug
- **中风险**: minor 更新,新增功能,需测试

### 验证结果
- [ ] 类型检查通过
- [ ] 编译成功
- [ ] 测试通过

Frequently Asked Questions about dep-update

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate secure dependency updates for a Node.js project?

Automate secure dependency updates by running npm audit, applying patch, minor, and major updates sequentially, creating a backup branch, and running type checks, builds, and tests to validate changes.

What is the recommended order for applying npm dependency updates?

The recommended dependency update order applies patch updates first for security fixes, then minor updates for backward-compatible features, and finally major updates manually after checking changelogs.

Can I update dependencies in a pnpm monorepo with multiple packages?

You can update dependencies in a pnpm monorepo by running recursive updates with pnpm -r update, updating specific packages with the filter flag, and performing a recursive audit.

What's the best way to validate a project after updating npm dependencies?

Validate updated npm dependencies by running TypeScript type checks with tsc --noEmit, verifying the build process with npm run build, and executing the test suite via npm test.

Does applying major dependency updates require special precautions?

Major dependency updates require special precautions because they may introduce breaking changes, meaning you must manually check each package's changelog before updating and installing.

Why create a backup branch before running npm audit and dependency updates?

Create a backup branch before dependency updates to preserve a stable git state, allowing you to easily revert changes if type checks, builds, or tests fail after installing new package versions.