AGENT SKILL
npm-vulnerability-remediation
Assess and remediate NPM dependency vulnerabilities safely, including lockfile-aware updates, overrides, validation, and documented exceptions.
- License 许可
- MIT
- 最近更新
- 2026-08-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- npm-vulnerability-remediation
- description
- Assess and remediate NPM dependency vulnerabilities safely, including lockfile-aware updates, overrides, validation, and documented exceptions.
03 SKILL.md 正文
NPM Vulnerability Remediation
Use this skill when assessing or fixing vulnerabilities reported for NPM dependencies.
Identify the Package Manager and Lockfile
- Inspect the repository root for
package.jsonand package-manager metadata:packageManagerinpackage.jsonenginesinpackage.json- CI workflows, contributor documentation, and existing scripts
- Identify the authoritative lockfile before changing dependencies:
package-lock.jsonfor npmnpm-shrinkwrap.jsonfor npm, which takes precedence overpackage-lock.jsonyarn.lockfor Yarnpnpm-lock.yamlfor pnpm
- Use only the repository's configured package manager. Do not introduce, replace, or regenerate an unrelated lockfile.
- Match the runtime and package-manager versions required by the project. Prefer Corepack when the repository declares a supported package manager version.
Assess the Audit
- Install dependencies using the lockfile's immutable mode where supported:
- npm:
npm ci - Yarn:
yarn install --immutable - pnpm:
pnpm install --frozen-lockfile
- npm:
- Run the package manager's audit command and record each actionable advisory:
- npm:
npm audit --json - Yarn: use the repository's configured audit workflow or
yarn npm audit --jsonfor modern Yarn - pnpm:
pnpm audit --json
- npm:
- Determine the vulnerable package's role:
- Direct runtime dependency
- Direct development dependency
- Transitive dependency
- Optional dependency
- Tooling-only dependency
- Confirm the affected dependency path, installed version, fixed version, severity, exploitability, and whether the vulnerable code is reachable in the application.
- Do not use automatic force fixes until their resulting dependency, API, and runtime changes have been reviewed.
Choose the Smallest Safe Remediation
Direct Dependencies
- Update the direct dependency to the lowest supported version containing the fix.
- Respect the existing semver policy and avoid unrelated version upgrades.
- Review release notes and migration guidance for breaking changes.
- Update
package.jsonand the authoritative lockfile together using the configured package manager.
Transitive Dependencies
- First update the nearest direct parent package if that brings in a fixed transitive version without a breaking change.
- If no compatible parent update exists, use the package manager's scoped constraint mechanism:
- npm:
overridesinpackage.json - Yarn:
resolutionsinpackage.json - pnpm:
pnpm.overridesinpackage.json
- npm:
- Pin only the vulnerable package or vulnerable dependency edge to a version known to be compatible with the installed parents.
- Keep every override narrowly scoped, explain why it is needed, and remove it once upstream packages include the fix.
- Never hand-edit a lockfile except as an unavoidable, package-manager-documented consequence of a constrained update.
Apply Constrained Updates
- Make the minimal manifest change required for the chosen remediation.
- Regenerate only the authoritative lockfile with the configured package manager.
- Inspect the manifest and lockfile diff:
- Confirm the intended fixed version is installed on every vulnerable path.
- Ensure unrelated packages were not updated, removed, or added.
- Reject broad lockfile churn and retry with a more constrained command or override.
- Re-run the audit and verify the advisory is absent or reduced exactly as expected.
Validate
- Run the repository's documented dependency installation command from a clean state.
- Run the smallest relevant validation commands already provided by the repository:
- Type checking
- Linting
- Unit or integration tests
- Build or packaging checks
- Run the full validation suite when the remediated package affects runtime behavior, build tooling, shared configuration, or the project's existing CI requires it.
- Report the exact remediation, advisories resolved, remaining advisories, validation results, and any compatibility considerations.
Handle Unresolvable Advisories
When no safe fix is currently available, do not suppress or misrepresent the finding.
- Document the advisory identifier, severity, vulnerable and fixed ranges, dependency path, and the reason a safe update is unavailable.
- State the reachability assessment, including whether vulnerable code is shipped, invoked, or exposed in the deployed environment.
- Describe mitigations such as disabling the affected feature, restricting untrusted input, isolating build-only tooling, or avoiding the vulnerable code path.
- Link or reference the upstream issue and define a concrete follow-up condition, such as a fixed parent release or a new advisory version.
- Keep any temporary exception narrowly scoped, time-bound where policy permits, and visible in the remediation report or tracked issue.
- Do not modify audit configuration, ignore files, or severity thresholds solely to hide an unresolved vulnerability.
04 同仓库更多 Skills
java-vulnerability-remediation
Remediate known Java dependency vulnerabilities in Maven and Gradle projects, including direct and transitive dependencies, BOMs, dependency management, plugins, validation, and residual-risk documentation.
★ 0
commit
Creates commit messages
★ 0