Files
claude-workflow/CLAUDE.md
T
martin f66af81da2 feat: Ergänze /script-Skill für Bash-Script-Lifecycle
- Neuer Skill /script mit Repo-Check, Opus-Planung, Sonnet-Implementierung, Shellcheck-Pflicht, Test-Empfehlungen, /ship
- auto-format.sh lintet .sh-Dateien via shellcheck
- bootstrap.sh installiert shellcheck automatisch
- /story speichert Pläne jetzt unter <repo-root>/plans/ und bricht ohne Git-Repo ab
- CLAUDE.md-Tabellen für Skills, Hooks und Tools ergänzt
2026-04-21 08:05:47 +02:00

140 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Zweck
Dieses Repository enthält die globale Claude-Code-Workflow-Konfiguration für alle Projekte von Martin Tröger. Es definiert Skills, Agenten, Hooks und Dokumentation — kein ausführbarer Anwendungscode.
## Einrichtung
### Neuer Rechner (2 Schritte)
```bash
git clone https://gitea.troeger-net.org/martin/claude-workflow.git /mnt/projekte/claude-workflow
/mnt/projekte/claude-workflow/bootstrap.sh
```
Das Bootstrap-Skript installiert alle Tools, erstellt alle Symlinks und richtet den Gitea-Token ein.
### Voraussetzungen
| Tool | Zweck | Installieren |
|---|---|---|
| `jq` | Statusline-Parsing | `apt install jq` |
| `ruff` | Python-Formatter (Hook) | `pipx install ruff` |
| `eslint` | JS/TS/Vue-Formatter (Hook) | Projektabhängig |
| `shellcheck` | Bash-Linter (Hook + /script) | `apt install shellcheck` |
| `secret-tool` | Gitea-Token abrufen | `apt install libsecret-tools` |
| `gh` | GitHub CLI | `apt install gh` |
| `go` + `gitea-mcp` | Gitea-MCP-Binary | `go install gitea.com/gitea/gitea-mcp@latest` |
### Gitea-Token einrichten
```bash
secret-tool store --label="Gitea claude-code Token" user claude-code token gitea
```
### Sync zwischen Rechnern
**Pushen (Rechner 1):**
```bash
cd /mnt/projekte/claude-workflow
git add -p && git commit -m "..." && git push
```
**Übernehmen (Rechner 2):**
```bash
cd /mnt/projekte/claude-workflow && git pull
```
Da alles über Symlinks verbunden ist, sind Änderungen sofort aktiv.
## Workflow-Weiterentwicklung
Beim Aktualisieren dieses Workflows immer zuerst die externe Best-Practice-Referenz konsultieren und auf relevante Neuerungen prüfen:
**https://github.com/shanraisshan/claude-code-best-practice**
Vorgehen: URL via `WebFetch` abrufen → mit aktuellem Workflow vergleichen → Abweichungen bewerten → bei Bedarf anpassen.
## Struktur
```
skills/ ← Slash-Commands (Symlinks nach ~/.claude/skills/)
agents/ ← Agenten-Definitionen (Symlinks nach ~/.claude/agents/)
hooks/ ← Shell-Hooks (durch settings.json registriert)
dotfiles/ ← ~/.claude/CLAUDE.md, settings.json, statusline-command.sh
bootstrap.sh ← Einrichtungsskript
```
## Aktivierung (nach Neuinstallation)
Nach System-Neuinstallation `bootstrap.sh` ausführen (erstellt alle Symlinks automatisch).
## Story-Lifecycle
```
Research → Plan (Opus) → /plan-review → Implement (Sonnet) → /go → Security-Audit
```
Kurzbefehl für den gesamten Ablauf: `/story`
| Phase | Befehl | Modell |
|---|---|---|
| Planung | `EnterPlanMode` | Opus 4.6 |
| Plan-Review | `/plan-review` | Opus 4.6 (Subagent) |
| Implementierung | direkt | Sonnet 4.6 |
| Test + Simplify + PR | `/go` | Haiku / Sonnet (Subagenten) |
| Commit + PR + Merge | `/ship` | Sonnet (fork) |
| Security-Audit | `security-audit`-Agent | Opus 4.6 |
## Skills
| Befehl | Datei | Beschreibung |
|---|---|---|
| `/go` | `skills/go/SKILL.md` | test-runner → code-simplifier → Gitea-PR |
| `/ship` | `skills/ship/SKILL.md` | Commit → Push → PR → Merge → Cleanup (finales Kommando) |
| `/plan-review` | `skills/plan-review/SKILL.md` | Startet plan-reviewer-Agent (Opus, fork) |
| `/script` | `skills/script/SKILL.md` | Bash-Script-Lifecycle: Planung (Opus) → Implementierung (Sonnet) → Shellcheck + Test-Empfehlungen → /ship |
| `/story` | `skills/story/SKILL.md` | Voller Lifecycle von Research bis PR |
| `/workflow-review` | `skills/workflow-review/SKILL.md` | Opus reviewt alle Skills/Konfig → Umsetzungsplan für Sonnet |
## Agenten
| Agent | Modell | Tools | Rolle |
|---|---|---|---|
| `plan-reviewer` | Opus 4.6 | Read, Glob, Grep | Prüft Pläne auf Vollständigkeit, Risiken, fehlende Tests |
| `test-runner` | Sonnet | alle | Tests ausführen, Coverage prüfen |
| `security-audit` | Sonnet | alle | OWASP-Analyse, Security-Tests schreiben |
| `n8n-architect` | Sonnet | alle | n8n-Workflow-Design und Refactoring |
## Hooks
| Event | Trigger | Skript | Aktion |
|---|---|---|---|
| `PostToolUse` | Edit / Write | `hooks/auto-format.sh` | `ruff` (Python), `eslint --fix` (JS/TS/Vue) oder `shellcheck` (Bash) |
| `Stop` | Session-Ende | `hooks/verify-on-stop.sh` | Uncommittete Änderungen anzeigen |
`auto-format.sh` liest den Dateipfad aus `$CLAUDE_TOOL_INPUT_FILE_PATH` und erkennt den Typ anhand der Dateiendung.
## Modell-Strategie
- **Opus 4.6**: Planung, Plan-Review, Security-Audit — überall wo Fehlentscheidungen teuer sind
- **Sonnet 4.6**: Implementierung, Refactoring, Bug-Fixes (Standard)
- **Haiku 4.5**: Tests, Lint, Format, PR-Beschreibung
`/fast` aktiviert Opus 4.6 mit schnellerer Ausgabe — sinnvoll bei langen Implementierungen.
## Kontext-Management
- **< 200k Tokens**: Normal weiterarbeiten
- **200350k Tokens**: `/compact "aktueller Stand: [Hinweis]"` ausführen
- **> 350k Tokens**: Neue Session, isolierte Subagenten bevorzugen
## Gitea-Integration
- Instanz: `https://gitea.troeger-net.org`
- Token für Gitea-MCP: `$(secret-tool lookup user claude-code token gitea)`
- MCP-Server `gitea` muss aktiv sein (Binary: `~/go/bin/gitea-mcp`)