Dependency management

From JeremyDev87/codingbuddy · View interactive version

Dependency management is an AI agent skill from the GitHub repository JeremyDev87/codingbuddy. Use when CVE discovered, major version upgrade needed, lock file conflicts occur, or license compliance audit required - guides systematic dependency health management

How to use this skill

Skill file

Dependency Management

Overview

Dependencies rot silently. Unmanaged packages become security liabilities, compatibility nightmares, and legal risks.

Core principle: ALWAYS assess, prioritize, and plan before updating. Rushed upgrades break production; ignored vulnerabilities enable breaches.

Violating the letter of this process is violating the spirit of dependency management.

First 5 Minutes Checklist (Security Vulnerability)

Use this when CVE alert arrives. Don't think, follow the list.

| Minute | Action | Output |

|--------|--------|--------|

| 0-1 | Identify affected package and version | package@version confirmed |

| 1-2 | Check CVE severity (CVSS score) | Severity (Critical/High/Medium/Low) |

| 2-3 | Verify if your app is affected | affected or not_affected |

| 3-4 | Check if patch available | patch_available or no_patch |

| 4-5 | If Critical/High: Create incident ticket | Stakeholders aware |

After 5 minutes: Proceed to Phase 2 (Assess Impact) - you've completed Detect.

The Iron Law

NO UPGRADES WITHOUT IMPACT ASSESSMENT FIRST

If you haven't assessed breaking changes and tested compatibility, you cannot merge dependency updates.

When to Use

Use for ANY dependency management task:

Use this ESPECIALLY when:

Don't skip when:

When NOT to Use

This skill is for systematic dependency management. Don't use it for:

Key distinction: This skill manages systematic upgrade and security response. For simple package additions, use standard code review.

The Six Phases

You MUST complete each phase before proceeding to the next.

digraph dependency_management {
    rankdir=TB;
    node [shape=box];

    "1. Detect" -> "2. Assess Impact";
    "2. Assess Impact" -> "3. Plan Upgrade";
    "3. Plan Upgrade" -> "4. Execute";
    "4. Execute" -> "5. Verify";
    "5. Verify" -> "6. Document";

    "Skip Phase?" [shape=diamond];
    "2. Assess Impact" -> "Skip Phase?" [style=dashed, label="tempted?"];
    "Skip Phase?" -> "STOP" [label="NO"];
    "STOP" [shape=doublecircle, color=red];
}

Phase 1: Detect

Identify the dependency issue:

  1. For Security Vulnerabilities:
  1. For Outdated Packages:
  1. For License Issues:

Completion criteria:

Phase 2: Assess Impact

Understand the blast radius BEFORE planning:

See security-vulnerability-response.md for CVE-specific assessment.

  1. Usage Analysis
  1. Breaking Change Analysis
  1. Dependency Chain
  1. Risk Assessment

Completion criteria:

Phase 3: Plan Upgrade

Design the upgrade strategy:

See major-upgrade-guide.md for staged upgrade patterns.

  1. Choose Upgrade Path
  1. For Major Upgrades:
  1. For Security Patches:
  1. Create Upgrade Ticket

Completion criteria:

Phase 4: Execute

Implement the upgrade:

See lock-file-management.md for conflict resolution.

  1. Create Feature Branch
  1. Update Package
  1. Make Required Code Changes
  1. Run Tests

Completion criteria:

Phase 5: Verify

Confirm the upgrade works:

  1. Build Verification
  1. Runtime Verification
  1. Security Verification (if CVE)

Completion criteria:

Phase 6: Document

The upgrade is NOT complete until documented:

  1. Update Changelog
  1. Update Documentation
  1. Close Tickets

Completion criteria:

Red Flags - STOP and Follow Process

If you catch yourself thinking:

ALL of these mean: STOP. Return to Phase 2.

Common Rationalizations

| Excuse | Reality |

|--------|---------|

| "It's just a patch version" | Patch versions can contain breaking changes. Semantic versioning is a promise, not a guarantee. |

| "We're behind, need to catch up" | Rushed upgrades cause production incidents. Systematic upgrades are faster long-term. |

| "Everyone else uses this version" | Your codebase has unique usage patterns. Test YOUR code. |

| "Lock file changes are noise" | Lock file integrity prevents "works on my machine." Treat it as source code. |

| "License is fine, it's open source" | Open source has obligations. GPL can require code disclosure. Check ALWAYS. |

| "CVE doesn't affect us" | Verify with evidence, don't assume. Attack vectors are creative. |

| "We'll handle deprecations later" | Deprecation warnings become errors. Address when upgrading. |

| "Auto-merge is safe for patches" | Auto-merge is safe for MONITORED patches. Set up failure alerts. |

Quick Reference

| Phase | Key Activities | Verification Key |

|-------|---------------|------------------|

| 1. Detect | Audit, identify, classify severity | issue_identified |

| 2. Assess | Usage mapping, breaking changes, risk | risk_assessed |

| 3. Plan | Upgrade path, code changes, timeline | upgrade_path_defined |

| 4. Execute | Branch, update, test | tests_passing |

| 5. Verify | Build, runtime, security audit | build_verified |

| 6. Document | Changelog, docs, close tickets | ticket_closed |

Severity Response Times

| Severity | CVSS Score | Response Time | Action |

|----------|------------|---------------|--------|

| Critical | 9.0-10.0 | 24 hours | Immediate patch or mitigation |

| High | 7.0-8.9 | 7 days | Prioritized upgrade |

| Medium | 4.0-6.9 | 30 days | Scheduled upgrade |

| Low | 0.1-3.9 | 90 days | Next maintenance cycle |

Monorepo Considerations

When managing dependencies in monorepos (multiple package.json files):

Workspace Tools

| Tool | Command | Purpose |

|------|---------|---------|

| npm workspaces | npm audit --workspaces | Audit all workspaces |

| Yarn workspaces | yarn workspaces foreach npm audit | Audit each workspace |

| pnpm | pnpm -r audit | Recursive audit |

| Lerna | lerna exec -- npm audit | Execute in each package |

| Turborepo | turbo run audit | Run audit task |

| Nx | nx run-many --target=audit | Parallel audit |

Monorepo-Specific Workflow

  1. Detect (Modified)
  1. Assess Impact (Critical)
  1. Execute (Coordinated)

Shared vs Package-Specific Dependencies

| Location | Use For | Example |

|----------|---------|---------|

| Root package.json | Shared tooling, workspace-wide deps | TypeScript, ESLint, build tools |

| Package package.json | Package-specific runtime deps | React (if only some packages need it) |

Version Synchronization

# Ensure consistent versions across workspaces
npx syncpack list-mismatches
npx syncpack fix-mismatches

CI Considerations

Supporting Files

These files provide detailed guidance for specific phases:

Related Skills

Real-World Impact

From dependency management data:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.