From 5b1c2383952bdd9a75bfabbc536d3e0b16491278 Mon Sep 17 00:00:00 2001 From: beo3000 Date: Mon, 9 Feb 2026 15:28:55 +0100 Subject: [PATCH] feat: add global commands support with /branch command Commands directory linked via junction, same as skills/rules. Updated install/backup scripts and framework docs. Co-Authored-By: Claude Opus 4.6 --- docs/FRAMEWORK.md | 4 ++++ home-claude/commands/branch.md | 18 ++++++++++++++++++ scripts/backup.ps1 | 2 +- scripts/install.ps1 | 2 +- scripts/install.sh | 4 ++-- 5 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 home-claude/commands/branch.md diff --git a/docs/FRAMEWORK.md b/docs/FRAMEWORK.md index 032af48..a5dd98e 100644 --- a/docs/FRAMEWORK.md +++ b/docs/FRAMEWORK.md @@ -21,6 +21,7 @@ claude-meta/ | `rules/*.md` | **On-demand** via @import | ~50-80/Datei | Nur wenn thematisch relevant | | `projekt/CLAUDE.md` | **Immer** im Projekt | 500-2000 | Build-Commands, Architektur | | `skills/*.md` | **Nur bei /skill** Aufruf | 200-500 | Skill-Anweisungen | +| `commands/*.md` | **Nur bei /command** Aufruf | 200-500 | Command-Anweisungen | | `settings.json` | **Nie** im Context | 0 | Intern verarbeitet (Permissions) | | `memory/*.md` | **Nur wenn** referenziert | variabel | Via @import aus CLAUDE.md | | `docs/FRAMEWORK.md` | **Nie** automatisch | 0 | Nur wenn manuell gelesen | @@ -38,6 +39,7 @@ Gilt für **alle Projekte** auf diesem Rechner: - Git Workflow: `rules/git.md` - Permissions: `settings.json` (46 konsolidierte Regeln) - Skills: `/gemini-image`, `/review`, `/plan-project` +- Commands: `/branch` (globale Slash-Commands) ### Projekt-spezifisch (bleibt im Projekt-Repo) - `CLAUDE.md` — Build-Commands, Architektur, Patterns @@ -56,6 +58,7 @@ Gilt für **alle Projekte** auf diesem Rechner: |---|---|---| | Neue globale Regel | `home-claude/rules/neue-regel.md` + @import in CLAUDE.md | git commit + push | | Neuer Skill | `home-claude/skills/name/SKILL.md` | git commit + push | +| Neuer Command | `home-claude/commands/name.md` | git commit + push | | Neue Permission | `home-claude/settings.json` allow-Array | git commit + push | | Neues Projekt | `scripts/init-project.ps1 ` | Editiere CLAUDE.md | | Neuer Rechner | `git clone` + `scripts/install.ps1` | Fertig | @@ -91,6 +94,7 @@ cd ~/work/claude-meta | `settings.json` | `home-claude/settings.json` | File-Symlink | Symlink | | `skills/` | `home-claude/skills/` | Junction | Symlink | | `rules/` | `home-claude/rules/` | Junction | Symlink | +| `commands/` | `home-claude/commands/` | Junction | Symlink | **Wichtig**: `~/.claude/` selbst ist IMMER ein echtes Verzeichnis (nie symlinken — Claude Code Bug #764). diff --git a/home-claude/commands/branch.md b/home-claude/commands/branch.md new file mode 100644 index 0000000..dc1f4ac --- /dev/null +++ b/home-claude/commands/branch.md @@ -0,0 +1,18 @@ +--- +allowed-tools: Bash(git status:*), Bash(git branch:*), Bash(git checkout:*), Bash(git switch:*), AskUserQuestion +description: Check git status and create a new branch +--- + +## Context + +- Current git status: !`git status --porcelain` +- Current branch: !`git branch --show-current` +- Existing branches: !`git branch -a` + +## Your task + +1. Check if working directory is clean (no uncommitted changes from git status above) +2. If there are uncommitted changes, warn user and stop +3. If clean, ask user for new branch name using AskUserQuestion +4. Create and switch to the new branch using `git checkout -b ` +5. Confirm success with current branch info diff --git a/scripts/backup.ps1 b/scripts/backup.ps1 index 92ad8a2..4969e0e 100644 --- a/scripts/backup.ps1 +++ b/scripts/backup.ps1 @@ -25,7 +25,7 @@ foreach ($file in $files) { } # Backup directories -$dirs = @("skills", "rules") +$dirs = @("skills", "rules", "commands") foreach ($dir in $dirs) { $src = Join-Path $claudeDir $dir if (Test-Path $src) { diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 29027ca..50d875e 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -73,7 +73,7 @@ foreach ($file in $files) { } # --- Directory Junctions --- -$dirs = @("skills", "rules") +$dirs = @("skills", "rules", "commands") foreach ($dir in $dirs) { $src = Join-Path $sourceDir $dir $dst = Join-Path $claudeDir $dir diff --git a/scripts/install.sh b/scripts/install.sh index 2e222a9..f0af295 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -42,7 +42,7 @@ for file in CLAUDE.md settings.json; do done # Directory symlinks -for dir in skills rules; do +for dir in skills rules commands; do src="$SOURCE_DIR/$dir" dst="$CLAUDE_DIR/$dir" @@ -72,7 +72,7 @@ for file in CLAUDE.md settings.json; do fi done -for dir in skills rules; do +for dir in skills rules commands; do dst="$CLAUDE_DIR/$dir" if [ -d "$dst" ]; then count=$(find "$dst" -type f | wc -l)