Claude Code Befehle

Stand: Oktober 2025 | Version: v2.0+


TL;DR

Claude Code ist ein Terminal-basierter Coding-Agent, der Files editiert, Commands ausführt und Git-Workflows managed – alles via Natural Language. Läuft lokal oder cloud-basiert, versteht komplette Codebases, macht Multi-File-Edits und integriert externe Tools via MCP.

Key Features: Direktes Action-Taking, Sub-Agents, Custom Commands, Hooks, CLAUDE.md Context-Priming, Enterprise-ready (AWS/GCP)


Installation & Setup

Voraussetzungen

  • Claude Pro/Max Subscription ODER API-Zugang
  • Terminal (macOS/Linux/Windows)

Installation

# API-Key setzen (optional, alternativ Browser-Auth)
export ANTHROPIC_API_KEY="your-key"
 
# Claude Code starten
claude
 
# Mit Skip-Permissions (YOLO-Mode)
claude --dangerously-skip-permissions
 
# Mit MCP-Debug
claude --mcp-debug

Modelle

  • Claude Sonnet 4.5 (claude-sonnet-4-20250514) – Default, effizient
  • Claude Opus 4.1 – Falls aktiviert; Auto-Switch bei 50% Usage zu Sonnet

Core Fähigkeiten

KategorieFeatures
Code-EditingMulti-File-Edits, Refactoring, Dokumentation, großer File-Support (18k+ Zeilen)
Git-WorkflowsCommits, PRs, Branches, Rebases, Merge-Konflikte, Review-Comments fixen
TerminalShell-Commands, Package-Installation, Tests ausführen
DebuggingError-Analyse, Trace-Execution, Dependency-Checks
Codebase-NavigationProjektstruktur verstehen, Git-History durchsuchen, Ownership-Queries
Externe ToolsWeb-Fetch (Docs/StackOverflow), MCP-Integration (Drive, Jira, Figma, Slack)

Wichtigste Commands

Built-in Slash Commands

/help              # Alle Commands anzeigen (inkl. Custom + MCP)
/clear             # Chat & Context resetten (spart Tokens!)
/rewind            # Context + Code-State zurückspulen (Doppel-Esc)
/permissions       # Erlaubte Commands ohne Nachfrage definieren
/agents            # Sub-Agents erstellen/managen
/install-github-app # Automatische PR-Reviews aktivieren
/bug               # Bug-Report an Anthropic

File-Referencing

@filename.py       # File ins Context-Window laden
@src/components/   # Ganzen Ordner referenzieren
Shift + Drag       # Files proper ins Chat ziehen (nicht nur öffnen)

Shell-Commands

!git status        # Direkter Shell-Befehl (ohne Conversational Overhead)
!pytest tests/     # Commands via ! für Token-Effizienz

Advanced Features

1. Custom Slash Commands

Speicherort:

  • Projekt: .claude/commands/<name>.md
  • Global: ~/.claude/commands/<name>.md

Template-Beispiel:

<!-- .claude/commands/review.md -->
Perform comprehensive code review of recent changes:
 
1. Check code follows TypeScript/React conventions
2. Verify error handling and loading states
3. Ensure accessibility standards (ARIA, keyboard nav)
4. Review test coverage for new functionality
5. Security audit (XSS, injection, auth)
6. Performance implications
7. Documentation updates
 
Target: $ARGUMENTS
 
Use project's code quality checklist and update CLAUDE.md with new patterns.

Verwendung:

/review src/components/Button.tsx

Pro:

  • Team-shared (ins Git committen)
  • $ARGUMENTS für Parameter-Passing
  • Konsistente Workflows

2. Sub-Agents

Konzept: Spezialisierte Agents mit isoliertem Context für parallele Tasks

Hierarchie:

You ↔ Main Claude (Koordinator)
 ├── Code Reviewer (Quality Specialist)
 ├── Test Engineer (Testing Specialist)
 ├── Documentation Writer (Technical Writing)
 └── Error Analyzer (Debugging)

Setup:

/agents
# Claude fragt nach Spec, erstellt .agents/<name>.md
 
# Beispiel: Error Analyzer Agent
Main Chat: "Analyze this bug with the Error Analyzer agent"

Vorteile:

  • Main-Chat bleibt clean
  • Eigene Conversation-History pro Agent
  • Tool-Access limitierbar
  • Parallele Workflows

3. Hooks (Event-basierte Automation)

Speicherort: .claude/settings.json oder ~/.claude/settings.json

Beispiel:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write(*.py)",
        "hooks": [
          {
            "type": "command",
            "command": "python -m black $file"
          }
        ]
      }
    ]
  }
}

Hook-Typen:

  • PreToolUse / PostToolUse
  • PreThinking / PostThinking
  • Custom via SDK (Python/Rust)

