Startseite / Artikel / Claude Code Spickzettel: CLAUDE.md, Hooks, Skills, MCP und Modi

Claude Code Spickzettel: CLAUDE.md, Hooks, Skills, MCP und Modi

Eine Kurzreferenz zu Claude Code: CLAUDE.md, Prompts, Regeln, Hooks, Skills, MCP, Sub-Agents, Worktrees, Berechtigungsmodi, wichtige Befehle und Prompts, die sich lohnen.

1905 Wörter

Claude Code ist der agentische Coding-Assistent von Anthropic. Schnipsel schreiben ist längst nicht alles, was er kann. Er kann:

  • Eine bestehende Codebasis verstehen
  • Mehrere Dateien gleichzeitig lesen und bearbeiten
  • Befehle im Terminal ausführen
  • Tests schreiben und ausführen
  • Fehler aufspüren
  • Code refaktorisieren
  • Git-Operationen erledigen
  • MCP-Tools aufrufen und Hooks auslösen
  • Arbeit an Subagents abgeben
  • Features nach Anweisungen in normaler Sprache bauen

Das grundlegende Denkmodell

You
 ↓
Natural-language prompt
 ↓
Claude Code
 ↓
Understand codebase
 ↓
Plan
 ↓
Read files
 ↓
Modify code
 ↓
Run tests / commands
 ↓
Review result
 ↓
Iterate

Drei Begriffe werden leicht verwechselt. Claude ist das KI-Modell und der Assistent von Anthropic: Es versteht natürliche Sprache, denkt Informationen durch, arbeitet mit Code und Dokumenten und übernimmt viele KI-Aufgaben. Claude Code ist das agentische Coding-Tool, mit dem Claude an einer Codebasis, an Dateien, Terminalbefehlen, Tests, Git und externen Tools arbeitet, um Entwicklungsaufgaben abzuschließen. Ein KI-Agent ist jedes System, das ein Ziel erfasst, Schritte plant, Tools nutzt, handelt, die Ergebnisse prüft und iteriert, bis die Aufgabe erledigt ist. Ein Diagramm sollte man sich merken:

                         🤖 CLAUDE
                            │
                            ↓
                     CLAUDE CODE
                            │
                     ┌──────┴──────┐
                     ↓             ↓
                   PROMPT        RULES
                "Do this"      "Follow this"
                     │             │
                     └──────┬──────┘
                            ↓
                          AGENT
                            │
              ┌─────────────┼─────────────┐
              ↓             ↓             ↓
           Commands       Skills         Tools
              │             │             │
              ↓             ↓             ↓
          /help etc.    Reusable        Terminal
                        capability      Git
                                        Files
                                         │
                              ┌──────────┴──────────┐
                              ↓                     ↓
                             MCP                  HOOKS
                              ↓                     ↓
                       External tools        Automatic actions
                              │
                              ↓
                         SUB-AGENTS
                              ↓
                       Delegated tasks
                              │
                              ↓
                         WORKTREES
                              ↓
                       Isolated Git work

Befehle

Claude Code bringt eine Reihe eingebauter Slash-Befehle mit, die man am besten über die eigene Befehlsliste des Tools lernt.

CLAUDE.md

CLAUDE.md ist eine Datei mit Projektanweisungen. Sie gibt Claude Code projektspezifischen Kontext, Befehle, Architekturnotizen und Coding-Richtlinien, ist also eine Art Projekthandbuch für Claude.

CLAUDE.md

Project:
Android banking application

Architecture:
Clean Architecture + MVVM

Modules:
app
core
network
database
feature-login

Commands:
./gradlew test
./gradlew lint

Rules:
- Use Kotlin
- Use Coroutines
- Use existing centralized utilities
- Add tests for new functionality
- Don't duplicate networking code

Nützlich ist sie, weil die Vorgaben dauerhaft gelten: Entwickler müssen Architektur, Befehle, Konventionen und Regeln nicht ständig neu erklären.

Prompts

Ein Prompt ist die Anweisung in natürlicher Sprache, die der KI sagt, worin Aufgabe oder Ziel bestehen. Ein starker agentischer Prompt lässt erst untersuchen, bevor etwas geändert wird:

First investigate the existing authentication flow.

Do not modify anything yet.

Explain:
- frontend flow
- backend flow
- API involved
- relevant files
- likely problem

Then propose a fix.

After approval, implement it, test it,
review the diff, and commit the changes.

Regeln

