# Portabilität: UNIVERSAL
# Version: 2.0.0
# Zuletzt validiert: 2026-05-17
# Nächste Prüfung: 2026-11-17

CLAUDE CODE - KURZREFERENZ
==========================

Claude Code ist das offizielle CLI-Tool von Anthropic für Claude.
Aktuell: Version 2.1.37+ (Stand Feb 2026)

INSTALLATION (EMPFOHLEN: Native, NICHT npm!)
---------------------------------------------
  # Windows PowerShell
  irm https://claude.ai/install.ps1 | iex

  # macOS/Linux/WSL
  curl -fsSL https://claude.ai/install.sh | bash

  # Alternativ: Homebrew
  brew install --cask claude-code

  # Alternativ: WinGet
  winget install Anthropic.ClaudeCode

  # VERALTET (nicht empfohlen):
  npm install -g @anthropic-ai/claude-code

STARTEN
-------
  claude                   # Interaktive Session starten
  claude .                 # Im aktuellen Verzeichnis starten
  claude "Prompt"          # Mit Prompt starten
  claude -c                # Letzte Session fortsetzen
  claude -r                # Session auswaehlen zum Fortsetzen
  claude -p "query"        # Non-interaktiv (SDK-Mode, dann Exit)

WICHTIGE KOMMANDOS
------------------
  claude update            Updates installieren
  claude doctor            Installation prüfen
  claude mcp               MCP-Server konfigurieren
  claude install           Zu Native-Installation migrieren
  claude setup-token       Auth-Token einrichten

MODELLE (Stand 2026)
--------------------
  --model default          Je nach Account (Pro/Max/Teams: Opus 4.6)
  --model sonnet           Claude Sonnet 4.5 (schnell, tägliche Tasks)
  --model opus             Claude Opus 4.6 (komplex, beste Reasoning)
  --model haiku            Claude Haiku (schnellstes, guenstigstes)
  --model sonnet[1m]       Sonnet mit 1M Token Context
  --model opusplan         Opus für Plan-Mode, Sonnet für Execution

  Effort Level (Opus 4.6): low, medium, high (Standard)
  Env: CLAUDE_CODE_EFFORT_LEVEL=low|medium|high

WICHTIGE OPTIONEN (Auswahl - 50+ verfügbar!)
----------------------------------------------
  -c, --continue           Letzte Session fortsetzen
  -r, --resume [id]        Session per ID/Name fortsetzen
  -p, --print              Ausgabe drucken und beenden (für Pipes)
  --model <alias|name>     Modell waehlen
  --add-dir <dir>          Zusätzliche Verzeichnisse erlauben
  --system-prompt "..."    System-Prompt ERSETZEN
  --append-system-prompt "..." System-Prompt ERWEITERN (empfohlen!)
  --tools "Bash,Edit,Read" Nur bestimmte Tools aktivieren
  --allowedTools "..."     Tools ohne Permission-Prompt
  --disallowedTools "..."  Tools verbieten
  --permission-mode <mode> Plan/acceptEdits/default
  --dangerously-skip-permissions  Alle Prompts überspringen (ACHTUNG!)
  --output-format json     JSON Output (text/json/stream-json)
  --max-turns N            Max. agentic Turns (print mode)
  --max-budget-usd N       Max. Dollar für API Calls
  --chrome                 Chrome Browser Integration
  --ide                    Auto-Connect zu IDE
  --verbose                Verbose Logging
  --debug "api,mcp"        Debug-Mode mit Kategorien
  --mcp-config <file>      MCP-Server aus JSON laden
  --agents '{...}'         Custom Subagents definieren
  --fork-session           Neue Session-ID beim Resume
  --from-pr N              Sessions von GitHub PR N
  --remote "task"          Web-Session auf claude.ai starten
  --teleport               Web-Session lokal fortsetzen

PERMISSIONS
-----------
  --permission-mode <mode>
    default                Standard (fragt nach)
    acceptEdits            Edits automatisch akzeptieren
    plan                   Nur Plan-Modus

  --dangerously-skip-permissions  ALLE Prompts umgehen (Vorsicht!)
  --allow-dangerously-skip-permissions  Bypass erlauben (nicht aktivieren)

  BACH Permission-Profile (empfohlen für Remote Control):
    bach permissions list              Profile anzeigen
    bach permissions activate <profil> Profil in settings.json schreiben
    bach permissions deactivate        Normal-Profil wiederherstellen
    -> Siehe: permissions.txt für Details

