Agent skill
update-deps
Update npm packages to latest versions with validation in isolated worktree
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/update-deps
SKILL.md
Update Dependencies: $ARGUMENTS
Updates npm packages to their latest versions with automated testing and validation in an isolated worktree.
Arguments
- Specific packages:
jest @types/jest - All packages:
. - Glob patterns:
@testing-library/* jest*
Process
1. Create Isolated Worktree
WORKTREE_NAME="npm-update-$(date +%Y%m%d-%H%M%S)"
WORKTREE_PATH="../$WORKTREE_NAME"
git worktree add "$WORKTREE_PATH" -b "$WORKTREE_NAME"
cd "$WORKTREE_PATH"
2. Identify Packages
- Parse
$ARGUMENTSto determine packages - For globs, expand against package.json dependencies
- For
., update all packages
3. Check and Update Versions
# Check latest version
npm view <package> version
# Prefer LTS when available
npm view <package> dist-tags
# Update packages
npm install <package>@latest
4. Run Security Audit
npm audit
npm audit fix
5. Validate Updates
Run in order, continue on failure to collect all errors:
npm run build
npm run lint
npm test
6. Handle Results
On success:
- Create commit with version changes
- Use AskUserQuestion to prompt:
- "Yes, merge and clean up (Recommended)"
- "No, I'll review first"
- "Discard changes"
On failure:
- Categorize errors (build/lint/test/audit)
- Provide specific remediation steps
- Offer options: isolate problem, revert specific updates, or abandon
7. Cleanup
git worktree remove "$WORKTREE_PATH"
git branch -D "$WORKTREE_NAME"
Error Categories
| Category | Examples | Remediation |
|---|---|---|
| Build | Type errors, missing deps | Update @types/*, check changelogs |
| Lint | Code style issues | Run npm run lint -- --fix |
| Test | Breaking API changes | Review migration guides |
| Audit | Vulnerabilities | Manual remediation steps |
Edge Cases
- No package.json: Error with clear message
- Not a git repo: Error - worktree requires git
- Package not found: Suggest checking package name
- Glob matches nothing: Warn and list available packages
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?