// Package and dependency management patterns across ecosystems (npm, pip, cargo, maven). Covers lockfiles, semantic versioning, dependency security scanning, update strategies, monorepo workspaces, transitive dependencies, and avoiding dependency hell.
| name | dev-dependency-management |
| description | Package and dependency management patterns across ecosystems (npm, pip, cargo, maven). Covers lockfiles, semantic versioning, dependency security scanning, update strategies, monorepo workspaces, transitive dependencies, and avoiding dependency hell. |
Modern Best Practices (2025): Lockfile-first workflows, automated security scanning (Dependabot, Snyk), semantic versioning, minimal dependencies principle, monorepo workspaces (pnpm, Nx), supply chain security (SBOM, signatures), and reproducible builds.
Claude should invoke this skill when a user requests:
| Task | Tool/Command | Key Action | When to Use |
|---|---|---|---|
| Install from lockfile | npm ci, poetry install, cargo build | Clean install, reproducible | CI/CD, production deployments |
| Add dependency | npm install <pkg>, poetry add <pkg> | Updates lockfile automatically | New feature needs library |
| Update dependencies | npm update, poetry update, cargo update | Updates within version constraints | Monthly/quarterly maintenance |
| Check for vulnerabilities | npm audit, pip-audit, cargo audit | Scans for known CVEs | Before releases, weekly |
| View dependency tree | npm ls, pnpm why, pipdeptree | Shows transitive dependencies | Debugging conflicts |
| Override transitive dep | overrides (npm), pnpm.overrides | Force specific version | Security patch, conflict resolution |
| Monorepo setup | pnpm workspaces, npm workspaces | Shared dependencies, cross-linking | Multi-package projects |
| Check outdated | npm outdated, poetry show --outdated | Lists available updates | Planning update sprints |
User needs: [Dependency Task]
ââ Adding new dependency?
â ââ Check: Do I really need this? (Can implement in <100 LOC?)
â ââ Check: Is it well-maintained? (Last commit <6 months, >10k downloads/week)
â ââ Check: Bundle size impact? (Use Bundlephobia for JS)
â ââ Check: Security risks? (`npm audit`, Snyk)
â ââ If all checks pass â Add with `npm install <pkg>` â Commit lockfile
â
ââ Updating dependencies?
â ââ Security vulnerability? â `npm audit fix` â Test â Deploy immediately
â ââ Routine update?
â ââ Patch versions â `npm update` â Safe, do frequently
â ââ Minor/major â Check CHANGELOG â Test in staging â Update gradually
â ââ All at once â â RISKY â Update in batches instead
â
ââ Dependency conflict?
â ââ Transitive dependency issue?
â ââ View tree: `npm ls <package>`
â ââ Use overrides sparingly: `overrides` in package.json
â ââ Document why override is needed
â ââ Peer dependency mismatch?
â ââ Check version compatibility â Update parent or child
â
ââ Monorepo project?
â ââ Use pnpm workspaces (fastest, best)
â ââ Shared deps â Root package.json
â ââ Package-specific â Package directories
â ââ Use Nx or Turborepo for task caching
â
ââ Choosing package manager?
ââ New project â **pnpm** (3x faster, 1/3 disk space)
ââ Existing npm project â Migrate or stay (check team preference)
ââ Python â **Poetry** (apps), pip+venv (simple)
ââ Data science â **conda** (environment management)
resources/lockfile-management.md
Lockfiles ensure reproducible builds by recording exact versions of all dependencies (direct + transitive). Essential for preventing "works on my machine" issues.
Understanding version constraints (^, ~, exact) and how to specify dependency ranges safely.
resources/security-scanning.md
Automated security scanning, vulnerability management, and supply chain security best practices.
resources/dependency-selection-guide.md
Deciding whether to add a new dependency and choosing between similar packages.
resources/update-strategies.md
Keeping dependencies up to date safely while minimizing breaking changes and security risks.
resources/monorepo-patterns.md
Managing multiple related packages in a single repository with shared dependencies.
resources/transitive-dependencies.md
Dealing with dependencies of your dependencies (indirect dependencies).
Language and package-manager-specific best practices.
Common mistakes to avoid when managing dependencies.
package-json-template.json - Production-ready package.json with best practicesnpmrc-template.txt - Team configuration for npmpnpm-workspace-template.yaml - Monorepo workspace setuppyproject-toml-template.toml - Poetry configuration with best practicesdependabot-config.yml - GitHub Dependabot configurationrenovate-config.json - Renovate Bot configurationaudit-checklist.md - Security audit workflow| Scenario | Recommendation |
|---|---|
| Adding new dependency | Check Bundlephobia, npm audit, weekly downloads, last commit |
| Updating dependencies | Use npm outdated, update in batches, test in staging |
| Security vulnerability found | Use npm audit fix, review CHANGELOG, test, deploy immediately |
| Monorepo setup | Use pnpm workspaces or Nx/Turborepo for build caching |
| Transitive conflict | Use overrides sparingly, document why, test thoroughly |
| Choosing package manager | pnpm (fastest), npm (most compatible), yarn (good middle) |
| Python environment | Poetry (apps), pip+venv (simple), conda (data science) |
Lockfiles ensure reproducible builds across environments. Never add them to .gitignore.
Exception: Don't commit Cargo.lock for Rust libraries (only for applications).
Use caret (^) for most dependencies, exact versions for mission-critical, avoid wildcards (*).
{
"dependencies": {
"express": "^4.18.0", // Allows patches and minors
"critical-lib": "1.2.3" // Exact for critical
}
}
Run security audits weekly, fix critical vulnerabilities immediately.
npm audit
npm audit fix
The best dependency is the one you don't add. Ask: Can I implement this in <100 LOC?
Update monthly or quarterly. Don't let technical debt accumulate.
npm outdated
npm update
Only override transitive dependencies for security patches or conflicts. Document why.
{
"overrides": {
"axios": "1.6.0" // CVE-2023-xxxxx fix
}
}
For complementary workflows and deeper dives:
dev-api-design - API versioning strategies, dependency injection patternsgit-workflow - Git workflows for managing lockfile conflicts, branching strategiestesting-automation - Testing strategies for dependency updates, integration testingsoftware-security-appsec - OWASP Top 10, cryptography standards, authentication patternsops-devops-platform - CI/CD pipelines, Docker containerization, DevSecOps, deployment automationdocs-technical-writing - Documenting dependency choices, ADRs, changelogsSee data/sources.json for 82 curated resources:
For Claude:
Best Practices:
npm audit, pip-audit, cargo audit)Success Criteria: Dependencies are minimal, well-maintained, secure, reproducible across environments, and regularly audited for vulnerabilities.