
Dependency Management
- 425 installs
- 305 repo stars
- Updated March 4, 2026
- aj-geddes/useful-ai-prompts
dependency-management is an agent skill that standardizes adding, upgrading, pinning, auditing, and removing third-party libraries so developers maintaining multi-service codebases can avoid broken builds, license confli
About
dependency-management is an aj-geddes/useful-ai-prompts agent skill for comprehensive dependency management across JavaScript, Python, Ruby, Java, and related ecosystems. It documents npm init, npm install, npm ci, npm audit, npm outdated, semantic versioning, lock files such as package-lock.json and Gemfile.lock, peer dependency rules, monorepo strategies, and CI/CD best practices through ten reference guides in the references directory. Quick-start commands show exact-version installs, dev dependency separation, audit fix workflows, and dependency tree inspection with npm list. Best-practice sections distinguish committing lock files, using npm ci in pipelines, and avoiding wildcard version ranges in production. Developers reach for dependency-management when onboarding a service, resolving version conflicts, auditing CVEs, or standardizing how teams add packages—not when writing feature code unrelated to package manifests.
- Version pinning and upgrade strategies
- Transitive dependency risk review
- License and vulnerability checks
- Lockfile and reproducible installs
- Monorepo and multi-runtime coordination
Dependency Management by the numbers
- 425 all-time installs (skills.sh)
- Ranked #441 of 2,715 Automation & Workflows skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill dependency-managementAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 425 |
|---|---|
| repo stars | ★ 305 |
| Last updated | March 4, 2026 |
| Repository | aj-geddes/useful-ai-prompts ↗ |
How do you safely upgrade npm dependencies?
Standardize how teams add, upgrade, pin, audit, and remove third-party libraries without breaking builds, licenses, or security posture across services.
Who is it for?
Backend and full-stack developers standardizing npm, pip, or Maven dependency workflows across services with lock files and CI audit gates.
Skip if: Teams with no third-party packages or developers seeking application feature implementation rather than package manifest and supply-chain hygiene.
When should I use this skill?
User adds or upgrades libraries, resolves dependency conflicts, audits CVEs, manages lock files, or asks about SemVer pinning across services.
What you get
Updated lock files, resolved version conflicts, npm audit remediation plan, and documented SemVer pinning policy across services.
- Updated lock files
- Audit remediation plan
- SemVer pinning policy
By the numbers
- Bundles 10 reference guides in the references directory
- Documents npm ci, npm audit, npm outdated, and npm list workflows
- Spans JavaScript, Python, Ruby, and Java dependency ecosystems
Files
Dependency Management
Table of Contents
Overview
Comprehensive dependency management across JavaScript/Node.js, Python, Ruby, Java, and other ecosystems. Covers version control, conflict resolution, security auditing, and best practices for maintaining healthy dependencies.
When to Use
- Installing or updating project dependencies
- Resolving version conflicts
- Auditing security vulnerabilities
- Managing lock files (package-lock.json, Gemfile.lock, etc.)
- Implementing semantic versioning
- Setting up monorepo dependencies
- Optimizing dependency trees
- Managing peer dependencies
Quick Start
Minimal working example:
# Initialize project
npm init -y
# Install dependencies
npm install express
npm install --save-dev jest
npm install --save-exact lodash # Exact version
# Update dependencies
npm update
npm outdated # Check for outdated packages
# Audit security
npm audit
npm audit fix
# Clean install from lock file
npm ci # Use in CI/CD
# View dependency tree
npm list
npm list --depth=0 # Top-level onlyReference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Package Manager Basics | Package Manager Basics |
| Semantic Versioning (SemVer) | Semantic Versioning (SemVer) |
| Dependency Lock Files | Dependency Lock Files |
| Resolving Dependency Conflicts | Resolving Dependency Conflicts |
| Security Vulnerability Management | Security Vulnerability Management |
| Monorepo Dependency Management | Monorepo Dependency Management |
| Peer Dependencies | Peer Dependencies |
| Performance Optimization | Performance Optimization |
| CI/CD Best Practices | CI/CD Best Practices |
| Dependency Update Strategies | Dependency Update Strategies |
Best Practices
✅ DO
- Commit lock files to version control
- Use
npm cior equivalent in CI/CD pipelines - Regular dependency audits (weekly/monthly)
- Keep dependencies up-to-date (automate with Dependabot)
- Use exact versions for critical dependencies
- Document why specific versions are pinned
- Test after updating dependencies
- Use semantic versioning correctly
- Minimize dependency count
- Review dependency licenses
❌ DON'T
- Manually edit lock files
- Mix package managers (npm + yarn in same project)
- Use
npm installin CI/CD (usenpm ci) - Ignore security vulnerabilities
- Use wildcards (\*) for versions
- Install packages globally when local install is possible
- Commit node_modules to git
- Use
latesttag in production - Blindly run
npm audit fix - Install unnecessary dependencies
CI/CD Best Practices
CI/CD Best Practices
# .github/workflows/ci.yml
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Cache dependencies
- uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
# Use ci command (faster, more reliable)
- run: npm ci
# Security audit
- run: npm audit --audit-level=high
# Check for outdated dependencies
- run: npm outdated || true
- run: npm testDependency Lock Files
Dependency Lock Files
package-lock.json (npm)
{
"name": "my-app",
"version": "1.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"node_modules/express": {
"version": "4.18.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz",
"integrity": "sha512-...",
"dependencies": {
"body-parser": "1.20.1"
}
}
}
}Lock File Rules:
- ✅ Always commit lock files to version control
- ✅ Use
npm ciin CI/CD (faster, more reliable) - ✅ Regenerate if corrupted: delete and run
npm install - ❌ Never manually edit lock files
- ❌ Don't mix package managers (npm + yarn)
poetry.lock (Python)
[[package]]
name = "requests"
version = "2.28.1"
description = "HTTP library"
category = "main"
optional = false
python-versions = ">=3.7"
[package.dependencies]
certifi = ">=2017.4.17"
charset-normalizer = ">=2,<3"Dependency Update Strategies
Dependency Update Strategies
Automated Updates (Dependabot)
# .github/dependabot.yml
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
groups:
dev-dependencies:
dependency-type: "development"
ignore:
- dependency-name: "react"
versions: ["17.x"]Manual Update Strategy
# Step 1: Check outdated
npm outdated
# Step 2: Update dev dependencies first
npm update --save-dev
# Step 3: Test thoroughly
npm test
# Step 4: Update production deps (one by one for major updates)
npm update express
# Step 5: Review changelog
npm view express versions
npm view express@latestMonorepo Dependency Management
Monorepo Dependency Management
Workspace Structure (npm/yarn/pnpm)
// package.json (root)
{
"name": "my-monorepo",
"private": true,
"workspaces": ["packages/*", "apps/*"]
}# Install all dependencies
npm install
# Add dependency to specific workspace
npm install lodash --workspace=@myorg/package-a
# Run script in workspace
npm run test --workspace=@myorg/package-a
# Run script in all workspaces
npm run test --workspacesLerna Example
# Initialize lerna
npx lerna init
# Bootstrap (install + link)
lerna bootstrap
# Add dependency to all packages
lerna add lodash
# Version and publish
lerna version
lerna publishPackage Manager Basics
Package Manager Basics
Node.js / npm/yarn/pnpm
# Initialize project
npm init -y
# Install dependencies
npm install express
npm install --save-dev jest
npm install --save-exact lodash # Exact version
# Update dependencies
npm update
npm outdated # Check for outdated packages
# Audit security
npm audit
npm audit fix
# Clean install from lock file
npm ci # Use in CI/CD
# View dependency tree
npm list
npm list --depth=0 # Top-level onlyPython / pip/poetry
# Using pip
pip install requests
pip install -r requirements.txt
pip freeze > requirements.txt
# Using poetry (recommended)
poetry init
poetry add requests
poetry add --dev pytest
poetry add "django>=3.2,<4.0"
poetry update
poetry show --tree
poetry check # Verify lock fileRuby / Bundler
# Initialize
bundle init
# Install
bundle install
bundle update gem_name
# Audit
bundle audit check --update
# View dependencies
bundle list
bundle viz # Generate dependency graphPeer Dependencies
Peer Dependencies
// library package.json
{
"name": "my-react-library",
"peerDependencies": {
"react": ">=16.8.0",
"react-dom": ">=16.8.0"
},
"peerDependenciesMeta": {
"react-dom": {
"optional": true // Makes peer dependency optional
}
}
}When to Use Peer Dependencies:
- Plugin architecture (webpack plugins, babel plugins)
- React/Vue component libraries
- Framework extensions
- Prevents multiple versions of same package
Performance Optimization
Performance Optimization
Reduce Bundle Size
# Analyze bundle size
npm install -g bundle-buddy
npm install --save-dev webpack-bundle-analyzer
# Use production build
npm install --production
# Prune unused dependencies
npm prune
# Find duplicate packages
npm dedupe
npx yarn-deduplicate # For yarnpackage.json Optimization
{
"dependencies": {
// ❌ Don't install entire lodash
"lodash": "^4.17.21",
// ✅ Install only what you need
"lodash.debounce": "^4.0.8",
"lodash.throttle": "^4.1.1"
}
}Resolving Dependency Conflicts
Resolving Dependency Conflicts
Scenario: Version Conflict
# Problem: Two packages require different versions
# package-a requires lodash@^4.17.0
# package-b requires lodash@^3.10.0
# Solution 1: Check if newer versions are compatible
npm update lodash
# Solution 2: Use resolutions (yarn/package.json)
{
"resolutions": {
"lodash": "^4.17.21"
}
}
# Solution 3: Use overrides (npm 8.3+)
{
"overrides": {
"lodash": "^4.17.21"
}
}
# Solution 4: Fork and patch
npm install patch-package
npx patch-package some-packagePython Conflict Resolution
# Find conflicts
pip check
# Using pip-tools for constraint resolution
pip install pip-tools
pip-compile requirements.in # Generates locked requirements.txt
# Poetry automatically resolves conflicts
poetry add package-a package-b # Will find compatible versionsSecurity Vulnerability Management
Security Vulnerability Management
npm Security Audit
# Audit current dependencies
npm audit
# Show detailed report
npm audit --json
# Fix automatically (may introduce breaking changes)
npm audit fix
# Fix only non-breaking changes
npm audit fix --production --audit-level=moderate
# Audit in CI/CD
npm audit --audit-level=high # Fail if high vulnerabilitiesUsing Snyk
# Install Snyk CLI
npm install -g snyk
# Authenticate
snyk auth
# Test for vulnerabilities
snyk test
# Monitor project
snyk monitor
# Fix vulnerabilities interactively
snyk wizardPython Security
# Using safety
pip install safety
safety check
safety check --json
# Using pip-audit (official tool)
pip install pip-audit
pip-auditSemantic Versioning (SemVer)
Semantic Versioning (SemVer)
Format: MAJOR.MINOR.PATCH (e.g., 2.4.1)
// package.json version ranges
{
"dependencies": {
"exact": "1.2.3", // Exactly 1.2.3
"patch": "~1.2.3", // >=1.2.3 <1.3.0
"minor": "^1.2.3", // >=1.2.3 <2.0.0
"major": "*", // Any version (avoid!)
"range": ">=1.2.3 <2.0.0", // Explicit range
"latest": "latest" // Always latest (dangerous!)
}
}Best Practices:
^for libraries: allows backward-compatible updates~for applications: more conservative, patch updates only- Exact versions for critical dependencies
- Lock files for reproducible builds
#!/bin/bash
# scaffold-tests.sh - Generate test file scaffolding
# Usage: ./scaffold-tests.sh <source_file> [--framework jest|pytest|mocha]
set -euo pipefail
SOURCE_FILE="${{1:?Usage: $0 <source_file> [--framework jest|pytest|mocha]}}"
FRAMEWORK="${{2:-jest}}"
echo "Scaffolding tests for: $SOURCE_FILE (framework: $FRAMEWORK)"
# TODO: Implement test scaffolding logic
# - Parse source file for exported functions/classes
# - Generate test stubs for each export
# - Include setup/teardown boilerplate
# - Add common assertion patterns
echo "Test scaffolding complete."
// Test Template
// TODO: Customize for your testing framework and project
describe('ModuleName', () => {
// Setup
beforeEach(() => {
// TODO: Add test setup
});
afterEach(() => {
// TODO: Add cleanup
});
describe('functionName', () => {
it('should handle the happy path', () => {
// TODO: Add assertion
});
it('should handle edge cases', () => {
// TODO: Add edge case tests
});
it('should handle errors gracefully', () => {
// TODO: Add error handling tests
});
});
});
Related skills
How it compares
Use dependency-management for cross-ecosystem package hygiene and lock-file policy; use language-specific scaffold skills when bootstrapping new application code rather than curating manifests.
FAQ
Which package managers does dependency-management cover?
The dependency-management skill addresses JavaScript and Node.js npm workflows plus Python, Ruby, and Java ecosystems. Its quick start centers npm commands such as install, ci, audit, and outdated, with reference guides for lock files and monorepo patterns.
Should CI pipelines use npm install or npm ci?
The dependency-management skill recommends npm ci or equivalent clean installs in CI/CD pipelines rather than npm install. It also advises committing lock files to version control and running regular npm audit checks on a weekly or monthly cadence.
How many reference guides ship with dependency-management?
The dependency-management skill links ten reference guides covering package manager basics, SemVer, lock files, conflict resolution, security vulnerability management, monorepos, peer dependencies, performance, CI/CD, and update strategies under its references directory.