Zurück zu PodcastsClaude
Claude Code 101
Die CLAUDE.md-Datei
[Music starts]
[Music starts]
One of the most useful parts of Claude Code is the claude.md file.
Einer der nützlichsten Teile von Claude Code ist die CLAUDE.md-Datei.
It gives Claude Code persistent memory about your project.
Sie gibt Claude Code ein dauerhaftes Gedächtnis über Ihr Projekt.
When you open up Claude Code without a claude.md file, it's like it has to start fresh every single time.
Wenn Sie Claude Code ohne eine CLAUDE.md-Datei öffnen, ist es, als müsste es jedes Mal von vorne beginnen.
It has to re-explore your codebase, understand what dependencies are needed and the features that are already implemented.
Es muss Ihre Codebasis neu erkunden, benötigte Abhängigkeiten und bereits implementierte Features verstehen.
Sometimes it has to make assumptions which makes it harder for us to steer Claude in the right direction.
Manchmal muss es Annahmen treffen, was es schwieriger macht, Claude in die richtige Richtung zu lenken.
But that's where claude.md comes in.
Aber genau hier kommt CLAUDE.md ins Spiel.
It's a markdown file that you add to the root of your project and Claude Code reads it automatically every time you start a session.
Es ist eine Markdown-Datei im Stammverzeichnis Ihres Projekts, die Claude Code automatisch liest, wenn Sie eine Sitzung starten.
It's like an onboarding script for your codebase.
Es ist wie ein Onboarding-Skript fur Ihre Codebasis.
Simply put, the contents of claude.md file are appended to your own prompt. You can run the /init command which will make Claude generate one based off of your codebase.
Einfach gesagt: Die Inhalte der claude.md-Datei werden an Ihren Prompt angehängt. Mit /init lässt Claude auf Basis Ihrer Codebasis eine erstellen.
So let's have a look at one.
Schauen wir uns eines an.
This is a Next.js 15 app using the app router, Tailwind, and Drizzle ORM.
Das ist eine Next.js 15-App mit App Router, Tailwind und Drizzle ORM.
Commands: dev server, run tests, lint.
Befehle: Entwicklungsserver, Tests ausfuhren, Lint.
Code style: use two space indentation, prefer named exports, all API routes go in app/api, use server actions instead of API routes where possible.
Code-Stil: zwei Leerzeichen Einrückung, benannte Exports, alle API-Routen in app/api, möglichst Server Actions statt API-Routen.
And it's pretty straightforward.
Und es ist ziemlich unkompliziert.
Now, if I ask Claude Code to create a React component, it knows how to style it with Tailwind or any other CSS framework that I'm using.
Wenn ich Claude Code bitte, eine React-Komponente zu erstellen, weiß es, wie man sie mit Tailwind oder einem anderen CSS-Framework gestaltet.
We can see that Claude does a better job at doing its job right off the bat versus having to understand where everything is at first.
Wir können sehen, dass Claude von Anfang an besser arbeitet, als wenn es erst verstehen müsste, wo sich alles befindet.
And before you ask, the answer is yes.
Und bevor Sie fragen, die Antwort ist ja.
You share this in your version control for your team to use.
Sie teilen dies in Ihrer Versionskontrolle, damit Ihr Team es nutzen kann.
But there's actually a hierarchy of memory files depending on who it's for.
Aber es gibt tatsächlich eine Hierarchie von Speicherdateien, je nachdem, für wen sie gedacht sind.
So first you have your project-level claude.md that lives in the root directory of your project.
Zuerst haben Sie Ihre CLAUDE.md auf Projektebene, die im Stammverzeichnis liegt.
You have a user-level claude.md that lives in your configuration folder.
Sie haben eine CLAUDE.md auf Benutzerebene, die in Ihrem Konfigurationsordner liegt.
This one is just for you and goes across all your projects.
Diese ist nur für Sie und gilt für alle Ihre Projekte.
So put your personal preferences here, like how you write code comments.
Legen Sie hier Ihre persönlichen Präferenzen fest, z.B. wie Sie Code-Kommentare schreiben.
First, if you have to correct Claude to do something, like always use server actions instead of API routes, then explicitly ask Claude to save this to memory so that when you come back to this project, it will know every single time.
Erstens: Wenn Sie Claude korrigieren, etwa Server Actions statt API-Routen, bitten Sie ihn, dies im Speicher zu speichern; so weiß er es bei jedem Projektbesuch.
Second, if you have docs in your project that you want Claude to reference, just use the @ symbol with the file path.
Zweitens: Bei Projektdokumenten für Claude einfach das @-Symbol mit dem Dateipfad nutzen.
And third is we recommend you start off a project without a claude.md file so you can see where you have to constantly course correct the model.
Drittens: Starten Sie ein Projekt zunächst ohne claude.md, um zu sehen, wo Sie das Modell ständig korrigieren müssen.
This keeps your claude.md file compact and contains only the necessary information that Claude can work with.
Dadurch bleibt Ihre CLAUDE.md-Datei kompakt und enthält nur die Informationen, mit denen Claude arbeiten kann.
[Music transition]
[Music transition]
The difference between a frustrating Claude Code session and a productive one comes down to the context, and the claude.md file's how you provide that context.
Der Unterschied zwischen frustrierenden und produktiven Claude Code-Sitzungen liegt im Kontext, und die claude.md ist der Weg, diesen bereitzustellen.
Start with your stack, your preferences, and then commands, and just build from there as you go.
Beginnen Sie mit Ihrem Stack, Ihren Präferenzen und dann den Befehlen, und bauen Sie von dort aus auf.