Package.json prüfen, bevor die KI den Code ausliefert
Was im Preview gut aussieht, kann bei npm install schnell ausufern. Der Beitrag rät, Abhängigkeiten kritisch zu prüfen, bevor eine KI generierte package.json produktiv geht.

Offenlegung: Ich arbeite an VibUI, einer kostenpflichtigen Bibliothek von Website-Prompts. Sie wird einmal verlinkt, ganz am Ende.
Die Vorschau sah großartig aus, also hast du npm install lokal ausgeführt und bist Kaffee holen gegangen. Als du zurückkamst, lief es noch immer. node_modules ist inzwischen ungefähr so groß wie ein kleiner Film, und package.json enthält drei Pakete, von denen du nie gehört hast, zwei Icon-Bibliotheken und eine Animationsbibliothek für eine Seite mit genau einem Fade-in.
Niemand hat das alles bewusst ausgewählt. Ein Tool griff nach dem, was den unmittelbaren Prompt löste, löste dann den nächsten mit etwas anderem und räumte nie auf. Das ist nicht bösartig. Aber es ist dein Problem, sobald die Seite unter deinem Namen live geht.
Hier ist die zehnminütige Durchsicht, die ich vor dem Mergen von allem Generierten machen würde.
npm ls --depth=0 # nur direkte Abhängigkeiten cat package.json | less # Abhängigkeiten vs. devDependencies überfliegen Enter fullscreen mode Exit fullscreen mode Lies die Namen laut vor. Alles, was du nicht in einem Satz erklären kannst, kommt auf eine Liste.
npx depcheck Enter fullscreen mode Exit fullscreen mode depcheck meldet Pakete, die installiert, aber nie importiert wurden. Generierte Projekte sammeln solche an, wenn das Tool einen Ansatz ausprobiert, wechselt und den ersten zurücklässt. Es ist nicht perfekt (Nutzung nur über die Config kann ihm entgehen), also behandle die Ausgabe als Liste von Verdächtigen, nicht als Urteil.
npm audit # bekannte Probleme im Abhängigkeitsbaum npm outdated # was veraltet ist du -sh node_modules # ein grobes Gefühl fürs Gewicht Enter fullscreen mode Exit fullscreen mode Die Ausgabe von npm audit kann sehr lang sein, schau also darauf, was in Produktion erreichbar ist, und nicht nur auf die Zahl. Und prüfe die Lizenzen, falls das Projekt für einen Kunden ist:
npx license-checker --summary Enter fullscreen mode Exit fullscreen mode 5. Prüfe, wo die Secrets liegen Während du in den Dateien bist, suche nach Schlüsseln:
rg -n "(api[_-]?key|secret|token)" --glob '!node_modules' --glob '!package-lock.json' Enter fullscreen mode Exit fullscreen mode Alles im clientseitigen Code ist öffentlich. Falls ein Schlüssel jemals in einen Chat eingefügt wurde, um die API zum Laufen zu bringen, behandle ihn als kompromittiert und rotiere ihn.
Abhängigkeiten: Füge keine neuen Pakete hinzu, außer ich genehmige sie. Bevorzuge eingebaute Browser-Features (CSS, <dialog>, <details>, fetch, Intl) gegenüber Bibliotheken. Falls ein Paket wirklich gebraucht wird, nenne es, sage, was es ersetzt, und gib seine ungefähre Größe an. Lege niemals API-Schlüssel in den Client-Code. Liste am Ende jeder Antwort die hinzugefügten Pakete auf. Enter fullscreen mode Exit fullscreen mode Diese letzte Zeile ist die entscheidende. Sie bringt das Tool zum Gestehen, was ein Mysterium in einen Diff verwandelt.
Dieselbe Regel, für jedes Tool: v0, Lovable, Bolt, Cursor, Windsurf, Claude, ChatGPT, Gemini, Replit, GitHub Copilot, Framer AI, Google Stitch, Readdy, Aura.build, OpenAI Codex. Editoren, die dein Repo sehen können, halten sich meist am besten daran, und bei Chat-Tools muss die Abhängigkeitsliste eingefügt werden, damit sie wissen, was bereits existiert.
Viele Abhängigkeits-Wucher beginnt mit einer Sektion, die "ein bisschen Animation" oder "ein schönes Karussell" braucht. Von einer Sektion auszugehen, die das bereits in purem CSS umsetzt, bedeutet weniger, was später entfernt werden muss. Das ist das Versprechen.
Wenn du diese Behauptung testen willst: VibUI ist die Bibliothek, an der ich arbeite: 2.852 Website-Prompt-Vorlagen (775 Seiten, 1.100 Sektionen, 817 Komponenten, 160 animierte Hintergründe), davon rund 1.000 mit Quellcode. Einmalzahlung ohne automatische Verlängerung: 48 $ vierteljährlich, 99 $ jährlich, 179 $ lebenslang (heruntergesetzt von 384 $). Jährlich und lebenslang enthalten zusätzlich 2.407 KI-Video-Prompts. Es gibt 60 kostenlose Beispiele, und ein kostenloses Konto kann 2 Prompts kopieren. Öffne ein kostenloses Beispiel mit Quellcode, führe es durch die obigen Schritte und sieh, wie viele Pakete es verlangt hat.
Expand Abdullah Naseer Abdullah Naseer Abdullah Naseer Follow Möchtest du mehr über mich wissen? I Can Be Your Manager Or a Worker Hier ist meine Insta-ID 👉: wogfl Komm vorbei, wenn du etwas brauchst 🤞 Beigetreten am 26. Okt. 2026 • 1. Dez. Dropdown menu Copy link Hide Dein Schritt 2 ist der, den ich an die erste Stelle setzen würde: npx depcheck findet die Pakete, die niemand importiert, und in einem generierten Projekt verstecken sich dort meist die zwei Icon-Bibliotheken und die Animationsbibliothek für einen einzigen Fade-in. Was ich ergänzen würde, ist das Lockfile: package.json kann ordentlich aussehen, während package-lock.json die Duplikate weiterhin enthält, deshalb würde ich vor dem Mergen auch das Lockfile diffen.
Und depcheck kann dynamisch importierte Pakete übersehen, daher ist eine Null bei depcheck nicht ganz ein makelloses Zeugnis. Welcher deiner fünf Checks findet in der Praxis meist am meisten: die ungenutzten Pakete, die Dubletten oder die Suche nach Secrets?
Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.
Original (Englisch) anzeigen
Disclosure: I work on VibUI, a paid library of website prompts. It's linked once, at the very end.
The preview looked great, so you ran npm install locally and went to make coffee. When you came back it was still going. node_modules is now roughly the size of a small film, and package.json contains three packages you've never heard of, two icon libraries and an animation library for a page that has one fade-in.
Nobody chose any of that. A tool reaching for whatever solved the immediate prompt, then solved the next one with something else, and never went back to tidy up. It's not malicious. It's also your problem the moment the page goes live under your name.
Here's the ten-minute read-through I'd do before merging anything generated.
npm ls --depth=0 # direct dependencies only cat package.json | less # skim dependencies vs devDependencies Enter fullscreen mode Exit fullscreen mode Read the names out loud. Anything you can't explain in a sentence goes on a list.
npx depcheck Enter fullscreen mode Exit fullscreen mode depcheck reports packages that are installed but never imported. Generated projects collect these when the tool tries one approach, switches, and leaves the first one behind. It's not perfect (it can miss config-only usage), so treat the output as a list of suspects, not a verdict.
npm audit # known issues in the tree npm outdated # what's behind du -sh node_modules # a rough sense of weight Enter fullscreen mode Exit fullscreen mode npm audit output can be noisy, so look at what's reachable in production, not only the count. And check the licences if the project is for a client:
npx license-checker --summary Enter fullscreen mode Exit fullscreen mode 5. Check where the secrets are While you're in the files, search for keys:
rg -n "(api[_-]?key|secret|token)" --glob '!node_modules' --glob '!package-lock.json' Enter fullscreen mode Exit fullscreen mode Anything in client-side code is public. If a key was ever pasted into a chat to "make the API work", treat it as exposed and rotate it.
Dependencies: add no new packages unless I approve them. Prefer built-in browser features (CSS, <dialog>, <details>, fetch, Intl) over libraries. If a package is truly needed, name it, say what it replaces, and give its approximate size. Never put API keys in client code. At the end of every reply, list the packages you added. Enter fullscreen mode Exit fullscreen mode That last line is the one that matters. It makes the tool confess, which turns a mystery into a diff.
Same rule, any tool: v0, Lovable, Bolt, Cursor, Windsurf, Claude, ChatGPT, Gemini, Replit, GitHub Copilot, Framer AI, Google Stitch, Readdy, Aura.build, OpenAI Codex. The editors that can see your repo tend to follow it best, and the chat tools need the dependency list pasted in so they know what already exists.
A lot of dependency creep starts with a section that needs "a bit of animation" or "a nice carousel." Starting from a section that already does it in plain CSS means less to remove later. That's the pitch.
If you want to test that claim: VibUI is the library I work on: 2,852 website prompt templates (775 pages, 1,100 sections, 817 components, 160 animated backgrounds), about 1,000 of them with source code. It's one-time pricing with no auto-renewal: $48 quarterly, $99 yearly, $179 lifetime (listed down from $384). Yearly and lifetime also include 2,407 AI video prompts. There are 60 free samples, and a free account can copy 2 prompts. Open a free sample with source code, run it through the steps above, and see how many packages it asked for.
Expand Abdullah Naseer Abdullah Naseer Abdullah Naseer Follow Need to know about me? I Can Be Your Manager Or a Worker Here's My Insta ID 👉: wogfl Come if you need Anything 🤞 Joined Oct 26, 2026 • Dec 1 Dropdown menu Copy link Hide Your step 2 is the one I would put first — npx depcheck catches the packages nobody imports, and in a generated project that is usually where the two icon libraries and the animation library for one fade-in are hiding. The gap I would add is the lockfile: package.json can look tidy while package-lock.json still carries the duplicates, so I would also diff the lockfile before merging.
And depcheck can miss dynamically imported packages, so a zero from depcheck is not quite a clean bill of health. Which of your five checks usually catches the most in practice — the unused packages, the doubles, or the secrets search?