| name | dependency-management |
| description | Security audits, dependency updates, compatibility checks, vulnerability scanning. Use when: updating dependencies, auditing security, managing package versions, resolving conflicts. |
| argument-hint | audit-type, severity-level |
Dependency Management
When to Use
- Running security audits on dependencies
- Updating outdated packages
- Checking compatibility before updating
- Resolving dependency conflicts
- Scanning for vulnerabilities
- Managing monorepo dependencies
What This Skill Does
Manages CampusOS dependencies securely, including auditing, updating, and compatibility verification.
Procedure
Phase 1: Security Auditing
- Audit current dependencies:
pnpm audit
- Output shows identified vulnerabilities:
- Package name, vulnerability, severity (critical, high, moderate, low)
- Current version, required version to fix
- View details:
pnpm audit --json for machine-readable output
- Filter by severity:
pnpm audit --filter moderate
- Ignore low-severity (review before):
{
"pnpm": { "overrides": { "vulnerable-pkg": "1.0.0" } }
}
- Schedule audits in CI: Weekly in GitHub Actions
Phase 2: Dependency Inventory
- List all dependencies:
pnpm list
- View production dependencies only:
pnpm list --prod
- Find duplicate/multiple versions:
pnpm list --depth 0
- Check for circular dependencies:
pnpm ls --graph
- Export to file:
pnpm list > deps.txt
- Verify no breaking major versions: Check if 2.x installed alongside 3.x
Phase 3: Update Strategy
- Classify updates:
- Patch (1.0.0 → 1.0.1): Safe, pull immediately
- Minor (1.0.0 → 1.1.0): Usually safe, test before merge
- Major (1.0.0 → 2.0.0): Breaking changes, manual review required
- Establish update cadence:
- Security patches: Immediately (same day)
- Minor updates: Weekly
- Major updates: Monthly (after thorough testing)
- Test updates locally first:
pnpm update on feature branch
- Run full test suite:
pnpm test && pnpm test:integration
- Monitor for regressions: Check error tracking for 24hrs post-deploy
- Use automated tools: Dependabot, Renovate for PR automation
Phase 4: Updating Dependencies
- Check for outdated packages:
pnpm outdated
- Update specific package:
pnpm update express@latest
- Update all minor/patch:
pnpm update --interactive
- Update major versions (careful):
pnpm update @chakra-ui/react@3!
- Review changes to APIs in migration guide (check GitHub)
- Verify
pnpm-lock.yaml changes are minimal
- Commit separately: "chore: update dependencies"
Phase 5: Compatibility Verification
- After update, run full test suite:
pnpm install --frozen-lockfile
pnpm lint
pnpm test
pnpm build
- Check for deprecated APIs:
npm deprecations | grep campusos
- Review peer dependency warnings:
warn! peer dep missing: react@18, installed: react@17
- Test in development environment (dev machine + Docker)
- Test integration with other services (backend/frontend)
- Monitor staging environment for 24hrs before production
Phase 6: Conflict Resolution & Cleanup
- If
pnpm install fails, resolve conflicts:
pnpm install --no-frozen-lockfile
pnpm install
- Check for conflicting peer dependencies:
pnpm install --strict-peer-dependencies
- Override conflicting versions in
package.json:
{ "pnpm": { "overrides": { "lodash": "4.17.21" } } }
- Remove unused dependencies:
pnpm prune
- Update transitive dependencies safely:
pnpm update --recursive --interactive
- Document overrides with comments for future context
Quick Reference
pnpm audit
pnpm audit --fix
pnpm outdated
pnpm update --interactive
pnpm update express@6.0.0
pnpm audit --prod
pnpm install --frozen-lockfile
pnpm prune
Troubleshooting
| Issue | Solution |
|---|
| High-severity vulnerability with no fix | Evaluate alternative package; override with lower version if needed; document in PR |
| Update breaks tests | Revert: git checkout pnpm-lock.yaml; check migration guide; file issue with package |
| Peer dependency conflict | Review conflict message; use pnpm.overrides to specify version; test compatibility |
| pnpm install hangs | Clear cache: pnpm store prune; retry with --no-frozen-lockfile |
| Circular dependency detected | Use pnpm ls --graph to identify; refactor imports to break loop |
| Duplicate package versions | Resolve in pnpm-lock.yaml or use .pnpmfile.cjs hook |