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)
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.
Related templates:
- assets/automation/template-dependency-upgrade-playbook.md
- assets/automation/template-sbom-vuln-triage-checklist.md
Key Sections
- SBOM Generation — CycloneDX, SPDX formats; CI/CD integration
- AI BOM (Emerging) — Extended SBOM for AI-native systems (models, datasets, training artifacts)
- Provenance & Attestation — SLSA levels, Sigstore signing, npm provenance
- Vulnerability Management — Triage workflow, severity SLAs, scanning tools
- Upgrade Playbooks — Batching strategy, rollback procedures
- Pinning & Reproducibility — Lockfiles, hash pinning, version constraints
- EU Cyber Resilience Act — SBOM requirements effective Dec 2027
Do / Avoid
GOOD: Do
- Generate SBOM for every release
- Sign release artifacts (Sigstore/cosign)
- Run vulnerability scans in CI/CD
- Fix critical vulnerabilities within 24 hours
- Use lockfiles for reproducible builds
- Verify npm package provenance
- Batch non-security updates by risk level
BAD: Avoid
- Publishing without SBOM
- Using unsigned packages in production
- Ignoring vulnerability scanner output
- Updating all dependencies at once
- Using wildcard version ranges (
*, >=)
- Committing without updating lockfile
- Bypassing security gates "just this once"
Anti-Patterns
| Anti-Pattern |
Problem |
Fix |
| No SBOM |
Can't respond to supply chain attacks |
Generate SBOM in CI/CD |
| Unsigned artifacts |
Tampering undetectable |
Sign with Sigstore |
| Floating versions |
Build not reproducible |
Use lockfiles + exact versions |
| All-at-once updates |
Hard to bisect regressions |
Batch by risk level |
| npm install in CI |
Non-deterministic |
Use npm ci |
| No audit gate |
Vulnerabilities ship to prod |
Gate deployments on audit |
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 (*).
{
"dependencies": {
"express": "^4.18.0", // Allows patches and minors
"critical-lib": "1.2.3" // Exact for critical
}
}
3. Audit Dependencies Regularly
Run security audits weekly, fix critical vulnerabilities immediately.
npm audit
npm audit fix
4. Minimize Dependencies
The best dependency is the one you don't add. Ask: Can I implement this in <100 LOC?
5. Update Regularly
Update monthly or quarterly. Don't let technical debt accumulate.
npm outdated
npm update
6. Use Overrides Sparingly
Only override transitive dependencies for security patches or conflicts. Document why.
{
"overrides": {
"axios": "1.6.0" // CVE-2023-xxxxx fix
}
}
Related Skills
For complementary workflows and deeper dives:
dev-api-design - API versioning strategies, dependency injection patterns
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)
1---
2name: dev-dependency-management
3description: 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.
4metadata:
5 source: https://skillmd.com/skills/aibot88/dev-dependency-management
6---
7
8# Dependency Management — Production Patterns
9
10**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.
11
12---
13
14## When to Use This Skill
15
16The agent should invoke this skill when a user requests:
17
18- Adding new dependencies to a project
19- Updating existing dependencies safely
20- Resolving dependency conflicts or version mismatches
21- Auditing dependencies for security vulnerabilities
22- Understanding lockfile management and reproducible builds
23- Setting up monorepo workspaces (pnpm, npm, yarn)
24- Managing transitive dependencies and overrides
25- Choosing between similar packages (bundle size, maintenance, security)
26- Dependency version constraints and semantic versioning
27- Dependency security best practices and supply chain security
28- Troubleshooting "dependency hell" scenarios
29- Package manager configuration and optimization
30- Creating reproducible builds across environments
31
32---
33
34## Quick Reference
35
36| Task | Tool/Command | Key Action | When to Use |
37|------|--------------|------------|-------------|
38| **Install from lockfile** | `npm ci`, `poetry install`, `cargo build` | Clean install, reproducible | CI/CD, production deployments |
39| **Add dependency** | `npm install <pkg>`, `poetry add <pkg>` | Updates lockfile automatically | New feature needs library |
40| **Update dependencies** | `npm update`, `poetry update`, `cargo update` | Updates within version constraints | Monthly/quarterly maintenance |
41| **Check for vulnerabilities** | `npm audit`, `pip-audit`, `cargo audit` | Scans for known CVEs | Before releases, weekly |
42| **View dependency tree** | `npm ls`, `pnpm why`, `pipdeptree` | Shows transitive dependencies | Debugging conflicts |
43| **Override transitive dep** | `overrides` (npm), `pnpm.overrides` | Force specific version | Security patch, conflict resolution |
44| **Monorepo setup** | `pnpm workspaces`, `npm workspaces` | Shared dependencies, cross-linking | Multi-package projects |
45| **Check outdated** | `npm outdated`, `poetry show --outdated` | Lists available updates | Planning update sprints |
46
47---
48
49## Decision Tree: Dependency Management
50
51```text
52User needs: [Dependency Task]
53 ├─ Adding new dependency?
54 │ ├─ Check: Do I really need this? (Can implement in <100 LOC?)
55 │ ├─ Check: Is it well-maintained? (Last commit <6 months, >10k downloads/week)
56 │ ├─ Check: Bundle size impact? (Use Bundlephobia for JS)
57 │ ├─ Check: Security risks? (`npm audit`, Snyk)
58 │ └─ If all checks pass → Add with `npm install <pkg>` → Commit lockfile
59 │
60 ├─ Updating dependencies?
61 │ ├─ Security vulnerability? → `npm audit fix` → Test → Deploy immediately
62 │ ├─ Routine update?
63 │ ├─ Patch versions → `npm update` → Safe, do frequently
64 │ ├─ Minor/major → Check CHANGELOG → Test in staging → Update gradually
65 │ └─ All at once → [FAIL] RISKY → Update in batches instead
66 │
67 ├─ Dependency conflict?
68 │ ├─ Transitive dependency issue?
69 │ ├─ View tree: `npm ls <package>`
70 │ ├─ Use overrides sparingly: `overrides` in package.json
71 │ └─ Document why override is needed
72 │ └─ Peer dependency mismatch?
73 │ └─ Check version compatibility → Update parent or child
74 │
75 ├─ Monorepo project?
76 │ ├─ Use pnpm workspaces (recommended default)
77 │ ├─ Shared deps → Root package.json
78 │ ├─ Package-specific → Package directories
79 │ └─ Use Nx or Turborepo for task caching
80 │
81 └─ Choosing package manager?
82 ├─ New JS project → **pnpm** (recommended default) or **Bun** (often faster; verify ecosystem maturity)
83 ├─ Enterprise monorepo → **pnpm** (mature workspace support)
84 ├─ Speed-focused experimentation → **Bun** (verify ecosystem maturity)
85 ├─ Existing npm project → Migrate to pnpm or stay (check team preference)
86 ├─ Python → **uv** (fast), Poetry (mature), pip+venv (simple)
87 └─ Data science → **conda** or **uv** (faster environment setup)
88```
89
90---
91
92## Navigation: Core Patterns
93
94### Lockfile Management
95
96**[`references/lockfile-management.md`](references/lockfile-management.md)**
97
98Lockfiles ensure reproducible builds by recording exact versions of all dependencies (direct + transitive). Essential for preventing "works on my machine" issues.
99
100- Golden rules (always commit, never edit manually, regenerate on changes)
101- Commands by ecosystem (npm ci, poetry install, cargo build)
102- Troubleshooting lockfile conflicts
103- CI/CD integration patterns
104
105### Semantic Versioning (SemVer)
106
107**[`references/semver-guide.md`](references/semver-guide.md)**
108
109Understanding version constraints (`^`, `~`, exact) and how to specify dependency ranges safely.
110
111- SemVer format (MAJOR.MINOR.PATCH)
112- Version constraint syntax (caret, tilde, exact)
113- Recommended strategies by project type
114- Cross-ecosystem version management
115
116### Dependency Security Auditing
117
118**[`references/security-scanning.md`](references/security-scanning.md)**
119
120Automated security scanning, vulnerability management, and supply chain security best practices.
121
122- Automated tools (Dependabot, Snyk, GitHub Advanced Security)
123- Running audits (npm audit, pip-audit, cargo audit)
124- CI integration and alert configuration
125- Incident response workflows
126
127### Dependency Selection
128
129**[`references/dependency-selection-guide.md`](references/dependency-selection-guide.md)**
130
131Deciding whether to add a new dependency and choosing between similar packages.
132
133- Minimal dependencies principle (best dependency is the one you don't add)
134- Evaluation checklist (maintenance, bundle size, security, alternatives)
135- Choosing between similar packages (comparison matrix)
136- When to reject a dependency
137
138### Update Strategies
139
140**[`references/update-strategies.md`](references/update-strategies.md)**
141
142Keeping dependencies up to date safely while minimizing breaking changes and security risks.
143
144- Update strategies (continuous, scheduled, security-only)
145- Safe update workflow (check outdated, categorize risk, test, deploy)
146- Automated update tools (Dependabot, Renovate, npm-check-updates)
147- Handling breaking changes and rollback plans
148
149### Monorepo Management
150
151**[`references/monorepo-patterns.md`](references/monorepo-patterns.md)**
152
153Managing multiple related packages in a single repository with shared dependencies.
154
155- Workspace tools (pnpm, npm, yarn workspaces)
156- Monorepo structure and organization
157- Build optimization (Nx, Turborepo)
158- Versioning and publishing strategies
159
160### Transitive Dependencies
161
162**[`references/transitive-dependencies.md`](references/transitive-dependencies.md)**
163
164Dealing with dependencies of your dependencies (indirect dependencies).
165
166- Viewing dependency trees (npm ls, pnpm why, pipdeptree)
167- Resolving transitive conflicts (overrides, resolutions, constraints)
168- Security risks and version conflicts
169- Best practices (use sparingly, document, test)
170
171### Ecosystem-Specific Guides
172
173**[`references/ecosystem-guides.md`](references/ecosystem-guides.md)**
174
175Language and package-manager-specific best practices.
176
177- Node.js (npm, yarn, pnpm comparison and best practices)
178- Python (pip, poetry, conda)
179- Rust (cargo), Go (go mod), Java (maven, gradle)
180- PHP (composer), .NET (nuget)
181
182### Anti-Patterns
183
184**[`references/anti-patterns.md`](references/anti-patterns.md)**
185
186Common mistakes to avoid when managing dependencies.
187
188- Critical anti-patterns (not committing lockfiles, wildcards, ignoring audits)
189- Dangerous anti-patterns (never updating, deprecated packages)
190- Moderate anti-patterns (overusing overrides, ignoring peer deps)
191
192---
193
194## Navigation: Templates
195
196### Node.js
197
198**[`assets/nodejs/`](assets/nodejs/)**
199
200- [`package-json-template.json`](assets/nodejs/package-json-template.json) - Production-ready package.json with best practices
201- `npmrc-template.txt` - Team configuration for npm
202- [`pnpm-workspace-template.yaml`](assets/nodejs/pnpm-workspace-template.yaml) - Monorepo workspace setup
203
204### Python
205
206**[`assets/python/`](assets/python/)**
207
208- [`pyproject-toml-template.toml`](assets/python/pyproject-toml-template.toml) - Poetry configuration with best practices
209
210### Automation
211
212**[`assets/automation/`](assets/automation/)**
213
214- [`dependabot-config.yml`](assets/automation/dependabot-config.yml) - GitHub Dependabot configuration
215- [`renovate-config.json`](assets/automation/renovate-config.json) - Renovate Bot configuration
216- [`audit-checklist.md`](assets/automation/audit-checklist.md) - Security audit workflow
217- **[`template-supply-chain-security.md`](assets/automation/template-supply-chain-security.md)** - **NEW** SBOM, provenance, vulnerability management
218- [`template-dependency-upgrade-playbook.md`](assets/automation/template-dependency-upgrade-playbook.md) - Upgrade batching, rollout, rollback
219- [`template-sbom-vuln-triage-checklist.md`](assets/automation/template-sbom-vuln-triage-checklist.md) - SBOM mapping + vulnerability triage
220
221---
222
223## Supply Chain Security
224
225**[assets/automation/template-supply-chain-security.md](assets/automation/template-supply-chain-security.md)** — Production-grade dependency security.
226
227Related templates:
228- [assets/automation/template-dependency-upgrade-playbook.md](assets/automation/template-dependency-upgrade-playbook.md)
229- [assets/automation/template-sbom-vuln-triage-checklist.md](assets/automation/template-sbom-vuln-triage-checklist.md)
230
231### Key Sections
232
233- **SBOM Generation** — CycloneDX, SPDX formats; CI/CD integration
234- **AI BOM (Emerging)** — Extended SBOM for AI-native systems (models, datasets, training artifacts)
235- **Provenance & Attestation** — SLSA levels, Sigstore signing, npm provenance
236- **Vulnerability Management** — Triage workflow, severity SLAs, scanning tools
237- **Upgrade Playbooks** — Batching strategy, rollback procedures
238- **Pinning & Reproducibility** — Lockfiles, hash pinning, version constraints
239- **EU Cyber Resilience Act** — SBOM requirements effective Dec 2027
240
241### Do / Avoid
242
243#### GOOD: Do
244
245- Generate SBOM for every release
246- Sign release artifacts (Sigstore/cosign)
247- Run vulnerability scans in CI/CD
248- Fix critical vulnerabilities within 24 hours
249- Use lockfiles for reproducible builds
250- Verify npm package provenance
251- Batch non-security updates by risk level
252
253#### BAD: Avoid
254
255- Publishing without SBOM
256- Using unsigned packages in production
257- Ignoring vulnerability scanner output
258- Updating all dependencies at once
259- Using wildcard version ranges (`*`, `>=`)
260- Committing without updating lockfile
261- Bypassing security gates "just this once"
262
263### Anti-Patterns
264
265| Anti-Pattern | Problem | Fix |
266|--------------|---------|-----|
267| **No SBOM** | Can't respond to supply chain attacks | Generate SBOM in CI/CD |
268| **Unsigned artifacts** | Tampering undetectable | Sign with Sigstore |
269| **Floating versions** | Build not reproducible | Use lockfiles + exact versions |
270| **All-at-once updates** | Hard to bisect regressions | Batch by risk level |
271| **npm install in CI** | Non-deterministic | Use `npm ci` |
272| **No audit gate** | Vulnerabilities ship to prod | Gate deployments on audit |
273
274---
275
276## AI-Generated Dependency Risks
277
278> **WARNING**: AI coding agents can introduce vulnerable or non-existent packages at scale (Endor Labs, 2025).
279
280### The Problem
281
282AI tools accelerate coding but introduce supply chain risks:
283
284- **Hallucinated packages** — AI suggests packages that don't exist (typosquatting vectors)
285- **Vulnerable dependencies** — AI recommends outdated or CVE-affected versions
286- **Unnecessary dependencies** — AI over-relies on packages for simple tasks
287
288### Best Practices
289
290| Do | Don't |
291| --- | --- |
292| Treat AI-generated code as untrusted third-party input | Blindly accept AI dependency suggestions |
293| Enforce same SAST/SCA scanning for AI-generated code | Skip security review for "AI-written" code |
294| Verify all AI-suggested packages actually exist | Trust AI to know current package versions |
295| Integrate security tools into AI workflows (MCP) | Allow AI to add dependencies without review |
296| Vet MCP servers as part of supply chain | Use unvetted AI integrations |
297
298### Validation Checklist
299
300Before accepting AI-suggested dependencies:
301
302- [ ] Package exists on registry (npm, PyPI, crates.io)
303- [ ] Package name is spelled correctly (no typosquatting)
304- [ ] Version is current and maintained
305- [ ] `npm audit` / `pip-audit` shows no vulnerabilities
306- [ ] Weekly downloads >1000 (established package)
307- [ ] Last commit <6 months (actively maintained)
308
309---
310
311## Optional: AI/Automation
312
313> **Note**: AI assists with triage but security decisions need human judgment.
314
315- **Automated PR triage** — Categorize dependency updates by risk
316- **Changelog summarization** — Summarize breaking changes in updates
317- **Vulnerability correlation** — Link CVEs to affected packages
318
319### Bounded Claims
320
321- AI cannot determine business risk acceptance
322- Automated fixes require security team review
323- Vulnerability severity context needs human validation
324
325---
326
327## Quick Decision Matrix
328
329| Scenario | Recommendation |
330|----------|----------------|
331| Adding new dependency | Check Bundlephobia, npm audit, weekly downloads, last commit |
332| Updating dependencies | Use `npm outdated`, update in batches, test in staging |
333| Security vulnerability found | Use `npm audit fix`, review CHANGELOG, test, deploy immediately |
334| Monorepo setup | Use **pnpm workspaces** or Nx/Turborepo for build caching |
335| Transitive conflict | Use `overrides` sparingly, document why, test thoroughly |
336| Choosing JS package manager | **pnpm** (fastest, disk-efficient), **Bun** (7× faster), npm (most compatible) |
337| Python environment | **uv** (10-100× faster), Poetry (mature), pip+venv (simple), conda (data science) |
338
339---
340
341## Core Principles
342
343### 1. Always Commit Lockfiles
344
345Lockfiles ensure reproducible builds across environments. Never add them to `.gitignore`.
346
347**Exception**: Don't commit `Cargo.lock` for Rust libraries (only for applications).
348
349### 2. Use Semantic Versioning
350
351Use caret (`^`) for most dependencies, exact versions for mission-critical, avoid wildcards (`*`).
352
353```json
354{
355 "dependencies": {
356 "express": "^4.18.0", // Allows patches and minors
357 "critical-lib": "1.2.3" // Exact for critical
358 }
359}
360```
361
362### 3. Audit Dependencies Regularly
363
364Run security audits weekly, fix critical vulnerabilities immediately.
365
366```bash
367npm audit
368npm audit fix
369```
370
371### 4. Minimize Dependencies
372
373The best dependency is the one you don't add. Ask: Can I implement this in <100 LOC?
374
375### 5. Update Regularly
376
377Update monthly or quarterly. Don't let technical debt accumulate.
378
379```bash
380npm outdated
381npm update
382```
383
384### 6. Use Overrides Sparingly
385
386Only override transitive dependencies for security patches or conflicts. Document why.
387
388```json
389{
390 "overrides": {
391 "axios": "1.6.0" // CVE-2023-xxxxx fix
392 }
393}
394```
395
396---
397
398## Related Skills
399
400For complementary workflows and deeper dives:
401
402- [`dev-api-design`](../dev-api-design/SKILL.md) - API versioning strategies, dependency injection patterns
403- [`git-workflow`](../git-workflow/SKILL.md) - Git workflows for managing lockfile conflicts, branching strategies
404- [`qa-testing-strategy`](../qa-testing-strategy/SKILL.md) - Testing strategies for dependency updates, integration testing
405- [`software-security-appsec`](../software-security-appsec/SKILL.md) - OWASP Top 10, cryptography standards, authentication patterns
406- [`ops-devops-platform`](../ops-devops-platform/SKILL.md) - CI/CD pipelines, Docker containerization, DevSecOps, deployment automation
407- [`docs-codebase`](../docs-codebase/SKILL.md) - Documenting dependency choices, ADRs, changelogs
408
409---
410
411## External Resources
412
413See [`data/sources.json`](data/sources.json) for curated resources:
414
415- **Package managers**: npm, pnpm, Yarn, pip, Poetry, Cargo, Go modules, Maven, Composer
416- **Semantic versioning**: SemVer spec, version calculators, constraint references
417- **Security tools**: Snyk, Dependabot, GitHub Advanced Security, OWASP Dependency-Check, pip-audit, cargo-audit, Socket.dev, Renovate
418- **Lockfile management**: Official docs for package-lock.json, poetry.lock, Cargo.lock, pnpm-lock.yaml
419- **Monorepo tools**: pnpm workspaces, npm workspaces, Yarn workspaces, Nx, Turborepo, Lerna, Bazel
420- **Analysis tools**: Bundlephobia, npm-check-updates, depcheck, pipdeptree, cargo tree
421- **Supply chain security**: SLSA framework, SBOM (CISA), Sigstore, npm provenance, OpenSSF Scorecard
422- **Best practices**: npm/Poetry/Cargo guides, ACM Queue articles, dependency hell references
423- **Version management**: nvm, pyenv, rustup, asdf
424- **Learning resources**: npm guides, Python Packaging User Guide, Rust Book, Monorepo.tools
425
426---
427
428## Usage Notes
429
430**For Codex / Claude Code:**
431
432- Use this skill when users need dependency management guidance
433- Reference specific resources based on the task (lockfiles, security, updates)
434- Provide ecosystem-specific guidance (Node.js, Python, Rust)
435- Always recommend security audits and reproducible builds
436- Encourage minimal dependencies and regular updates
437- Link to templates for common configurations
438
439**Best Practices:**
440
441- Always commit lockfiles (except Cargo.lock for libraries)
442- Use semantic versioning (caret for most deps, exact for critical)
443- Audit dependencies weekly (`npm audit`, `pip-audit`, `cargo audit`)
444- Update dependencies monthly or quarterly (not all at once)
445- Choose package manager based on project needs (pnpm for speed, Poetry for Python apps)
446- Document dependency choices in ADRs (Architecture Decision Records)
447
448---
449
450> **Success Criteria:** Dependencies are minimal, well-maintained, secure, reproducible across environments, and regularly audited for vulnerabilities.
451
452---
453
454## Trend Awareness Protocol
455
456**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.
457
458### Trigger Conditions
459
460- "What's the best package manager for [ecosystem]?"
461- "What should I use for [dependency management/security]?"
462- "What's the latest in dependency management?"
463- "Current best practices for [npm/pnpm/Poetry]?"
464- "Is [tool/approach] still relevant in 2026?"
465- "[pnpm] vs [npm] vs [yarn]?"
466- "Best dependency security scanner?"
467
468### Required Searches
469
4701. Search: `"dependency management best practices 2026"`
4712. Search: `"[specific tool] vs alternatives 2026"`
4723. Search: `"supply chain security trends January 2026"`
4734. Search: `"[package manager] features 2026"`
474
475### What to Report
476
477After searching, provide:
478
479- **Current landscape**: What dependency tools are popular NOW
480- **Emerging trends**: New package managers, security tools, or patterns gaining traction
481- **Deprecated/declining**: Tools/approaches losing relevance or support
482- **Recommendation**: Based on fresh data, not just static knowledge
483
484### Example Topics (verify with fresh search)
485
486- Package managers (pnpm, npm, yarn, Poetry, uv for Python)
487- Security scanning (Snyk, Dependabot, Socket.dev)
488- Supply chain security (SBOM, Sigstore, SLSA)
489- Monorepo tools (Nx, Turborepo, Bazel)
490- Lockfile and reproducibility patterns
491- Automated dependency updates (Renovate, Dependabot)