Regeln sind Einschränkungen oder Richtlinien dafür, wie der Agent eine Aufgabe ausführt. Größere Projekte können Anweisungen nach Themen in .claude/rules/ aufteilen:

.claude/rules/
├── testing.md
├── security.md
├── frontend.md
├── backend.md
└── android.md

Eine Regeldatei könnte so aussehen:

Rules:

- Use Kotlin.
- Follow MVVM.
- Do not create duplicate utility functions.
- Reuse existing components.
- Write tests for new functionality.
- Do not modify unrelated modules.
- Never expose secrets.
- Run lint before committing.

Hooks

Ein Hook ist eine automatische Aktion, die durch ein bestimmtes Ereignis ausgelöst wird, zum Beispiel ein Befehl oder eine Prüfung nach einer bestimmten Agentenaktion. Hooks bringen Automatisierung, Einheitlichkeit und Leitplanken in die Arbeit des Agenten. Passiert etwas, läuft automatisch eine Aktion. Zum Beispiel:

Before build
     ↓
   HOOK
     ↓
Check:
- formatting
- lint
- dependencies
- tests
     ↓
Build

In einem echten Projekt könnten die Hooks in einem Ordner wie diesem liegen:

.claude/
└── hooks/
      │
      ├── lint
      ├── test
      ├── dependency-check
      ├── security-check
      └── pre-build

Skills

Skills sind wiederverwendbare, spezialisierte Workflows oder Anweisungen, nach Themen abgelegt:

.claude/skills/

├── android-development/
├── compose-ui/
├── kotlin-testing/
├── api-integration/
└── code-review/

Jeder Skill ist ein kurzes Dokument, etwa dieses:

Android Development Skill

When modifying Android code:

- Use Kotlin
- Follow MVVM
- Use Coroutines
- Use StateFlow
- Follow existing architecture
- Add tests
- Run lint
- Avoid duplicate utilities

MCP

MCP, das Model Context Protocol, ist ein standardisiertes Protokoll, über das KI-Anwendungen sich mit externen Tools und Datenquellen verbinden.

Sub-Agents

Sub-Agents sind spezialisierte Agenten, an die der Hauptagent Teile einer größeren Aufgabe delegieren kann, damit komplexe Arbeit aufgeteilt wird:

                 Main Agent
                     │
        ┌────────────┼────────────┐
        ↓            ↓            ↓
    Sub-agent    Sub-agent    Sub-agent
     Backend      Security       Tests
        │            │            │
        └────────────┼────────────┘
                     ↓
                Main Agent
                     ↓
                Final result

Git-Worktrees

Ein Git-Worktree liefert mehrere Arbeitsverzeichnisse, die an verschiedene Branches gebunden sind, sodass mehrere Aufgaben unabhängig vorankommen:

                 Git Repository
                       │
          ┌────────────┼────────────┐
          ↓            ↓            ↓
       Worktree A   Worktree B   Worktree C
       Feature A    Feature B    Bug Fix

Das hilft bei KI-Agenten, weil zwei von ihnen an getrennten Aufgaben arbeiten können, ohne sich ständig in einem Arbeitsverzeichnis in die Quere zu kommen. Ein Worktree ist ein isolierter Arbeitsbereich für Git-Arbeit.

Berechtigungsmodi

Claude Code hat Berechtigungsmodi, die steuern, wie viel Freiheit Claude bei der Nutzung von Tools hat:

┌──────────────────────────────────────────────────────────┐
│                 CLAUDE CODE MODES                       │
├──────────────┬───────────────────────────────────────────┤
│ 🖐 MANUAL    │ Claude asks for approval before actions   │
│              │ or changes. You stay in control.         │
├──────────────┼───────────────────────────────────────────┤
│ ✏️ EDIT      │ Claude can edit the selected text/file    │
│              │ or make the requested code changes.      │
├──────────────┼───────────────────────────────────────────┤
│ 📋 PLAN      │ Claude explores the codebase, analyzes    │
│              │ the problem and presents a plan BEFORE    │
│              │ making edits.                             │
├──────────────┼───────────────────────────────────────────┤
│ ⚡ AUTO      │ Claude can take actions automatically     │
│              │ and automatically check/continue through  │
│              │ the task.                                 │
└──────────────┴───────────────────────────────────────────┘

Welcher Modus passt, hängt davon ab, wie viel Aufsicht die Aufgabe braucht.

README.md oder CLAUDE.md

README.md dokumentiert das Projekt für Menschen, während CLAUDE.md Anweisungen und Kontext eigens für Claude Code enthält.