Use Cases:

  • Auto-Formatting (Black, Prettier)
  • Linting nach File-Changes
  • Tests nach Code-Edits
  • Notifications (Desktop, Slack)

4. MCP (Model Context Protocol)

Integration externer Tools:

  • Google Drive (Design Docs lesen)
  • Jira/Linear (Tickets updaten)
  • Figma (Designs fetchen)
  • Slack (Notifications)
  • Puppeteer (Browser-Automation)
  • Sentry (Error-Tracking)

Config-Beispiel: .mcp.json

{
  "mcpServers": {
    "google-drive": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-gdrive"],
      "env": {
        "GOOGLE_CLIENT_ID": "...",
        "GOOGLE_CLIENT_SECRET": "..."
      }
    },
    "puppeteer": {
      "command": "npx",
      "args": ["-y", "@anthropic/mcp-server-puppeteer"]
    }
  }
}

Verwendung:

# Claude kann dann:
"Pull latest design from Figma and implement Button component"
"Update Jira ticket PROJ-123 with implementation notes"
"Search Google Drive for Q3 architecture decision docs"

5. CLAUDE.md Context Files

Hierarchie (lädt automatisch beim Start):

  1. Global: ~/.claude/CLAUDE.md – Für alle Projekte
  2. Projekt: .claude/CLAUDE.md – Team-shared (ins Git)
  3. Local: .claude/CLAUDE.local.md – Persönlich (gitignored)

Best Practices:

# Project Context
 
## Tech Stack
- Frontend: React 18 + TypeScript
- State: Zustand
- Styling: Tailwind CSS
- Testing: Vitest + Testing Library
 
## Code Standards
- Use functional components with hooks
- Prefer composition over inheritance
- Error boundaries for all major features
- 80%+ test coverage for business logic
 
## Architecture Decisions
- Feature-based folder structure
- Custom hooks in /hooks
- Shared components in /components/ui
- API layer in /services
 
## Testing Guidelines
- Unit tests for utils and hooks
- Integration tests for features
- E2E tests for critical user flows
- Mock external APIs in tests
 
## Don't
- No class components
- No inline styles
- No console.logs in production
- No direct DOM manipulation

Pro:

  • Spart Tokens (nicht in jedem Prompt wiederholen)
  • Konsistente Code-Quality
  • Onboarding für neue Devs
  • Team-Alignment

Workflow-Modi

Auto Mode (Default)

  • Files direkt editieren ohne Permission
  • Problem: Fragt bei jedem File/Command
  • Lösung: claude --dangerously-skip-permissions
  • Risiko: Minimal (keine destruktiven Commands in Praxis gesehen)

Plan Mode

  • Extended Thinking vor Code-Generierung
  • Aktivierung: “Plan first, then implement”
  • Best für: Komplexe Features, Architekturen, Refactorings

Empfohlener Anthropic-Workflow

Für komplexe Features:

1. Research
   "Search codebase for similar implementations"
   "Check git history for why X was designed this way"

2. Plan
   "Create implementation plan with:
    - High-level architecture
    - File changes needed
    - Edge cases to handle
    - Testing strategy"

3. Implement
   "Implement the plan step-by-step with verification"

4. Verify
   "Run tests, check for regressions, verify edge cases"

5. Document
   "Update README/CHANGELOG, add inline docs"

6. PR
   "Commit with descriptive message, create PR"

Warum? Ohne Research + Plan → Claude springt direkt ins Coding → schlechtere Quality bei Non-Trivial-Tasks


Praktische Shortcuts

ShortcutFunktion
EscStop Claude (NICHT Ctrl+C!)
Esc EscMessage-History zum Zurückspringen
Ctrl+VImages pasten (Cmd+V geht nicht)
Shift + DragFiles proper referenzieren
/clearOft nutzen für Token-Effizienz

Settings & Configuration

Hierarchie

  1. User: ~/.claude/settings.json – Global
  2. Project: .claude/settings.json – Team-shared (Git)
  3. Local: .claude/settings.local.json – Persönlich (gitignored)

Beispiel-Config

{
  "model": "claude-sonnet-4-20250514",
  "maxTokens": 4096,
  "permissions": {
    "allowedTools": [
      "Read",
      "Write",
      "Bash(git *)",
      "Bash(npm *)",
      "Bash(pytest *)"
    ],
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Write(./production.config.*)"
    ]
  },
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write(*.py)",
        "hooks": [
          {
            "type": "command",
            "command": "python -m black $file"
          }
        ]
      }
    ]
  }
}

Git-Workflows

Häufige Tasks

# Commit mit Auto-Message
"Commit these changes with a descriptive message"
 
# PR erstellen
"Create PR for this feature" oder "pr"
 
