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.
ln-711-npm-upgrader
Type: L3 Worker
Category: 7XX Project Bootstrap
Parent: ln-710-dependency-upgrader
Upgrades Node.js dependencies using npm, yarn, or pnpm with automatic breaking change detection and migration.
Overview
| Aspect |
Details |
| Input |
Project path, package manager type |
| Output |
Updated package.json, lock file, migration report |
| Supports |
npm, yarn (classic & berry), pnpm |
Workflow
See diagram.html for visual workflow.
Phases: Pre-flight → Analyze → Security Audit → Check Outdated → Identify Breaking → Apply Upgrades → Apply Migrations → Verify Build → Report
Phase 0: Pre-flight Checks
| 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 |
Workers assume coordinator (ln-710) already verified git state and created backup.
Phase 1: Analyze Dependencies
Read package.json and categorize dependencies for upgrade priority.
Dependency Categories
| 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) |
Phase 2: Security Audit
Commands
| Manager |
Command |
| npm |
npm audit --audit-level=high |
| yarn |
yarn audit --level high |
| pnpm |
pnpm audit --audit-level high |
Actions
| Severity |
Action |
| Critical |
Block upgrade, report |
| High |
Warn, continue |
| Moderate/Low |
Log only |
Phase 3: Check Outdated
Commands
| Manager |
Command |
| npm |
npm outdated --json |
| yarn |
yarn outdated --json |
| pnpm |
pnpm outdated --json |
Phase 4: Identify Breaking Changes
Detection
MANDATORY READ: Load breaking_changes_patterns.md for full patterns.
- Compare current vs latest major versions
- Check breaking_changes_patterns.md for known patterns
- Query Context7/Ref for migration guides
Common Breaking Changes
| 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 |
Phase 5: Apply Upgrades
Upgrade Order
- Peer dependencies (TypeScript, @types/*)
- Framework packages (React, Vue core)
- Build tools (Vite, webpack)
- UI libraries (after framework)
- Utilities (lodash, date-fns)
- Dev dependencies (testing, linting)
Commands
| Manager |
Command |
| npm |
npm install <package>@latest --save |
| yarn |
yarn add <package>@latest |
| pnpm |
pnpm add <package>@latest |
Peer Dependency Conflicts
| Situation |
Solution |
| ERESOLVE error |
npm install --legacy-peer-deps |
| Still fails |
npm install --force (last resort) |
MCP Tools for Migration Search
Priority Order (Fallback Strategy)
| 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 |
Context7 Usage
| 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" |
MCP Ref Usage
| 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 |
WebSearch Fallback
Use when Context7/Ref return no results:
"<package> <version> breaking changes migration {current_year}"
"<package> <error message> fix stackoverflow"
Phase 6: Apply Migrations
Process
- Use MCP tools (see section above) to find migration guide
- Apply automated code transforms via Edit tool
- Log manual migration steps for user
Do NOT apply hardcoded migrations. Always fetch current guides via MCP tools.
Phase 7: Verify Build
Commands
| Check |
Command |
| TypeScript |
npm run check or npx tsc --noEmit |
| Build |
npm run build |
| Tests |
npm test (if available) |
On Failure
- Identify failing package from error
- Search Context7/Ref for fix
- If unresolved: rollback package, continue with others
Phase 8: Report Results
Report Schema
| 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 |
Configuration
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 Handling
| 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/* |
Rollback
Restore package.json and lock file from git, then run clean install to restore previous state.
References
Definition of Done
- Lock file and package.json verified present
- Dependencies categorized and prioritized (peer deps first)
- Security audit completed (critical blocks upgrade)
- Outdated packages identified via
npm/yarn/pnpm outdated
- Breaking changes detected via breaking_changes_patterns.md and MCP tools
- Upgrades applied in priority order with rollback on failure
- Build and type checks pass after upgrades
- Report returned with major/minor/patch counts, migrations, and build status
Version: 1.1.0
Last Updated: 2026-01-10
1---2name: ln-711-npm-upgrader3description: Upgrades npm/yarn/pnpm dependencies with breaking change handling4license: MIT5---67> **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.89# ln-711-npm-upgrader1011**Type:** L3 Worker12**Category:** 7XX Project Bootstrap13**Parent:** ln-710-dependency-upgrader1415Upgrades Node.js dependencies using npm, yarn, or pnpm with automatic breaking change detection and migration.1617---1819## Overview2021| Aspect | Details |22|--------|---------|23| **Input** | Project path, package manager type |24| **Output** | Updated package.json, lock file, migration report |25| **Supports** | npm, yarn (classic & berry), pnpm |2627---2829## Workflow3031See [diagram.html](diagram.html) for visual workflow.3233**Phases:** Pre-flight → Analyze → Security Audit → Check Outdated → Identify Breaking → Apply Upgrades → Apply Migrations → Verify Build → Report3435---3637## Phase 0: Pre-flight Checks3839| Check | Required | Action if Missing |40|-------|----------|-------------------|41| Lock file (package-lock.json, yarn.lock, pnpm-lock.yaml) | Yes | Warn and run `npm install` first |42| package.json | Yes | Block upgrade |4344> Workers assume coordinator (ln-710) already verified git state and created backup.4546---4748## Phase 1: Analyze Dependencies4950Read package.json and categorize dependencies for upgrade priority.5152### Dependency Categories5354| Category | Examples | Priority |55|----------|----------|----------|56| framework | react, vue, angular | 2 (after peer deps) |57| build | vite, webpack, esbuild | 3 |58| ui | @radix-ui/*, tailwindcss | 4 |59| state | @tanstack/react-query, zustand | 5 |60| utils | lodash, date-fns | 6 |61| dev | eslint, prettier, typescript | 7 |62| peer | @types/*, typescript | 1 (first) |6364---6566## Phase 2: Security Audit6768### Commands6970| Manager | Command |71|---------|---------|72| npm | `npm audit --audit-level=high` |73| yarn | `yarn audit --level high` |74| pnpm | `pnpm audit --audit-level high` |7576### Actions7778| Severity | Action |79|----------|--------|80| Critical | Block upgrade, report |81| High | Warn, continue |82| Moderate/Low | Log only |8384---8586## Phase 3: Check Outdated8788### Commands8990| Manager | Command |91|---------|---------|92| npm | `npm outdated --json` |93| yarn | `yarn outdated --json` |94| pnpm | `pnpm outdated --json` |9596---9798## Phase 4: Identify Breaking Changes99100### Detection101102**MANDATORY READ:** Load [breaking_changes_patterns.md](../ln-710-dependency-upgrader/references/breaking_changes_patterns.md) for full patterns.1031041. Compare current vs latest major versions1052. Check breaking_changes_patterns.md for known patterns1063. Query Context7/Ref for migration guides107108### Common Breaking Changes109110| Package | Breaking Version | Key Changes |111|---------|------------------|-------------|112| react | 18 → 19 | JSX Transform, ref as prop |113| vite | 5 → 6 | ESM only, Node 18+ |114| eslint | 8 → 9 | Flat config required |115| tailwindcss | 3 → 4 | CSS-based config |116| typescript | 5.4 → 5.5+ | Stricter inference |117118---119120## Phase 5: Apply Upgrades121122### Upgrade Order1231241. **Peer dependencies** (TypeScript, @types/*)1252. **Framework packages** (React, Vue core)1263. **Build tools** (Vite, webpack)1274. **UI libraries** (after framework)1285. **Utilities** (lodash, date-fns)1296. **Dev dependencies** (testing, linting)130131### Commands132133| Manager | Command |134|---------|---------|135| npm | `npm install <package>@latest --save` |136| yarn | `yarn add <package>@latest` |137| pnpm | `pnpm add <package>@latest` |138139### Peer Dependency Conflicts140141| Situation | Solution |142|-----------|----------|143| ERESOLVE error | `npm install --legacy-peer-deps` |144| Still fails | `npm install --force` (last resort) |145146---147148## MCP Tools for Migration Search149150### Priority Order (Fallback Strategy)151152| Priority | Tool | When to Use |153|----------|------|-------------|154| 1 | mcp__context7__query-docs | First choice for library docs |155| 2 | mcp__Ref__ref_search_documentation | Official docs and GitHub |156| 3 | WebSearch | Latest info, community solutions |157158### Context7 Usage159160| Step | Tool | Parameters |161|------|------|------------|162| 1. Find library | mcp__context7__resolve-library-id | libraryName: "react", query: "migration guide" |163| 2. Query docs | mcp__context7__query-docs | libraryId: "/facebook/react", query: "react 18 to 19 migration" |164165### MCP Ref Usage166167| Action | Tool | Query Example |168|--------|------|---------------|169| Search | mcp__Ref__ref_search_documentation | "react 19 migration guide breaking changes" |170| Read | mcp__Ref__ref_read_url | URL from search results |171172### WebSearch Fallback173174Use when Context7/Ref return no results:175- `"<package> <version> breaking changes migration {current_year}"`176- `"<package> <error message> fix stackoverflow"`177178---179180## Phase 6: Apply Migrations181182### Process1831841. Use MCP tools (see section above) to find migration guide1852. Apply automated code transforms via Edit tool1863. Log manual migration steps for user187188> Do NOT apply hardcoded migrations. Always fetch current guides via MCP tools.189190---191192## Phase 7: Verify Build193194### Commands195196| Check | Command |197|-------|---------|198| TypeScript | `npm run check` or `npx tsc --noEmit` |199| Build | `npm run build` |200| Tests | `npm test` (if available) |201202### On Failure2032041. Identify failing package from error2052. Search Context7/Ref for fix2063. If unresolved: rollback package, continue with others207208---209210## Phase 8: Report Results211212### Report Schema213214| Field | Description |215|-------|-------------|216| project | Project path |217| packageManager | npm, yarn, or pnpm |218| duration | Total time |219| upgrades.major[] | Breaking changes applied |220| upgrades.minor[] | Feature updates |221| upgrades.patch[] | Bug fixes |222| migrations[] | Applied migrations |223| skipped[] | Already latest |224| buildVerification | PASSED or FAILED |225| warnings[] | Non-blocking issues |226227---228229## Configuration230231```yaml232Options:233 # Upgrade scope234 upgradeType: major # major | minor | patch235236 # Breaking changes237 allowBreaking: true238 autoMigrate: true239 queryMigrationGuides: true # Use Context7/Ref240241 # Security242 auditLevel: high # none | low | moderate | high | critical243 minimumReleaseAge: 14 # days244245 # Peer dependencies246 legacyPeerDeps: false247 force: false248249 # Verification250 runBuild: true251 runTests: false252 runTypeCheck: true253254 # Rollback255 createBackup: true256 rollbackOnFailure: true257```258259---260261## Error Handling262263| Error | Cause | Solution |264|-------|-------|----------|265| ERESOLVE | Peer dep conflict | --legacy-peer-deps |266| ENOENT | Missing lock file | npm install first |267| Build fail | Breaking change | Apply migration via Context7 |268| Type errors | Version mismatch | Update @types/* |269270### Rollback271272Restore package.json and lock file from git, then run clean install to restore previous state.273274---275276## References277278- [breaking_changes_patterns.md](../ln-710-dependency-upgrader/references/breaking_changes_patterns.md)279- [npm_peer_resolution.md](references/npm_peer_resolution.md)280281---282283## Definition of Done284285- Lock file and package.json verified present286- Dependencies categorized and prioritized (peer deps first)287- Security audit completed (critical blocks upgrade)288- Outdated packages identified via `npm/yarn/pnpm outdated`289- Breaking changes detected via breaking_changes_patterns.md and MCP tools290- Upgrades applied in priority order with rollback on failure291- Build and type checks pass after upgrades292- Report returned with major/minor/patch counts, migrations, and build status293294---295296**Version:** 1.1.0297**Last Updated:** 2026-01-10