| name | dependency-management |
| description | 依存関係管理ガイド。Swift Package Manager、CocoaPods、npm、pip等のパッケージマネージャー運用、バージョン管理、セキュリティアップデート、ライセンス管理など、依存関係の効率的な管理方法。 |
| status | high |
| completion | 100% |
| guides | 3 |
Dependency Management Skill
Status
🟢 High (100% completion, 3/3 comprehensive guides)
Overview
依存関係管理は、現代のソフトウェア開発において最も重要な要素の一つです。適切な依存関係管理により、セキュリティリスクの最小化、予測可能なビルド、効率的なメンテナンスが実現します。
Statistics:
- 平均的なNode.jsプロジェクト: 1,200+ の依存関係
- セキュリティ脆弱性の70%: サードパーティ依存関係から発生
- 適切な依存関係管理により、年間$500K-$5Mのコスト削減が可能
📚 公式ドキュメント・参考リソース
このガイドで学べること: パッケージマネージャーの選定、バージョン管理戦略、セキュリティ脆弱性対応、自動化設定
公式で確認すべきこと: 最新のパッケージバージョン、セキュリティアップデート、新機能、非推奨機能
主要な公式ドキュメント
関連リソース
What This Skill Covers
1. Comprehensive Dependency Management
- Package manager comparison and selection (npm, yarn, pnpm, Poetry, SPM, CocoaPods)
- Lock file strategies and best practices
- Semantic Versioning deep dive
- Dependency resolution algorithms
- Monorepo dependency management
- Private package registries
- Dependency auditing workflows
- License compliance
2. Security & Vulnerability Management
- Understanding security vulnerabilities (CVE, CVSS)
- Vulnerability scanning tools (npm audit, Snyk, Dependabot, OWASP)
- Automated security updates
- Dependency pinning strategies
- Supply chain attack prevention
- SBOM (Software Bill of Materials)
- Security policies and workflows
- Incident response procedures
- Real-world security case studies
3. Dependency Optimization & Maintenance
- Bundle size optimization techniques
- Tree shaking and dead code elimination
- Dependency update strategies
- Breaking change management
- Automated dependency updates (Renovate, Dependabot)
- Deprecation handling
- Technical debt management
- Migration guides for major updates
- Performance monitoring
Quick Start
Daily Tasks (Automated)
npm audit
snyk test
Weekly Tasks
npm update
npm outdated
npx depcheck
Monthly Tasks
npm update --save
npm audit --json > reports/audit.json
npx @cyclonedx/cyclonedx-npm --output-file sbom.json
npx license-checker --failOn "GPL;AGPL"
Quarterly Tasks
npm outdated
Comprehensive Guides
38,206 characters - Complete guide covering:
- Package manager deep dive (npm, yarn, pnpm, SPM, CocoaPods, Poetry, Go)
- Lock file strategies
- Semantic Versioning mastery
- Dependency resolution algorithms
- Monorepo dependency management
- Private package registries
- Dependency auditing
- License compliance
- Real-world case studies (left-pad, event-stream, etc.)
47,074 characters - Security-focused guide covering:
- Understanding security vulnerabilities (RCE, XSS, Prototype Pollution, etc.)
- CVE scoring system (CVSS)
- Vulnerability scanning tools (npm audit, Snyk, GitHub Dependabot, OWASP)
- Automated security updates
- Dependency pinning strategies
- Supply chain attack prevention
- SBOM generation and management
- Security policies and workflows
- Incident response playbooks
- Real-world security case studies (Log4Shell, event-stream, colors/faker, ua-parser-js)
39,758 characters - Optimization guide covering:
- Bundle size optimization (webpack-bundle-analyzer, code splitting)
- Tree shaking and dead code elimination
- Dependency update strategies
- Breaking change management
- Automated dependency updates (Renovate advanced configuration)
- Deprecation handling and migration
- Technical debt management
- Migration guides (React 17→18, Next.js 13→14, Webpack 4→5)
- Performance monitoring
Templates & Configurations
Automation Templates
Checklists
Best Practices Summary
Package Manager Selection
JavaScript/TypeScript:
- 🥇 pnpm - Best performance, strict dependency resolution, disk efficiency
- 🥈 npm - Default, stable, widely supported
- 🥉 yarn - Good for monorepos, Plug'n'Play mode
iOS/Swift:
- 🥇 Swift Package Manager - Official, modern, Xcode integrated
- 🥈 CocoaPods - Mature, legacy support
Python:
- 🥇 Poetry - Modern, excellent dependency resolution
- 🥈 pip - Simple, traditional approach
Version Pinning Strategy
{
"dependencies": {
"react": "18.2.0",
"lodash": "~4.17.21",
"axios": "^1.6.0"
},
"devDependencies": {
"typescript": "^5.3.0"
}
}
Security Best Practices
-
Enable Automated Scanning
- GitHub Dependabot
- Snyk
- npm audit in CI/CD
-
Response Times
- Critical vulnerabilities: < 24 hours
- High vulnerabilities: < 48 hours
- Medium vulnerabilities: < 1 week
-
Supply Chain Protection
- Use lock files (always commit)
- Private registry proxy
- Package verification
- SBOM generation
Update Strategy
| Update Type | Frequency | Automation | Review |
|---|
| Security patches | Immediate | ✅ Auto-merge | Minimal |
| Patch (x.x.PATCH) | Weekly | ✅ Auto-merge | CI only |
| Minor (x.MINOR.x) | Monthly | ⚠️ Manual merge | Code review |
| Major (MAJOR.x.x) | Quarterly | ❌ Manual | Full review |
Essential Tools
Security
- npm audit (built-in)
- Snyk (comprehensive)
- GitHub Dependabot (native)
- Socket.dev (supply chain)
- OWASP Dependency-Check
Automation
- Renovate (advanced features)
- Dependabot (GitHub native)
Analysis
- webpack-bundle-analyzer
- bundlephobia.com
- depcheck
- npm-check-updates
Compliance
- license-checker
- SBOM generators (CycloneDX, SPDX)
- Dependency-Track
Metrics & KPIs
Track these metrics for dependency health:
Security Metrics
- Vulnerability count (Critical/High/Medium/Low)
- Mean time to detect (MTTD)
- Mean time to remediate (MTTR)
- Security scan success rate
Target: 0 critical/high vulnerabilities, MTTR < 7 days
Dependency Metrics
- Total dependency count
- Outdated percentage
- Average dependency age
- Deprecated package count
Target: < 5% outdated, < 200 total dependencies
Performance Metrics
- Bundle size (gzipped)
- Build time
- Install time
Target: < 200KB initial bundle, < 2min builds
Process Metrics
- Automated update success rate
- Manual review time
- Breaking change incidents
Target: > 80% auto-merge, < 1 incident/month
Common Patterns
Pattern 1: Security-First Approach
- Daily vulnerability scans
- Auto-merge security patches
- 24-hour response for critical CVEs
- Monthly security audit reports
Pattern 2: Stability-First Approach
- Lock all production dependencies
- Manual review for all updates
- Staging deployment before production
- Quarterly update cycles
Pattern 3: Innovation-First Approach
- Daily dependency updates
- Auto-merge minor updates
- Beta testing of new versions
- Monthly major version evaluations
Troubleshooting
Problem: Build Failures After Update
Symptoms: Tests fail, TypeScript errors, runtime errors
Solutions:
- Check breaking changes in changelog
- Review migration guide
- Use codemod tools for automated migration
- Rollback and plan migration
- Pin problematic dependency temporarily
Problem: Security Vulnerabilities in Transitive Dependencies
Symptoms: npm audit shows vulnerabilities you don't directly use
Solutions:
- Update parent dependency
- Use
npm audit fix --force (carefully)
- Use
overrides (npm 8.3+) or resolutions (yarn)
- Contact package maintainer
- Find alternative package
Problem: Dependency Conflicts
Symptoms: "Cannot resolve dependency", version conflicts
Solutions:
- Use
npm ls <package> to see dependency tree
- Use
overrides/resolutions to force version
- Update conflicting packages
- Consider alternative packages
Related Skills
Quick Reference Commands
npm
npm install
npm ci
npm update
npm outdated
npm audit
npm audit fix
npx depcheck
npx npm-check-updates
Yarn
yarn install
yarn upgrade
yarn audit
yarn outdated
yarn install --frozen-lockfile
pnpm
pnpm install
pnpm update
pnpm audit
pnpm outdated
pnpm install --frozen-lockfile
Security Tools
snyk test
npx socket-cli audit
npx @cyclonedx/cyclonedx-npm
npx license-checker
Version History
Maintained by: Development Team
Last Updated: 2025-01-03
Status: 🟢 High (100% complete)