Ghostimport banner
FGuerreir0 FGuerreir0

Ghostimport

AI community

Description

๐Ÿ‘ป Detects ghost imports โ€” npm packages that don't exist, hallucinated by AI coding tools like Cursor, Copilot, and Claude

Installation

This entry records only its repository, not the path inside it, so there is no exact command to give. Open the source below and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

README

ghostimport logo

ghostimport

Stops your AI coding agent from installing npm packages that don't exist.

CI npm ghostimport Buy me a coffee

How the attack works โ†’


Your agent invents a package name. It doesn't exist on npm *yet*. Someone is watching for exactly that, and the moment they register it, `npm install` runs their `postinstall` script on your machine.

This is **slopsquatting**. `npm audit`, Snyk and Socket don't catch it โ€” they only inspect packages you've already installed. ghostimport checks names against the live registry at the moment your agent writes or installs them.

$ ghostimport

  Scanned 142 files ยท 38 packages

  โœ— react-server-fetch  does not exist on npm
    โ†ณ src/data/loader.ts
    โ†ณ unregistered โ€” anyone could claim this name with a malicious postinstall

  โœ— axois  high risk
    โ†ณ src/api/client.ts
    โ†ณ 1-2 chars from 'axios' โ€” likely a typo
    โ†ณ has postinstall script โ€” runs code on npm install
    created 2019-08-29 ยท 1245/week ยท 1 version

  2 problems found.

Install

npm install -g ghostimport     # or: npx ghostimport

Node.js 22+. Zero runtime dependencies โ€” the published package uses only Node built-ins.

Use it w