AUSGABEFORMATE (mit -p)
-----------------------
  --output-format text           Text (Standard)
  --output-format json           JSON (einzelnes Ergebnis)
  --output-format stream-json    Echtzeit-Streaming
  --include-partial-messages     Partial Events (mit stream-json)

SYSTEM-PROMPT FLAGS
-------------------
  --system-prompt "..."              ERSETZT gesamten Default-Prompt
  --system-prompt-file <file>        ERSETZT mit Datei (print mode only)
  --append-system-prompt "..."       ERWEITERT Default-Prompt (empfohlen!)
  --append-system-prompt-file <file> ERWEITERT mit Datei (print mode)

  Faustregel: --append-* bevorzugen (behält Claude Code Fähigkeiten)

SUBAGENTS (--agents Flag)
-------------------------
  JSON-Format für Custom Subagents:
  --agents '{
    "reviewer": {
      "description": "Code reviewer",
      "prompt": "You are a senior code reviewer...",
      "tools": ["Read", "Grep", "Glob"],
      "model": "sonnet"
    }
  }'

UMGEBUNGSVARIABLEN (Auswahl)
-----------------------------
  ANTHROPIC_MODEL=<alias|name>       Default-Modell
  ANTHROPIC_DEFAULT_OPUS_MODEL=...   Opus Alias Mapping
  ANTHROPIC_DEFAULT_SONNET_MODEL=... Sonnet Alias Mapping
  ANTHROPIC_DEFAULT_HAIKU_MODEL=...  Haiku Alias Mapping
  CLAUDE_CODE_SUBAGENT_MODEL=...     Subagent-Modell
  CLAUDE_CODE_EFFORT_LEVEL=low|med|high  Opus Effort
  DISABLE_PROMPT_CACHING=1           Prompt Caching global aus
  DISABLE_AUTOUPDATER=1              Auto-Updates deaktivieren
  CLAUDE_CODE_GIT_BASH_PATH=...      Git Bash Pfad (Windows)

BEISPIELE
---------
  # Interaktiv im BACH-Verzeichnis
  cd "<BACH_WORKSPACE>"
  claude

  # Mit Opus 4.6 und Extended Context
  claude --model opus[1m]

  # Letzte Session fortsetzen
  claude -c

  # Non-interaktiv (für Scripts)
  claude -p "Liste alle Python-Dateien auf"

  # Mit zusätzlichem Verzeichnis
  claude --add-dir "C:\MeinProjekt"

  # Custom System Prompt (erweitert, nicht ersetzt)
  claude --append-system-prompt "Nutze TypeScript, keine any-Types"

  # Opus für Planning, Sonnet für Execution
  claude --model opusplan

  # JSON Output für Scripting
  claude -p --output-format json "Finde alle TODOs"

  # Mit MCP-Server Config
  claude --mcp-config ./mcp.json

  # Chrome-Integration
  claude --chrome

  # Max Budget limitieren
  claude -p --max-budget-usd 5.00 "Grosse Analyse"

AUTHENTICATION
--------------
  1. Claude Pro/Max (empfohlen): Login via claude.ai Account
  2. Claude Console: OAuth via console.anthropic.com
  3. Teams/Enterprise: Team-Login via claude.ai
  4. Cloud Provider: Bedrock/Vertex/Foundry Config

AUTO-UPDATES
------------
  Native Installation: Auto-Update alle paar Stunden (im Hintergrund)
  Homebrew/WinGet: Manuell mit `brew upgrade` / `winget upgrade`

  Release Channels:
    - latest (Standard, neue Features sofort)
    - stable (~1 Woche alt, Skip bei Regressions)

  Config: /config → Auto-update channel
  Oder: settings.json → "autoUpdatesChannel": "stable"

SIEHE AUCH
----------
  https://code.claude.com/docs/en/cli-reference  Vollständige CLI-Referenz
  https://code.claude.com/docs/en/setup          Setup & Installation
  permissions.txt                           BACH Permission-Profile
  claude-code-automatisierung.txt           Automatisierung
  wiki/claude-code.txt                      BACH Wiki (falls vorhanden)
  wiki/gemini.txt                           Gemini CLI/Antigravity
  wiki/ollama.txt                           Lokale LLMs

QUELLEN (Stand 2026-02-08)
--------------------------
  - https://code.claude.com/docs/en/cli-reference
  - https://code.claude.com/docs/en/setup
  - https://code.claude.com/docs/en/model-config
  - https://www.npmjs.com/package/@anthropic-ai/claude-code
  - https://github.com/anthropics/claude-code