# Review-Comments fixen
"Fix all review comments on PR #123 and push"
 
# Git-History durchsuchen
"What changes made it into v1.2.3?"
"Who owns the authentication feature?"
"Why was this API designed this way? Check git history"
 
# Merge-Konflikte
"Resolve merge conflicts in src/components/Button.tsx"
 
# Branch-Operations
"Create feature branch for X"
"Cherry-pick commit abc123 to main"

Pro-Tips

Token-Effizienz

  • /clear nutzen bei neuem Task (alte History weg)
  • !command für Shell (kein Conversational Overhead)
  • Spezifische @file-References statt ganzes Repo

File-Handling

  • Shift + Drag für Referencing (nicht normales Drag)
  • Large Files: Claude Code handled 18k+ Zeilen besser als Cursor/Copilot

Permissions

  • --dangerously-skip-permissions für produktives Arbeiten
  • Alternativ: /permissions für Allow-List

Quality

  • CLAUDE.md nutzen für konsistente Standards
  • Plan Mode bei komplexen Features
  • Sub-Agents für spezialisierte Reviews

Häufige Use Cases

Code-Review

/review src/features/auth
# Verwendet Custom Command mit Quality-Checklist

Debugging

"Analyze this error: [paste error]
- Classify error type and severity
- Trace execution path
- Check environment/dependencies
- Propose fix with tests"

Refactoring

"Refactor src/utils/api.ts:
- Extract repeated logic into hooks
- Add TypeScript types
- Improve error handling
- Update tests"

Documentation

"Document all functions in src/services/ with:
- JSDoc comments
- Parameter descriptions
- Return types
- Usage examples"

Testing

"Generate tests for src/hooks/useAuth.ts:
- Unit tests for all branches
- Edge cases (network errors, timeouts)
- Mock external dependencies"

Comparison: Claude Code vs. Cursor

FeatureClaude CodeCursor
Large Files✅ Excellent (18k+ Zeilen)⚠️ Struggles
Multi-File Edits✅ Strong Context✅ Good
Patch Resolution✅ Reliable⚠️ Hiccups
InterfaceTerminalGUI/Editor
Customization✅ Hooks, Commands, MCPLimited
Git Integration✅ Native✅ Good
Sub-Agents✅ Yes❌ No
PermissionsConfigurableYolo-Mode


Neuro-AI Workflow-Beispiele (für dich)

Custom Commands Ideen

.claude/commands/benchmark.md:

Run benchmark suite for RL agent:
 
1. Execute training run with current hyperparameters
2. Log metrics (reward, loss, episode length)
3. Compare against baseline in results/baseline.json
4. Generate visualization plots
5. Update RESULTS.md with findings
 
Config: $ARGUMENTS (e.g., "CartPole-v1 --episodes 1000")

.claude/commands/paper-implement.md:

Implement algorithm from paper:
 
1. Search arXiv/web for paper details
2. Extract key equations and pseudocode
3. Design Python class structure
4. Implement core algorithm
5. Write unit tests for components
6. Create example notebook
 
Paper: $ARGUMENTS (e.g., "PPO Schulman 2017")

.claude/commands/visualize.md:

Create visualization for experiment results:
 
1. Load data from results/$ARGUMENTS
2. Generate plots: learning curve, reward distribution, loss trends
3. Statistical analysis (mean, std, significance tests)
4. Save to figures/ with descriptive names
5. Update README with findings

CLAUDE.md für Neuro-AI Project

# Reward Rover – RL Agent Framework
 
## Tech Stack
- Core: Python 3.11, PyTorch 2.0
- RL: Stable-Baselines3, Gymnasium
- Viz: Matplotlib, Seaborn, Plotly
- Experiment Tracking: Weights & Biases
 
## Code Standards
- Type hints mandatory (mypy strict)
- Docstrings: Google style
- Test coverage: >85%
- Black formatting, isort imports
 
## Project Structure
- `/agents` – RL algorithm implementations
- `/envs` – Custom Gymnasium environments
- `/experiments` – Training scripts & configs
- `/results` – Logs, checkpoints, metrics
- `/notebooks` – Analysis & visualization
 
## Best Practices
- Separate training/eval code
- Seed all RNGs for reproducibility
- Log hyperparameters to W&B
- Checkpoint every N episodes
- Vectorized environments for speed
 
## Testing Guidelines
- Unit tests for agent components
- Integration tests for training loops
- Performance benchmarks vs. baselines
- Reproducibility tests (same seed → same results)

Tags

tools ai coding claude terminal workflow automation


Last Updated: Oktober 2025 | Claude Sonnet 4.5

see also

Type:
Tags:
Status:
Location:
Created: 2025-10-30 15:41

Source