Agent skill
dependency
Dependency management and technology selection. Apply when introducing new libraries, choosing technologies, or managing package versions.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/dependency-channinghe-dotfiles-0a620819
SKILL.md
Dependency Management & Technology Selection
Build vs Buy Decision Tree
┌─ Is this core business logic?
│ ├─ Yes → Build (keep control)
│ └─ No → ↓
│
├─ Is there a mature, well-maintained library?
│ ├─ Yes → Use library
│ └─ No → ↓
│
├─ Would building it take > 2 days?
│ ├─ Yes → Find alternative or build
│ └─ No → Build (simpler than integrating)
Golden Rule: Only build when you need competitive advantage. Everything else, use proven solutions.
Library Evaluation Criteria
Before adding ANY dependency, verify:
-
Maintenance Health
- ✅ Last commit within 6 months
- ✅ Issues are being addressed
- ✅ No major open bugs related to your use case
-
Ecosystem Health
- ✅ GitHub stars > 100 (for general libs)
- ✅ Weekly downloads > 10k (for npm)
- ✅ No known security vulnerabilities (run
npm auditorsnyk)
-
Bundle Size
- ⚠️ Is this library adding > 50KB minified?
- ⚠️ Does it have tree-shaking support?
- ⚠️ Can you use a smaller alternative?
-
API Stability
- ✅ Has stable v1.0+ release
- ❌ Avoid libraries with 0.x.x versions (unstable)
Dependency Categories
| Type | Strategy |
|---|---|
| Utility libraries (lodash, date-fns) | Use, but prefer modern alternatives (native APIs, smaller libs) |
| UI frameworks/components (React, shadcn/ui) | Standardize, don't mix |
| Backend SDKs (Stripe, AWS SDK) | Use official SDKs, never unofficial |
| Dev dependencies | Minimize, remove unused |
| Polyfills | Avoid, target modern browsers |
Version Management
-
Use semantic versioning strictly
^1.2.3→ Accept 1.x.x updates (patch + minor)~1.2.3→ Accept 1.2.x updates (patch only)1.2.3→ Exact version (for critical deps)
-
Lock files are sacred
- Commit
package-lock.json,yarn.lock,poetry.lock - Never manually edit lock files
- Same lock file across all environments
- Commit
-
Update strategy
bash# Monthly: Check for security updates npm audit # Quarterly: Minor version updates npm update # Yearly: Major version updates (requires testing) # Example: Upgrade React 18 → 19
When to Avoid Dependencies
❌ Don't add if:
- It's 5 lines of code you can write yourself
- You only use 10% of a large library
- There's no clear migration path if it's abandoned
- It adds unnecessary complexity
✅ Do add if:
- It's a well-solved problem (date parsing, validation)
- It's security-sensitive (crypto, auth)
- It has active community and documentation
Security Checklist
Before merging any PR with new dependencies:
- Run security audit:
npm audit/pip-audit - Check for known CVEs in the package
- Verify maintainer identity (avoid typosquatting)
- Review license compatibility (MIT, Apache 2.0, BSD preferred)
- Check if package has been compromised (replaced)
Package.json Best Practices
{
"dependencies": {
"react": "^19.0.0", // Standard deps
"@stripe/stripe-js": "^3.0.0" // Scoped packages for official SDKs
},
"devDependencies": {
"typescript": "^5.0.0", // Dev tools
"prettier": "^3.0.0"
},
"overrides": {
"minimist": "^1.2.8" // Force security patch
},
"engines": {
"node": ">=18.0.0" // Minimum version
}
}
Removal Strategy
Quarterly dependency audit:
- List all dependencies:
npm list --depth=0 - Identify unused:
npx depcheck - Check each against actual usage in codebase
- Remove unused:
npm uninstall <package> - Test thoroughly after removal
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?