ai newsMo., 26. Okt.
EilmeldungLLM-Agent versucht, selbst Geld zu verdienen: Messergebnis in fremdem Release gelandet, Bilanz weiterhin null Dollar

Warum KI-Agenten Komponenten neu erfinden statt bestehende zu installieren

Fügt man Cursor oder Claude Code einen Link zu einer gewünschten Komponente hinzu, entsteht meist eine eigene, optisch abweichende Nachbildung statt der Original-Komponente. Eine Component Registry soll Agenten anweisen, echte Pakete zu installieren.

dev.toSonntag 18:18 · 25.10.DE4 Min. Lesezeit
Bild: dev.to

Du findest ein Hero-Block-Bundle, das dir gefällt. Du fügst den Link in Cursor oder Claude Code ein und bittest um „diesen Hero auf meiner Landingpage“. Eine Minute später hast du einen Hero: mit anderem Abstand, einem anderen Gradient und ohne Einblendanimation. Er sieht aus wie jede andere KI-generierte Landingpage.

Ich habe eine Komponenten-Registry genau für diesen Workflow gebaut und lange Zeit damit verbracht herauszufinden, wo das Design verloren geht. Kurzfassung: nicht im Code. Es geht in der Zusammenfassung verloren.

Komponente auswählen → Anweisung kopieren → in den Agenten einfügen → der Agent führt `npx shadcn add <url>` aus → dein Projekt enthält exakt das, was die Vorschau gezeigt hat Enter fullscreen mode Exit fullscreen mode Die Anweisung wird aus den Metadaten der Komponente generiert, nicht von Hand geschrieben: Komponenten-ID, Installationsbefehl, Abhängigkeiten, was beibehalten werden soll (Motion, Typografie, Abstände, responsives Verhalten), was sich ändern darf (Texte, Links, Akzentfarbe) und eine ausdrückliche Regel, sie nicht von Grund auf neu zu bauen.

Auf dem Papier reicht das. In der Praxis brach es an zwei Stellen.

Wenn ein Agent eine URL „liest“, liest er sie in der Regel gar nicht. Das Web-Fetch-Tool leitet die Seite durch ein kleines Modell und gibt einen Digest zurück. Befehle und Fakten überleben den Digest. Prosa-Regeln wie „behalte die Einblendanimation“ oder „ändere das Grid nicht“ sind das Erste, was verloren geht.

Also installiert der Agent die Komponente korrekt … und „verbessert“ sie dann, weil der Teil, der sagte, dass er das nicht soll, ihn nie erreicht hat.

Wenn die Anweisung die Komponente beschreibt („ein Hero mit einem Gradient und zwei Buttons“), schreibt der Agent selbst einen Hero mit einem Gradient und zwei Buttons. Eine Beschreibung ist eine Spezifikation, und ein Agent mit einer Spezifikation baut.

Die Anweisung sollte also das Aussehen überhaupt nicht beschreiben. Sie sollte sagen: Hier ist der Befehl, hier ist der Quellcode, installiere es.

Zwei bis drei „Keep as installed“-Regeln ins Briefing aufzunehmen reicht nicht aus. Dupliziere sie an Stellen, die niemand zusammenfasst.

1. Das Briefing. Vollständiger Text, für den Menschen und (im besten Fall) für den Agenten.

2. Das docs-Feld des Registry-Eintrags. Die shadcn CLI gibt es nach der Installation im Terminal aus. Der Agent sieht sie als Befehlsausgabe, wortwörtlich, ohne Zusammenfassung dazwischen. Hier ist ein echtes Beispiel aus https://vibeui.club/r/en/hero-001.json:

Keep as installed: - die button-016-, heading-001-Imports aus @/components/vibeui/ — ihren Code nicht in den Block inlining und nicht durch eigene ersetzen; die Teile erhalten nur Props - light-dark() in der Palette: die Komponente muss dem umgebenden color-scheme folgen, anstatt ein eigenes Dark Theme mitzuliefern - der transparente Hintergrund als Standard — die Komponente sitzt auf dem Seitenhintergrund, statt selbst ein Panel unter sich zu legen Enter fullscreen mode Exit fullscreen mode 3. Ein Kommentar am Anfang der Datei. Die Datei wird Byte für Byte geschrieben, sodass die Regeln im Code landen, den der Agent gleich bearbeiten wird:

" use client " // VibeUI hero-001. Keep as installed: // - die button-016-, heading-001-Imports... // - light-dark() in der Palette... Enter fullscreen mode Exit fullscreen mode Eine Stolperfalle: Die shadcn CLI führt Dateien, die mit einer "use client"-Direktive beginnen, durch ts-morph und entfernt Kommentare, die vor der Direktive stehen. Der Header muss daher dahinter. Das Ganze umfasst etwa 20 Zeilen:

