slopcheck
Scan files for npm install, npx, pnpm add, yarn add, bun add, and bunx commands, extract package names, and validate each against the live npm registry. Packages that don't exist are reported as phantom packages (hallucinations). Packages with HTTP 451 responses are flagged as security holds (removed for malware).
Zero runtime dependencies. Uses only Node.js built-in APIs.
When to use
- - Before installing packages from any AI-generated file (SKILL.md, AGENTS.md, .cursorrules, README.md)
- Before committing markdown or config files that reference npm packages
- When reviewing pull requests that add new package references in documentation
- After generating code or documentation that includes install commands
Commands
CODEBLOCK0
Interpreting output
CODEBLOCK1
- - not found on npm — the package name does not exist in the npm registry. Likely an AI hallucination. Do not install it. An attacker may register the name as malware (slopsquatting).
- security hold (HTTP 451) — npm has removed this package, typically for malware. Do not install it under any circumstances.
- Exit code 0 — all packages verified as existing on npm.
- Exit code 1 — one or more phantom packages found.
JSON output format
When using --json, output is an array of findings:
CODEBLOCK2
What slopcheck does NOT do
- - Does not scan package.json or lock files — use Socket.dev or Snyk for that
- Does not check if an existing package is malicious — existing only means not hallucinated
- Does not validate package versions or compatibility
Scanned file types
INLINECODE7 , .yml, .yaml, .json, INLINECODE11
Directories named node_modules, .git, dist, and build are always skipped.
slopcheck
扫描文件中包含 npm install、npx、pnpm add、yarn add、bun add 和 bunx 命令,提取包名,并逐一对照实时 npm 注册表进行验证。不存在的包会被报告为幻影包(幻觉)。返回 HTTP 451 响应的包会被标记为安全冻结(因恶意软件被移除)。
零运行时依赖。仅使用 Node.js 内置 API。
使用场景
- - 在从任何 AI 生成的文件(SKILL.md、AGENTS.md、.cursorrules、README.md)安装包之前
- 在提交引用 npm 包的 Markdown 或配置文件之前
- 在审查新增文档中包引用的拉取请求时
- 在生成包含安装命令的代码或文档之后
命令
bash
扫描特定文件
npx slopcheck SKILL.md README.md
递归扫描目录(.md、.yml、.yaml、.json、.cursorrules)
npx slopcheck .
以 JSON 格式输出,便于程序化使用
npx slopcheck --json .
忽略已知正常的内部包
npx slopcheck --ignore my-internal-pkg,another-known-pkg .
控制注册表检查并发数
npx slopcheck --concurrency 5 .
输出解读
slopcheck v0.1.1 — 正在扫描 3 个文件以查找幻影包
✗ react-codeshift — 在 npm 上未找到
└─ AGENTS.md:14 npx react-codeshift --transform ...
└─ SKILL.md:8 npm install react-codeshift
⚠ suspicious-pkg — 安全冻结(HTTP 451)
└─ .cursorrules:19 npm install suspicious-pkg
✓ 12 个包已验证,1 个未找到,1 个安全冻结
发现 1 个幻影包。退出代码 1。
- - 在 npm 上未找到 — 该包名在 npm 注册表中不存在。很可能是 AI 幻觉。请勿安装。攻击者可能会注册该名称作为恶意软件(slopsquatting)。
- 安全冻结(HTTP 451) — npm 已移除该包,通常因恶意软件。任何情况下都不得安装。
- 退出代码 0 — 所有包已验证存在于 npm 上。
- 退出代码 1 — 发现一个或多个幻影包。
JSON 输出格式
使用 --json 时,输出为发现结果数组:
json
[
{
file: AGENTS.md,
line: 14,
command: npx react-codeshift --transform ...,
packages: [react-codeshift],
results: {
react-codeshift: { exists: false, status: 404 }
}
}
]
slopcheck 不做什么
- - 不扫描 package.json 或锁文件 — 请使用 Socket.dev 或 Snyk 处理
- 不检查现有包是否恶意 — 存在仅表示非幻觉
- 不验证包版本或兼容性
扫描的文件类型
.md、.yml、.yaml、.json、.cursorrules
名为 node_modules、.git、dist 和 build 的目录始终被跳过。