Dependency Management — Production Patterns
Modern Best Practices (January 2026): Lockfile-first workflows, automated security scanning (Dependabot, Snyk, Socket.dev), semantic versioning, minimal dependencies principle, monorepo workspaces (pnpm, Nx, Turborepo), supply chain security (SBOM, AI BOM, Sigstore), reproducible builds, and AI-generated code validation.
When to Use This Skill
The agent should invoke this skill when a user requests:
- Adding new dependencies to a project
- Updating existing dependencies safely
- Resolving dependency conflicts or version mismatches
- Auditing dependencies for security vulnerabilities
- Understanding lockfile management and reproducible builds
- Setting up monorepo workspaces (pnpm, npm, yarn)
- Managing transitive dependencies and overrides
- Choosing between similar packages (bundle size, maintenance, security)
- Dependency version constraints and semantic versioning
- Dependency security best practices and supply chain security
- Troubleshooting "dependency hell" scenarios
- Package manager configuration and optimization
- Creating reproducible builds across environments
Quick Reference
| 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 |
Decision Tree: Dependency Management
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 → [FAIL] 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 (recommended default)
│ ├─ Shared deps → Root package.json
│ ├─ Package-specific → Package directories
│ └─ Use Nx or Turborepo for task caching
│
└─ Choosing package manager?
├─ New JS project → **pnpm** (recommended default) or **Bun** (often faster; verify ecosystem maturity)
├─ Enterprise monorepo → **pnpm** (mature workspace support)
├─ Speed-focused experimentation → **Bun** (verify ecosystem maturity)
├─ Existing npm project → Migrate to pnpm or stay (check team preference)
├─ Python → **uv** (fast), Poetry (mature), pip+venv (simple)
└─ Data science → **conda** or **uv** (faster environment setup)
Navigation: Core Patterns
Lockfile Management
references/lockfile-management.md
Lockfiles ensure reproducible builds by recording exact versions of all dependencies (direct + transitive). Essential for preventing "works on my machine" issues.
- Golden rules (always commit, never edit manually, regenerate on changes)
- Commands by ecosystem (npm ci, poetry install, cargo build)
- Troubleshooting lockfile conflicts
- CI/CD integration patterns
Semantic Versioning (SemVer)
references/semver-guide.md
Understanding version constraints (^, ~, exact) and how to specify dependency ranges safely.
- SemVer format (MAJOR.MINOR.PATCH)
- Version constraint syntax (caret, tilde, exact)
- Recommended strategies by project type
- Cross-ecosystem version management
Dependency Security Auditing
references/security-scanning.md
Automated security scanning, vulnerability management, and supply chain security best practices.
- Automated tools (Dependabot, Snyk, GitHub Advanced Security)
- Running audits (npm audit, pip-audit, cargo audit)
- CI integration and alert configuration
- Incident response workflows
Dependency Selection
references/dependency-selection-guide.md
Deciding whether to add a new dependency and choosing between similar packages.
- Minimal dependencies principle (best dependency is the one you don't add)
- Evaluation checklist (maintenance, bundle size, security, alternatives)
- Choosing between similar packages (comparison matrix)
- When to reject a dependency
Update Strategies
references/update-strategies.md
Keeping dependencies up to date safely while minimizing breaking changes and security risks.
- Update strategies (continuous, scheduled, security-only)
- Safe update workflow (check outdated, categorize risk, test, deploy)
- Automated update tools (Dependabot, Renovate, npm-check-updates)
- Handling breaking changes and rollback plans
Monorepo Management
references/monorepo-patterns.md
Managing multiple related packages in a single repository with shared dependencies.
- Workspace tools (pnpm, npm, yarn workspaces)
- Monorepo structure and organization
- Build optimization (Nx, Turborepo)
- Versioning and publishing strategies
Transitive Dependencies
references/transitive-dependencies.md
Dealing with dependencies of your dependencies (indirect dependencies).
- Viewing dependency trees (npm ls, pnpm why, pipdeptree)
- Resolving transitive conflicts (overrides, resolutions, constraints)
- Security risks and version conflicts
- Best practices (use sparingly, document, test)
Ecosystem-Specific Guides
references/ecosystem-guides.md
Language and package-manager-specific best practices.
- Node.js (npm, yarn, pnpm comparison and best practices)
- Python (pip, poetry, conda)
- Rust (cargo), Go (go mod), Java (maven, gradle)
- PHP (composer), .NET (nuget)
Anti-Patterns
references/anti-patterns.md
Common mistakes to avoid when managing dependencies.
- Critical anti-patterns (not committing lockfiles, wildcards, ignoring audits)
- Dangerous anti-patterns (never updating, deprecated packages)
- Moderate anti-patterns (overusing overrides, ignoring peer deps)
Container Dependency Patterns
references/container-dependency-patterns.md
Managing dependencies in containerized environments (Docker, OCI).
- Multi-stage builds, layer caching, base image selection
- Runtime vs build dependencies, image scanning, reproducible images
Version Conflict Resolution
references/version-conflict-resolution.md
Systematic approaches to resolving dependency version conflicts.
- Diamond dependency problems, resolution algorithms by ecosystem
- Override strategies, compatibility matrices, migration paths
License Compliance
references/license-compliance.md
Open-source license management and compliance automation.
- License compatibility matrix, copyleft vs permissive, SPDX identifiers
- Automated scanning (FOSSA, license-checker), policy enforcement in CI
Navigation: Templates
Node.js
assets/nodejs/
package-json-template.json - Production-ready package.json with best practices
npmrc-template.txt - Team configuration for npm
pnpm-workspace-template.yaml - Monorepo workspace setup
Python
assets/python/
pyproject-toml-template.toml - Poetry configuration with best practices
Automation
assets/automation/
dependabot-config.yml - GitHub Dependabot configuration
renovate-config.json - Renovate Bot configuration
audit-checklist.md - Security audit workflow
template-supply-chain-security.md - NEW SBOM, provenance, vulnerability management
template-dependency-upgrade-playbook.md - Upgrade batching, rollout, rollback
template-sbom-vuln-triage-checklist.md - SBOM mapping + vulnerability triage
Supply Chain Security
assets/automation/template-supply-chain-security.md — Production-grade dependency security covering SBOM generation (CycloneDX/SPDX), provenance and attestation (SLSA, Sigstore), vulnerability management SLAs, upgrade playbooks, and EU Cyber Resilience Act requirements.
Key rules: generate SBOM per release, sign artifacts (Sigstore/cosign), run audit scans in CI, fix critical CVEs within 24 hours, use npm ci (never npm install) in pipelines, batch non-security updates by risk level.
Related templates:
- assets/automation/template-dependency-upgrade-playbook.md
- assets/automation/template-sbom-vuln-triage-checklist.md
AI-Generated Dependency Risks
WARNING: AI coding agents can introduce vulnerable or non-existent packages at scale (Endor Labs, 2025).
The Problem
AI tools accelerate coding but introduce supply chain risks:
- Hallucinated packages — AI suggests packages that don't exist (typosquatting vectors)
- Vulnerable dependencies — AI recommends outdated or CVE-affected versions
- Unnecessary dependencies — AI over-relies on packages for simple tasks
Best Practices
| Do |
Don't |
| Treat AI-generated code as untrusted third-party input |
Blindly accept AI dependency suggestions |
| Enforce same SAST/SCA scanning for AI-generated code |
Skip security review for "AI-written" code |
| Verify all AI-suggested packages actually exist |
Trust AI to know current package versions |
| Integrate security tools into AI workflows (MCP) |
Allow AI to add dependencies without review |
| Vet MCP servers as part of supply chain |
Use unvetted AI integrations |
Validation Checklist
Before accepting AI-suggested dependencies:
Optional: AI/Automation
Note: AI assists with triage but security decisions need human judgment.
- Automated PR triage — Categorize dependency updates by risk
- Changelog summarization — Summarize breaking changes in updates
- Vulnerability correlation — Link CVEs to affected packages
Bounded Claims
- AI cannot determine business risk acceptance
- Automated fixes require security team review
- Vulnerability severity context needs human validation
Quick Decision Matrix
| 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 JS package manager |
pnpm (fastest, disk-efficient), Bun (7× faster), npm (most compatible) |
| Python environment |
uv (10-100× faster), Poetry (mature), pip+venv (simple), conda (data science) |
Core Principles
1. Always Commit Lockfiles
Lockfiles ensure reproducible builds across environments. Never add them to .gitignore.
Exception: Don't commit Cargo.lock for Rust libraries (only for applications).
2. Use Semantic Versioning
Use caret (^) for most dependencies, exact versions for mission-critical, avoid wildcards (*). See references/semver-guide.md for constraint syntax and strategies.
3. Audit Dependencies Regularly
Run npm audit / pip-audit / cargo audit weekly; fix critical vulnerabilities immediately. See references/security-scanning.md.
4. Minimize Dependencies
The best dependency is the one you don't add. Ask: Can I implement this in <100 LOC? See references/dependency-selection-guide.md.
5. Update Regularly
Update monthly or quarterly in batches — do not update all at once. See references/update-strategies.md.
6. Use Overrides Sparingly
Only override transitive dependencies for security patches or conflicts. Document why in a comment (// CVE-2023-xxxxx fix). See references/transitive-dependencies.md.
Related Skills
For complementary workflows and deeper dives:
dev-api-design - API versioning strategies, dependency injection patterns
dev-git-workflow - Git workflows for managing lockfile conflicts, branching strategies
qa-testing-strategy - Testing strategies for dependency updates, integration testing
software-security-appsec - OWASP Top 10, cryptography standards, authentication patterns
ops-devops-platform - CI/CD pipelines, Docker containerization, DevSecOps, deployment automation
docs-codebase - Documenting dependency choices, ADRs, changelogs
External Resources
See data/sources.json for curated resources:
- Package managers: npm, pnpm, Yarn, pip, Poetry, Cargo, Go modules, Maven, Composer
- Semantic versioning: SemVer spec, version calculators, constraint references
- Security tools: Snyk, Dependabot, GitHub Advanced Security, OWASP Dependency-Check, pip-audit, cargo-audit, Socket.dev, Renovate
- Lockfile management: Official docs for package-lock.json, poetry.lock, Cargo.lock, pnpm-lock.yaml
- Monorepo tools: pnpm workspaces, npm workspaces, Yarn workspaces, Nx, Turborepo, Lerna, Bazel
- Analysis tools: Bundlephobia, npm-check-updates, depcheck, pipdeptree, cargo tree
- Supply chain security: SLSA framework, SBOM (CISA), Sigstore, npm provenance, OpenSSF Scorecard
- Best practices: npm/Poetry/Cargo guides, ACM Queue articles, dependency hell references
- Version management: nvm, pyenv, rustup, asdf
- Learning resources: npm guides, Python Packaging User Guide, Rust Book, Monorepo.tools
Usage Notes
For Codex / Claude Code:
- Use this skill when users need dependency management guidance
- Reference specific resources based on the task (lockfiles, security, updates)
- Provide ecosystem-specific guidance (Node.js, Python, Rust)
- Always recommend security audits and reproducible builds
- Encourage minimal dependencies and regular updates
- Link to templates for common configurations
Best Practices:
- Always commit lockfiles (except Cargo.lock for libraries)
- Use semantic versioning (caret for most deps, exact for critical)
- Audit dependencies weekly (
npm audit, pip-audit, cargo audit)
- Update dependencies monthly or quarterly (not all at once)
- Choose package manager based on project needs (pnpm for speed, Poetry for Python apps)
- Document dependency choices in ADRs (Architecture Decision Records)
Success Criteria: Dependencies are minimal, well-maintained, secure, reproducible across environments, and regularly audited for vulnerabilities.
Trend Awareness Protocol
IMPORTANT: When users ask recommendation questions about package managers, dependency tools, or supply chain security, you MUST use WebSearch to check current trends before answering.
Trigger Conditions
- "What's the best package manager for [ecosystem]?"
- "What should I use for [dependency management/security]?"
- "What's the latest in dependency management?"
- "Current best practices for [npm/pnpm/Poetry]?"
- "Is [tool/approach] still relevant in 2026?"
- "[pnpm] vs [npm] vs [yarn]?"
- "Best dependency security scanner?"
Required Searches
- Search:
"dependency management best practices 2026"
- Search:
"[specific tool] vs alternatives 2026"
- Search:
"supply chain security trends January 2026"
- Search:
"[package manager] features 2026"
What to Report
After searching, provide:
- Current landscape: What dependency tools are popular NOW
- Emerging trends: New package managers, security tools, or patterns gaining traction
- Deprecated/declining: Tools/approaches losing relevance or support
- Recommendation: Based on fresh data, not just static knowledge
Example Topics (verify with fresh search)
- Package managers (pnpm, npm, yarn, Poetry, uv for Python)
- Security scanning (Snyk, Dependabot, Socket.dev)
- Supply chain security (SBOM, Sigstore, SLSA)
- Monorepo tools (Nx, Turborepo, Bazel)
- Lockfile and reproducibility patterns
- Automated dependency updates (Renovate, Dependabot)
Ops Preflight: Dependency and Toolchain Health (for LLM Agents)
Run this before build/test/edit loops to prevent avoidable churn such as next: command not found.
# 1) Runtime + package manager sanity
node -v
npm -v
# 2) Lockfile and install mode
ls -1 package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null
test -d node_modules || npm ci
# 3) Verify framework binaries resolve
npx next --version 2>/dev/null || echo "next missing"
npx eslint --version 2>/dev/null || echo "eslint missing"
# 4) Surface dependency graph issues early
npm ls --depth=0
Remediation Rules
- If binary missing: install from lockfile, do not ad-hoc install random versions.
- If lockfile drift detected: re-install using project standard tool (
npm ci, pnpm install --frozen-lockfile, etc).
- If peer dependency conflict appears, fix root cause before continuing broad edits.
- Cache these checks at session start for long agent runs.
Fact-Checking
- Use web search/web fetch to verify current external facts, versions, pricing, deadlines, regulations, or platform behavior before final answers.
- Prefer primary sources; report source links and dates for volatile information.
- If web access is unavailable, state the limitation and mark guidance as unverified.
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: dev-dependency-management3description: Dependency management across npm, pip, cargo, and maven. Use when managing lockfiles, security scanning, versioning, or monorepo workspaces. Use when this capability is needed.4---56# Dependency Management — Production Patterns78**Modern Best Practices (January 2026)**: Lockfile-first workflows, automated security scanning (Dependabot, Snyk, Socket.dev), semantic versioning, minimal dependencies principle, monorepo workspaces (pnpm, Nx, Turborepo), supply chain security (SBOM, AI BOM, Sigstore), reproducible builds, and AI-generated code validation.910---1112## When to Use This Skill1314The agent should invoke this skill when a user requests:1516- Adding new dependencies to a project17- Updating existing dependencies safely18- Resolving dependency conflicts or version mismatches19- Auditing dependencies for security vulnerabilities20- Understanding lockfile management and reproducible builds21- Setting up monorepo workspaces (pnpm, npm, yarn)22- Managing transitive dependencies and overrides23- Choosing between similar packages (bundle size, maintenance, security)24- Dependency version constraints and semantic versioning25- Dependency security best practices and supply chain security26- Troubleshooting "dependency hell" scenarios27- Package manager configuration and optimization28- Creating reproducible builds across environments2930---3132## Quick Reference3334| Task | Tool/Command | Key Action | When to Use |35|------|--------------|------------|-------------|36| **Install from lockfile** | `npm ci`, `poetry install`, `cargo build` | Clean install, reproducible | CI/CD, production deployments |37| **Add dependency** | `npm install <pkg>`, `poetry add <pkg>` | Updates lockfile automatically | New feature needs library |38| **Update dependencies** | `npm update`, `poetry update`, `cargo update` | Updates within version constraints | Monthly/quarterly maintenance |39| **Check for vulnerabilities** | `npm audit`, `pip-audit`, `cargo audit` | Scans for known CVEs | Before releases, weekly |40| **View dependency tree** | `npm ls`, `pnpm why`, `pipdeptree` | Shows transitive dependencies | Debugging conflicts |41| **Override transitive dep** | `overrides` (npm), `pnpm.overrides` | Force specific version | Security patch, conflict resolution |42| **Monorepo setup** | `pnpm workspaces`, `npm workspaces` | Shared dependencies, cross-linking | Multi-package projects |43| **Check outdated** | `npm outdated`, `poetry show --outdated` | Lists available updates | Planning update sprints |4445---4647## Decision Tree: Dependency Management4849```text50User needs: [Dependency Task]51 ├─ Adding new dependency?52 │ ├─ Check: Do I really need this? (Can implement in <100 LOC?)53 │ ├─ Check: Is it well-maintained? (Last commit <6 months, >10k downloads/week)54 │ ├─ Check: Bundle size impact? (Use Bundlephobia for JS)55 │ ├─ Check: Security risks? (`npm audit`, Snyk)56 │ └─ If all checks pass → Add with `npm install <pkg>` → Commit lockfile57 │58 ├─ Updating dependencies?59 │ ├─ Security vulnerability? → `npm audit fix` → Test → Deploy immediately60 │ ├─ Routine update?61 │ ├─ Patch versions → `npm update` → Safe, do frequently62 │ ├─ Minor/major → Check CHANGELOG → Test in staging → Update gradually63 │ └─ All at once → [FAIL] RISKY → Update in batches instead64 │65 ├─ Dependency conflict?66 │ ├─ Transitive dependency issue?67 │ ├─ View tree: `npm ls <package>`68 │ ├─ Use overrides sparingly: `overrides` in package.json69 │ └─ Document why override is needed70 │ └─ Peer dependency mismatch?71 │ └─ Check version compatibility → Update parent or child72 │73 ├─ Monorepo project?74 │ ├─ Use pnpm workspaces (recommended default)75 │ ├─ Shared deps → Root package.json76 │ ├─ Package-specific → Package directories77 │ └─ Use Nx or Turborepo for task caching78 │79 └─ Choosing package manager?80 ├─ New JS project → **pnpm** (recommended default) or **Bun** (often faster; verify ecosystem maturity)81 ├─ Enterprise monorepo → **pnpm** (mature workspace support)82 ├─ Speed-focused experimentation → **Bun** (verify ecosystem maturity)83 ├─ Existing npm project → Migrate to pnpm or stay (check team preference)84 ├─ Python → **uv** (fast), Poetry (mature), pip+venv (simple)85 └─ Data science → **conda** or **uv** (faster environment setup)86```8788---8990## Navigation: Core Patterns9192### Lockfile Management9394**[`references/lockfile-management.md`](references/lockfile-management.md)**9596Lockfiles ensure reproducible builds by recording exact versions of all dependencies (direct + transitive). Essential for preventing "works on my machine" issues.9798- Golden rules (always commit, never edit manually, regenerate on changes)99- Commands by ecosystem (npm ci, poetry install, cargo build)100- Troubleshooting lockfile conflicts101- CI/CD integration patterns102103### Semantic Versioning (SemVer)104105**[`references/semver-guide.md`](references/semver-guide.md)**106107Understanding version constraints (`^`, `~`, exact) and how to specify dependency ranges safely.108109- SemVer format (MAJOR.MINOR.PATCH)110- Version constraint syntax (caret, tilde, exact)111- Recommended strategies by project type112- Cross-ecosystem version management113114### Dependency Security Auditing115116**[`references/security-scanning.md`](references/security-scanning.md)**117118Automated security scanning, vulnerability management, and supply chain security best practices.119120- Automated tools (Dependabot, Snyk, GitHub Advanced Security)121- Running audits (npm audit, pip-audit, cargo audit)122- CI integration and alert configuration123- Incident response workflows124125### Dependency Selection126127**[`references/dependency-selection-guide.md`](references/dependency-selection-guide.md)**128129Deciding whether to add a new dependency and choosing between similar packages.130131- Minimal dependencies principle (best dependency is the one you don't add)132- Evaluation checklist (maintenance, bundle size, security, alternatives)133- Choosing between similar packages (comparison matrix)134- When to reject a dependency135136### Update Strategies137138**[`references/update-strategies.md`](references/update-strategies.md)**139140Keeping dependencies up to date safely while minimizing breaking changes and security risks.141142- Update strategies (continuous, scheduled, security-only)143- Safe update workflow (check outdated, categorize risk, test, deploy)144- Automated update tools (Dependabot, Renovate, npm-check-updates)145- Handling breaking changes and rollback plans146147### Monorepo Management148149**[`references/monorepo-patterns.md`](references/monorepo-patterns.md)**150151Managing multiple related packages in a single repository with shared dependencies.152153- Workspace tools (pnpm, npm, yarn workspaces)154- Monorepo structure and organization155- Build optimization (Nx, Turborepo)156- Versioning and publishing strategies157158### Transitive Dependencies159160**[`references/transitive-dependencies.md`](references/transitive-dependencies.md)**161162Dealing with dependencies of your dependencies (indirect dependencies).163164- Viewing dependency trees (npm ls, pnpm why, pipdeptree)165- Resolving transitive conflicts (overrides, resolutions, constraints)166- Security risks and version conflicts167- Best practices (use sparingly, document, test)168169### Ecosystem-Specific Guides170171**[`references/ecosystem-guides.md`](references/ecosystem-guides.md)**172173Language and package-manager-specific best practices.174175- Node.js (npm, yarn, pnpm comparison and best practices)176- Python (pip, poetry, conda)177- Rust (cargo), Go (go mod), Java (maven, gradle)178- PHP (composer), .NET (nuget)179180### Anti-Patterns181182**[`references/anti-patterns.md`](references/anti-patterns.md)**183184Common mistakes to avoid when managing dependencies.185186- Critical anti-patterns (not committing lockfiles, wildcards, ignoring audits)187- Dangerous anti-patterns (never updating, deprecated packages)188- Moderate anti-patterns (overusing overrides, ignoring peer deps)189190### Container Dependency Patterns191192**[`references/container-dependency-patterns.md`](references/container-dependency-patterns.md)**193194Managing dependencies in containerized environments (Docker, OCI).195196- Multi-stage builds, layer caching, base image selection197- Runtime vs build dependencies, image scanning, reproducible images198199### Version Conflict Resolution200201**[`references/version-conflict-resolution.md`](references/version-conflict-resolution.md)**202203Systematic approaches to resolving dependency version conflicts.204205- Diamond dependency problems, resolution algorithms by ecosystem206- Override strategies, compatibility matrices, migration paths207208### License Compliance209210**[`references/license-compliance.md`](references/license-compliance.md)**211212Open-source license management and compliance automation.213214- License compatibility matrix, copyleft vs permissive, SPDX identifiers215- Automated scanning (FOSSA, license-checker), policy enforcement in CI216217---218219## Navigation: Templates220221### Node.js222223**[`assets/nodejs/`](assets/nodejs/)**224225- [`package-json-template.json`](assets/nodejs/package-json-template.json) - Production-ready package.json with best practices226- `npmrc-template.txt` - Team configuration for npm227- [`pnpm-workspace-template.yaml`](assets/nodejs/pnpm-workspace-template.yaml) - Monorepo workspace setup228229### Python230231**[`assets/python/`](assets/python/)**232233- [`pyproject-toml-template.toml`](assets/python/pyproject-toml-template.toml) - Poetry configuration with best practices234235### Automation236237**[`assets/automation/`](assets/automation/)**238239- [`dependabot-config.yml`](assets/automation/dependabot-config.yml) - GitHub Dependabot configuration240- [`renovate-config.json`](assets/automation/renovate-config.json) - Renovate Bot configuration241- [`audit-checklist.md`](assets/automation/audit-checklist.md) - Security audit workflow242- **[`template-supply-chain-security.md`](assets/automation/template-supply-chain-security.md)** - **NEW** SBOM, provenance, vulnerability management243- [`template-dependency-upgrade-playbook.md`](assets/automation/template-dependency-upgrade-playbook.md) - Upgrade batching, rollout, rollback244- [`template-sbom-vuln-triage-checklist.md`](assets/automation/template-sbom-vuln-triage-checklist.md) - SBOM mapping + vulnerability triage245246---247248## Supply Chain Security249250**[assets/automation/template-supply-chain-security.md](assets/automation/template-supply-chain-security.md)** — Production-grade dependency security covering SBOM generation (CycloneDX/SPDX), provenance and attestation (SLSA, Sigstore), vulnerability management SLAs, upgrade playbooks, and EU Cyber Resilience Act requirements.251252Key rules: generate SBOM per release, sign artifacts (Sigstore/cosign), run audit scans in CI, fix critical CVEs within 24 hours, use `npm ci` (never `npm install`) in pipelines, batch non-security updates by risk level.253254Related templates:255- [assets/automation/template-dependency-upgrade-playbook.md](assets/automation/template-dependency-upgrade-playbook.md)256- [assets/automation/template-sbom-vuln-triage-checklist.md](assets/automation/template-sbom-vuln-triage-checklist.md)257258---259260## AI-Generated Dependency Risks261262> **WARNING**: AI coding agents can introduce vulnerable or non-existent packages at scale (Endor Labs, 2025).263264### The Problem265266AI tools accelerate coding but introduce supply chain risks:267268- **Hallucinated packages** — AI suggests packages that don't exist (typosquatting vectors)269- **Vulnerable dependencies** — AI recommends outdated or CVE-affected versions270- **Unnecessary dependencies** — AI over-relies on packages for simple tasks271272### Best Practices273274| Do | Don't |275| --- | --- |276| Treat AI-generated code as untrusted third-party input | Blindly accept AI dependency suggestions |277| Enforce same SAST/SCA scanning for AI-generated code | Skip security review for "AI-written" code |278| Verify all AI-suggested packages actually exist | Trust AI to know current package versions |279| Integrate security tools into AI workflows (MCP) | Allow AI to add dependencies without review |280| Vet MCP servers as part of supply chain | Use unvetted AI integrations |281282### Validation Checklist283284Before accepting AI-suggested dependencies:285286- [ ] Package exists on registry (npm, PyPI, crates.io)287- [ ] Package name is spelled correctly (no typosquatting)288- [ ] Version is current and maintained289- [ ] `npm audit` / `pip-audit` shows no vulnerabilities290- [ ] Weekly downloads >1000 (established package)291- [ ] Last commit <6 months (actively maintained)292293---294295## Optional: AI/Automation296297> **Note**: AI assists with triage but security decisions need human judgment.298299- **Automated PR triage** — Categorize dependency updates by risk300- **Changelog summarization** — Summarize breaking changes in updates301- **Vulnerability correlation** — Link CVEs to affected packages302303### Bounded Claims304305- AI cannot determine business risk acceptance306- Automated fixes require security team review307- Vulnerability severity context needs human validation308309---310311## Quick Decision Matrix312313| Scenario | Recommendation |314|----------|----------------|315| Adding new dependency | Check Bundlephobia, npm audit, weekly downloads, last commit |316| Updating dependencies | Use `npm outdated`, update in batches, test in staging |317| Security vulnerability found | Use `npm audit fix`, review CHANGELOG, test, deploy immediately |318| Monorepo setup | Use **pnpm workspaces** or Nx/Turborepo for build caching |319| Transitive conflict | Use `overrides` sparingly, document why, test thoroughly |320| Choosing JS package manager | **pnpm** (fastest, disk-efficient), **Bun** (7× faster), npm (most compatible) |321| Python environment | **uv** (10-100× faster), Poetry (mature), pip+venv (simple), conda (data science) |322323---324325## Core Principles326327### 1. Always Commit Lockfiles328329Lockfiles ensure reproducible builds across environments. Never add them to `.gitignore`.330331**Exception**: Don't commit `Cargo.lock` for Rust libraries (only for applications).332333### 2. Use Semantic Versioning334335Use caret (`^`) for most dependencies, exact versions for mission-critical, avoid wildcards (`*`). See [`references/semver-guide.md`](references/semver-guide.md) for constraint syntax and strategies.336337### 3. Audit Dependencies Regularly338339Run `npm audit` / `pip-audit` / `cargo audit` weekly; fix critical vulnerabilities immediately. See [`references/security-scanning.md`](references/security-scanning.md).340341### 4. Minimize Dependencies342343The best dependency is the one you don't add. Ask: Can I implement this in <100 LOC? See [`references/dependency-selection-guide.md`](references/dependency-selection-guide.md).344345### 5. Update Regularly346347Update monthly or quarterly in batches — do not update all at once. See [`references/update-strategies.md`](references/update-strategies.md).348349### 6. Use Overrides Sparingly350351Only override transitive dependencies for security patches or conflicts. Document why in a comment (`// CVE-2023-xxxxx fix`). See [`references/transitive-dependencies.md`](references/transitive-dependencies.md).352353---354355## Related Skills356357For complementary workflows and deeper dives:358359- [`dev-api-design`](../dev-api-design/SKILL.md) - API versioning strategies, dependency injection patterns360- [`dev-git-workflow`](../dev-git-workflow/SKILL.md) - Git workflows for managing lockfile conflicts, branching strategies361- [`qa-testing-strategy`](../qa-testing-strategy/SKILL.md) - Testing strategies for dependency updates, integration testing362- [`software-security-appsec`](../software-security-appsec/SKILL.md) - OWASP Top 10, cryptography standards, authentication patterns363- [`ops-devops-platform`](../ops-devops-platform/SKILL.md) - CI/CD pipelines, Docker containerization, DevSecOps, deployment automation364- [`docs-codebase`](../docs-codebase/SKILL.md) - Documenting dependency choices, ADRs, changelogs365366---367368## External Resources369370See [`data/sources.json`](data/sources.json) for curated resources:371372- **Package managers**: npm, pnpm, Yarn, pip, Poetry, Cargo, Go modules, Maven, Composer373- **Semantic versioning**: SemVer spec, version calculators, constraint references374- **Security tools**: Snyk, Dependabot, GitHub Advanced Security, OWASP Dependency-Check, pip-audit, cargo-audit, Socket.dev, Renovate375- **Lockfile management**: Official docs for package-lock.json, poetry.lock, Cargo.lock, pnpm-lock.yaml376- **Monorepo tools**: pnpm workspaces, npm workspaces, Yarn workspaces, Nx, Turborepo, Lerna, Bazel377- **Analysis tools**: Bundlephobia, npm-check-updates, depcheck, pipdeptree, cargo tree378- **Supply chain security**: SLSA framework, SBOM (CISA), Sigstore, npm provenance, OpenSSF Scorecard379- **Best practices**: npm/Poetry/Cargo guides, ACM Queue articles, dependency hell references380- **Version management**: nvm, pyenv, rustup, asdf381- **Learning resources**: npm guides, Python Packaging User Guide, Rust Book, Monorepo.tools382383---384385## Usage Notes386387**For Codex / Claude Code:**388389- Use this skill when users need dependency management guidance390- Reference specific resources based on the task (lockfiles, security, updates)391- Provide ecosystem-specific guidance (Node.js, Python, Rust)392- Always recommend security audits and reproducible builds393- Encourage minimal dependencies and regular updates394- Link to templates for common configurations395396**Best Practices:**397398- Always commit lockfiles (except Cargo.lock for libraries)399- Use semantic versioning (caret for most deps, exact for critical)400- Audit dependencies weekly (`npm audit`, `pip-audit`, `cargo audit`)401- Update dependencies monthly or quarterly (not all at once)402- Choose package manager based on project needs (pnpm for speed, Poetry for Python apps)403- Document dependency choices in ADRs (Architecture Decision Records)404405---406407> **Success Criteria:** Dependencies are minimal, well-maintained, secure, reproducible across environments, and regularly audited for vulnerabilities.408409---410411## Trend Awareness Protocol412413**IMPORTANT**: When users ask recommendation questions about package managers, dependency tools, or supply chain security, you MUST use WebSearch to check current trends before answering.414415### Trigger Conditions416417- "What's the best package manager for [ecosystem]?"418- "What should I use for [dependency management/security]?"419- "What's the latest in dependency management?"420- "Current best practices for [npm/pnpm/Poetry]?"421- "Is [tool/approach] still relevant in 2026?"422- "[pnpm] vs [npm] vs [yarn]?"423- "Best dependency security scanner?"424425### Required Searches4264271. Search: `"dependency management best practices 2026"`4282. Search: `"[specific tool] vs alternatives 2026"`4293. Search: `"supply chain security trends January 2026"`4304. Search: `"[package manager] features 2026"`431432### What to Report433434After searching, provide:435436- **Current landscape**: What dependency tools are popular NOW437- **Emerging trends**: New package managers, security tools, or patterns gaining traction438- **Deprecated/declining**: Tools/approaches losing relevance or support439- **Recommendation**: Based on fresh data, not just static knowledge440441### Example Topics (verify with fresh search)442443- Package managers (pnpm, npm, yarn, Poetry, uv for Python)444- Security scanning (Snyk, Dependabot, Socket.dev)445- Supply chain security (SBOM, Sigstore, SLSA)446- Monorepo tools (Nx, Turborepo, Bazel)447- Lockfile and reproducibility patterns448- Automated dependency updates (Renovate, Dependabot)449450## Ops Preflight: Dependency and Toolchain Health (for LLM Agents)451452Run this before build/test/edit loops to prevent avoidable churn such as `next: command not found`.453454```bash455# 1) Runtime + package manager sanity456node -v457npm -v458459# 2) Lockfile and install mode460ls -1 package-lock.json pnpm-lock.yaml yarn.lock 2>/dev/null461test -d node_modules || npm ci462463# 3) Verify framework binaries resolve464npx next --version 2>/dev/null || echo "next missing"465npx eslint --version 2>/dev/null || echo "eslint missing"466467# 4) Surface dependency graph issues early468npm ls --depth=0469```470471### Remediation Rules472473- If binary missing: install from lockfile, do not ad-hoc install random versions.474- If lockfile drift detected: re-install using project standard tool (`npm ci`, `pnpm install --frozen-lockfile`, etc).475- If peer dependency conflict appears, fix root cause before continuing broad edits.476- Cache these checks at session start for long agent runs.477478## Fact-Checking479480- Use web search/web fetch to verify current external facts, versions, pricing, deadlines, regulations, or platform behavior before final answers.481- Prefer primary sources; report source links and dates for volatile information.482- If web access is unavailable, state the limitation and mark guidance as unverified.483484---485> Converted and distributed by [TomeVault](https://tomevault.io/claim/vasilyu1983) — claim your Tome and manage your conversions.486<!-- tomevault:4.0:skill_md:2026-04-11 -->