export function withPreserveHeader ( source: string, rules: string [], name: string ) { if ( rules. length === 0 ) return source const header = [ `// VibeUI ${ name }. Keep as installed:`,... rules. map (( r ) => `// - ${ r } ` ), "", "" ]. join ( " \n " ) // comments before "use client" are lost by the CLI, so the header goes after it const directive = /^ ([ "' ] use client [ "' ];?\r?\n)\r?\n? /. exec ( source ) return directive? ` ${ directive [ 1 ]} \n ${ header }${ source. slice ( directive [ 0 ]. length )} `: header + source } Enter fullscreen mode Exit fullscreen mode Regeln helfen nichts, wenn die Komponente im Projekt von jemand anderem bricht Der Agent wird deine Komponente in ein Projekt einfügen, das du nie gesehen hast. Was sich als zwingend notwendig herausstellte:

Ich nutze dieses Setup in VibeUI: einem shadcn-kompatiblen Katalog mit über 2.000 React/Tailwind-Komponenten und Landing-Blocks, bei dem jeder Eintrag ein „Copy for AI“-Briefing hat. Vorschauen und Suche sind ohne Konto offen zugänglich. Falls du das Problem „der Agent schreibt meine Komponente um“ anders gelöst hast, würde ich gerne in den Kommentaren erfahren, wie.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

You find a hero block you like. You paste the link into Cursor or Claude Code and ask for "this hero on my landing page". A minute later you have a hero: different spacing, a different gradient, no entrance animation. It looks like every other AI-generated landing page.

I build a component registry for this exact workflow, and I spent a long time finding out where the design gets lost. Short version: not in the code. It gets lost in the summary.

pick a component → copy an instruction → paste it into the agent → agent runs `npx shadcn add <url>` → your project has exactly what the preview showed Enter fullscreen mode Exit fullscreen mode The instruction is generated from the component's metadata, not hand-written: component ID, install command, dependencies, what to keep (motion, typography, spacing, responsive behaviour), what may change (copy, links, accent colour), and an explicit rule not to rebuild it from scratch.

On paper that's enough. In practice it broke in two places.

When an agent "reads" a URL, it usually doesn't read it. The web-fetch tool passes the page through a small model and returns a digest. Commands and facts survive the digest. Prose rules — "keep the entrance animation", "don't change the grid" — are the first thing to go.

So the agent installs the component correctly… and then "improves" it, because the part that said don't never reached it.

If the instruction describes the component ("a hero with a gradient and two buttons"), the agent writes a hero with a gradient and two buttons. Itself. A description is a spec, and an agent with a spec builds.

So the instruction should not describe the look at all. It should say: here's the command, here's the source, install it.

Putting 2–3 "keep as installed" rules in the brief is not enough. Duplicate them into places nobody summarises.

1. The brief. Full text, for the human and (best case) the agent.

2. The docs field of the registry item. The shadcn CLI prints it to the terminal after install. The agent sees it as command output, verbatim, no summary in between. Here is a real one from https://vibeui.club/r/en/hero-001.json:

Keep as installed: - the button-016, heading-001 imports from @/components/vibeui/ — do not inline their code into the block or swap in your own; the parts receive props only - light-dark() in the palette: the component has to follow the surrounding color-scheme rather than ship a dark theme of its own - the transparent background by default — the component sits on the page background instead of laying a panel under itself Enter fullscreen mode Exit fullscreen mode 3. A comment at the top of the file. The file is written byte for byte, so the rules end up inside the code the agent is about to edit:

" use client " // VibeUI hero-001. Keep as installed: // - the button-016, heading-001 imports... // - light-dark() in the palette... Enter fullscreen mode Exit fullscreen mode One gotcha: the shadcn CLI runs files that start with a "use client" directive through ts-morph and drops comments that sit before the directive. The header has to go after it. The whole thing is about 20 lines:

export function withPreserveHeader ( source: string, rules: string [], name: string ) { if ( rules. length === 0 ) return source const header = [ `// VibeUI ${ name }. Keep as installed:`,... rules. map (( r ) => `// - ${ r } ` ), "", "" ]. join ( " \n " ) // comments before "use client" are lost by the CLI, so the header goes after it const directive = /^ ([ "' ] use client [ "' ];?\r?\n)\r?\n? /. exec ( source ) return directive? ` ${ directive [ 1 ]} \n ${ header }${ source. slice ( directive [ 0 ]. length )} `: header + source } Enter fullscreen mode Exit fullscreen mode Rules don't help if the component breaks in someone else's project The agent will drop your component into a project you've never seen. What turned out to be mandatory:

I use this setup in VibeUI: a shadcn-compatible catalog of 2,000+ React/Tailwind components and landing blocks where every item has a "Copy for AI" brief. Previews and search are open without an account. If you've solved the "agent rewrites my component" problem differently, I'd like to hear how in the comments.

Originaltitel: Why your AI agent recreates components instead of installing themQuelle: dev.to (dev.to). Original öffnen