Audit project dependencies with npm audit, npm outdated, pip-audit or osv-scanner and get a prioritised, evidence-based upgrade plan.
--- name: dependency-analyzer description: Audits a project's dependencies for published security advisories, outdated versions and license questions using the package manager's own tools (npm audit, npm outdated, pip-audit or osv-scanner), then writes a prioritised upgrade plan. Use when asked to check dependencies, scan for vulnerable packages, review a lockfile, or plan dependency upgrades. compatibility: Needs the project's package manager on PATH and read access to its advisory database (npm registry, PyPI/OSV). Works offline only for the inventory and license steps. metadata: version: "1.3.0" --- # Dependency Analyzer Produce an evidence-based dependency report from the tools that own the data. Never state a CVE, severity or fixed version from memory: copy it from the audit output or the advisory page. ## When not to use - The user wants packages changed right away. This skill reports and proposes; apply upgrades only after the user approves the plan (see npm-package-manager for the install step). - There is no lockfile and the user cannot create one. Advisory matching without resolved versions is guesswork; say so. ## Inputs to collect - Project root and ecosystem (look for `package-lock.json`, `pnpm-lock.yaml`, `yarn.lock`, `requirements*.txt`, `poetry.lock`, `uv.lock`). - Scope: production dependencies only, or dev dependencies too. - Policy: which severities block a release, and any licenses the organisation does not allow. ## Workflow 1. **Inventory.** Record the package manager and lockfile. If a Node project has no lockfile, generate one without installing or running scripts: `npm install --package-lock-only --ignore-scripts`. Tell the user a new file was created. 2. **Security advisories.** - npm: `npm audit --json` (add `--omit=dev` for production scope). A non-zero exit code means advisories were found, not that the command failed. - Python: `pip-audit -r requirements.txt -f json` if pip-audit is installed. - Any ecosystem: `osv-scanner scan source -r .` if osv-scanner is installed. - If none of these tools is available, stop this step and report it as not run. 3. **Read each finding.** For every advisory keep: package, installed version, advisory ID (GHSA/CVE), severity as reported, vulnerable range, first patched version, whether the package is direct or transitive, and the dependency path (`npm ls <pkg>`). Open the advisory URL when the fix crosses a major version. 4. **Outdated check.** `npm outdated --json --long` (or `pip list --outdated --format=json`). Note that `wanted` equals the pinned version for exact pins, so compare against `latest`. 5. **Licenses (optional).** Read the `license` field of direct dependencies (`npm view <pkg> license` or the lockfile metadata). Flag missing or unrecognised values for human review; do not give legal conclusions. 6. **Prioritise.** Order fixes by: reachable production dependency with a patched version available → transitive with an upgrade path through the direct parent → dev-only → no fix available (propose mitigation or replacement). 7. **Propose, don't apply.** For each item give the exact command (for example `npm install axios@^0.28.0`), whether it is a semver-major change, and what to test afterwards. `npm audit fix --force` can install breaking majors; never run it without approval. ## Output format ``` DEPENDENCY REPORT <project> · <package manager> · <date> Tools run: npm audit (exit 1), npm outdated Not run: osv-scanner (not installed) Advisories: <n> (as reported: critical x / high y / moderate z / low w) | Package | Installed | Advisory | Severity | Patched in | Direct? | Proposed action | Outdated (no advisory): <package current → latest, major?> License review needed: <package: value> Next steps / tests to run after upgrading ``` ## Limitations - Results reflect the advisory database at the time of the run; re-run before release. - Audit tools match versions, not code paths. A listed advisory may not be exploitable in this app; state reachability as unknown unless you checked it. - Severity labels differ between npm, GHSA and NVD; quote the tool you used. ## Example Input: `package.json` pins `"lodash": "4.17.20"` and `"axios": "0.21.0"`; user asks "are our dependencies safe to ship?" Good result: runs `npm install --package-lock-only --ignore-scripts` then `npm audit --json`; lists lodash GHSA-35jh-r3h4-6jhm (CVE-2021-23337, command injection, patched in 4.17.21) and axios GHSA-wf5p-g6vw-rhxx (CVE-2023-45857, CSRF token exposure, patched in 0.28.0 on the 0.x line or 1.6.0 on 1.x), plus any newer advisories the audit returns; proposes upgrades on the existing major first and marks a move to axios 1.x as a breaking change to test.
Illustrative input and expected result. This example is a verification guide, not a recorded model run.
Content reviewed .
A Node service is about to ship and its package.json pins lodash 4.17.20 and axios 0.21.0. The team wants to know which advisories apply and what to upgrade first.
Check the dependencies in this repo before release. package.json has "lodash": "4.17.20" and "axios": "0.21.0" and there is no lockfile. Production dependencies only; we block on high or critical.
The agent creates a lockfile with `npm install --package-lock-only --ignore-scripts` (and says it did), runs `npm audit --json --omit=dev`, and treats exit code 1 as 'advisories found'. The table lists each advisory with the ID and patched version taken from the audit output, for example: lodash 4.17.20 · GHSA-35jh-r3h4-6jhm / CVE-2021-23337 (command injection) · patched in 4.17.21; axios 0.21.0 · GHSA-wf5p-g6vw-rhxx / CVE-2023-45857 (CSRF) · patched in 0.28.0 (0.x) or 1.6.0 (1.x), plus any other advisories the live database returns. Proposed commands stay on the current major where a fix exists, mark axios 1.x as semver-major, and nothing is installed until the user approves.
AI Agent Skills are reusable workflow packages that extend your AI coding assistant with multi-step capabilities. Install dependency-analyzer by following these steps.
SKILL.md inside, in the location documented by your client. Do not assume every AI application reads the same directory.Requires an Agent Skills-compatible client; supported locations and activation vary by version. Read the SKILL.md setup guide. MCP connects tools and data and does not, by itself, install a skill.