/clear oder /compact

/clear löscht den aktuellen Gesprächskontext. /compact fasst ihn zusammen und komprimiert ihn, sodass die Arbeit mit weniger Kontext weitergehen kann.

@file

Mit @file verweist man auf eine bestimmte Datei und gibt ihren Inhalt Claude als Kontext für die Aufgabe mit.

Das #-Kürzel

Das Präfix # ist ein schneller Weg, projektspezifische Anweisungen oder Erinnerungen hinzuzufügen.

Warum Tests beim agentischen Coding zählen

Der Agent nimmt echte Änderungen an einer Codebasis vor. Tests zeigen ihm, ob diese Änderungen funktionieren, und helfen ihm, Fehler zu erkennen und zu beheben.

Der finale Spickzettel

Claude
→ Anthropic's AI model/assistant

Claude Code
→ Agentic coding tool

Agent
→ AI that can reason + use tools + take actions

Prompt
→ What I ask it to do

Rules
→ Constraints it must follow

CLAUDE.md
→ Project handbook/instructions

Commands
→ Special controls like /help, /init, /clear, /compact

Hooks
→ Automatic actions triggered by events

Skills
→ Reusable specialized capabilities/instructions

Templates
→ Predefined reusable structure

MCP
→ Connect Claude to external tools/data

Sub-agents
→ Specialized agents delegated work

Worktrees
→ Separate Git workspaces

README.md
→ Human project documentation

CLAUDE.local.md
→ Local/personal project instructions
  where that convention is used

audit_summary.md
→ Usually custom audit report

clone.md
→ Usually custom setup/clone documentation

push_to_github.sh
→ Usually custom Git automation script

push_now.md
→ Usually custom push checklist

Allgemeine Prompts, die man behalten sollte

Ein allgemeiner Einstiegs-Prompt für eine unbekannte Anwendung:

I am new to this application.

Do not modify anything.

Give me a high-level overview of the application.

Explain:
- What the application does
- Main features
- Main technologies
- Project structure
- Modules
- Important packages
- Architecture
- Main entry points
- External services
- Database
- APIs
- Testing
- Build and deployment process

Start with a simple explanation for a developer who is new to this project.

Um die Architektur zu verstehen:

Analyze the architecture of this application.

Do not modify anything.

Explain:

- Architecture pattern
- Modules
- Layers
- Dependency flow
- Data flow
- API layer
- Business layer
- Data layer
- UI layer

Identify the main architectural patterns being used.

Then draw an architecture diagram.

Um die wichtigsten Einstiegspunkte zu finden:

Identify the main entry points of this application.

For each entry point, explain:

- File
- Class/function
- What triggers it
- What it calls next
- Where the request eventually ends

Create a simple flow diagram.

Damit Claude alles testet:

Analyze the changes made in this task.

Identify all relevant tests.

Run:
- Unit tests
- Integration tests
- UI tests where applicable
- Lint
- Type checks
- Build

If anything fails:
- investigate the root cause
- fix it
- rerun the failing checks

At the end, give me a summary of:
PASS / FAIL / NOT RUN

Playwright mit MCP

Für Browser-Automatisierung bitten Sie Claude, einen konfigurierten Playwright-MCP-Server zu nutzen.

Use the Playwright MCP server.

Open the application in the browser.

Visit the login page.

Take a screenshot.

Then:
1. Enter the test credentials.
2. Click Login.
3. Verify that the dashboard appears.
4. Navigate to [PAGE].
5. Click [LINK/BUTTON].
6. Take screenshots at the important steps.
7. Report any errors or unexpected behavior.

Do not modify the application.

Zehn Prompts sollte man sich einprägen:

① OVERVIEW
"Give me an overview of this application."

② STRUCTURE
"Explain the project structure and important files."

③ FLOW
"Trace a user's query from frontend to backend and draw a diagram."

④ DOCUMENT
"Trace how a document is processed from upload to final answer."

⑤ RUN
"How do I run, test, lint and build this application?"

⑥ PLAN
"Analyze the existing implementation and create a plan before editing."

⑦ IMPLEMENT
"Implement this feature, reuse existing code, test it and review the diff."

⑧ DEBUG
"Reproduce this error, find the root cause, fix it and add a regression test."

⑨ UI
"Use Playwright MCP to test the user flow and take screenshots."

⑩ GIT
"Review the diff, run checks, resolve conflicts if needed, and commit."