Command Palette

Search for a command to run...

Назад к скиллам
скилл № 24238

hoc-npm-install-scripts

How to handle the install scripts npm would run while installing dependencies. Use this skill when an install reports scripts not yet covered by…

БесплатноБез исполняемых скриптов
openreachtechот openreachtech★ 17 звёзд на GitHub

Установить hoc-npm-install-scripts в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

npm Install Scripts

A package's install script runs on the machine doing the install, with that machine's permissions, before anybody has looked at it. npm can gate this: an install script runs only for a package the project has approved, recorded in allowScripts. This skill covers the gate — how it is switched on, how each package is decided, and the order those two have to happen in.

The gate is the defence, not the registry

A version found to be malicious does not leave the registry. A publish older than the grace period is not removed, because removing it breaks every dependent. What gets applied instead is a deprecation notice, and a deprecation notice prints a warning and installs anyway.

Measured on a widely used package whose 1.x line carried a compromise, years after the fact: every version inside the advisory's range still had its tarball, none had been unpublished, and a dist-tag still pointed into the affected line.

  • "The bad version is gone" is never available as a premise. The registry is not a place where dangerous versions expire.
  • What can be stopped is execution. Fetching a tarball puts bytes on disk; running its install script is what hands over the machine. The gate governs the second, and only the second is the project's to govern.
  • The gate also covers the interval before an advisory exists. An advisory is published after somebody notices; a package that was never approved was never running, notice or no notice.

Deny is the default

An install script is denied unless there is a demonstrated need for it. Denial is the resting state. Approval is the exception that has to earn itself.

  • Reaching the decision means denying the script and running the project's own checks — its lint, its tests, whatever it runs to know it works. If those pass, the denial stands.
    • A native package answers before the suite does. Where its binary comes from a prebuilt platform package, the script has nothing left to do: check that the platform package's .node file is present, that no build directory was produced, and that the module loads when required.
  • A package's reputation is not evidence. Widely used, well maintained, and depended on by something the project needs are all true of packages whose install scripts do nothing this project uses. The question is not whether the package is trustworthy; it is whether the script is needed, and only running without it answers that.
  • Approve only what actually broke, and say in the same commit what broke.

Turn the list into a recommendation, package by package

npm reports the scripts it did not cover as a list of names:

npm warn install-scripts 2 packages have install scripts not yet covered by allowScripts:
npm warn install-scripts   [email protected] (install: (install scripts present))
npm warn install-scripts   [email protected] (install: (install scripts present))
npm warn install-scripts
npm warn install-scripts Run `npm install-scripts ls` to review, or `npm install-scripts approve <pkg>` to allow.

Names alone are not a decision. Turn the list into a per-package recommendation with its reason attached — denied because the checks pass without it, approved because this specifically failed. Whoever reads the commit should not have to derive it again.

  • The record of the decision lives in package.json, which is where npm reads it from. Do not keep a second copy of the list anywhere else, this skill included: a list that is not the one being enforced goes stale with nothing to reveal it.
  • Where projects are generated from a boilerplate, the denials common to all of them belong in the boilerplate's own package.json, already recorded, so a new project starts gated.

An approval records a version; a denial records a name

approve writes <pkg>@<version>, pinned to what is installed. deny writes the bare name.

  • So an approval goes in after the raise that introduced the version, or it pins the version being replaced. A denial names no version, so it is decided on its own and in any order.
  • Approve unpinned only where the script is needed whatever the version.
  • Remove a denial before approving. approve refuses while the entry stands.

--dry-run answers "does this upgrade add a script?"

Before committing to an upgrade, the question is whether it introduces an install script not already covered. A dry-run install answers exactly that and changes nothing.

npm install <pkg>@<version> --dry-run

Measured: no node_modules is created, package.json and package-lock.json are untouched, and no script runs — while the warning listing uncovered scripts is still printed.

  • So the question is answerable before the upgrade lands, not after.
  • One caveat: a dry run resolves as though nothing were installed. It reports the whole set for a fresh tree, not the delta against the tree that exist
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл hoc-npm-install-scripts?

How to handle the install scripts npm would run while installing dependencies. Use this skill when an install reports scripts not yet covered by `allowScripts`, when deciding whether a dependency's install script may be denied, when turning the gate on in a project, or when judging whether an upgrade introduces a new script. Advisories belong to the vulnerability convention; how `.npmrc` is written, to the npmrc convention.

Как установить скилл hoc-npm-install-scripts?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл hoc-npm-install-scripts запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить hoc-npm-install-scripts с