| name | branch |
| description | Creates new git branch with corresponding spec directory structure. Triggers on keywords: create branch, new branch, branch with spec |
| project-agnostic | false |
| allowed-tools | ["Bash","Write"] |
Create Branch with Spec Directory
Create a new git branch and its corresponding spec directory.
Pre-Flight Checks
-
Verify clean git state:
- If dirty: STOP and list uncommitted changes
-
Validate branch name:
- Must be provided as argument
- If empty: STOP with "Branch name required"
Execution
-
Create and checkout branch:
git checkout -b $ARGUMENTS
-
Resolve and create spec directory:
source "${CLAUDE_PLUGIN_ROOT}/scripts/spec-resolver.sh"
RELATIVE_PATH="$(date +%Y)/$(date +%m)/$ARGUMENTS/000-backlog.md"
SPEC_FILE=$(resolve_spec_path "$RELATIVE_PATH")
SPEC_DIR="${SPEC_FILE%/*}"
touch "$SPEC_FILE"
- Path: Auto-resolved based on .env configuration
- External:
.specs/specs/<YYYY>/<MM>/<branch-name>/
- Local:
specs/<YYYY>/<MM>/<branch-name>/
- Creates
000-backlog.md (empty file)
-
Commit spec directory:
commit_spec_changes "$SPEC_FILE" "CREATE" "000" "backlog"
- CRITICAL: Must commit BEFORE creating worktree, otherwise spec files are lost
-
Confirm:
- Branch: $ARGUMENTS
- Spec dir: <resolved-path>
- Backlog: 000-backlog.md (committed)
Conditional Documentation
When configuring external specs repository or modifying spec path resolution, read:
${CLAUDE_PLUGIN_ROOT}/scripts/spec-resolver.sh
${CLAUDE_PLUGIN_ROOT}/scripts/external-specs.sh
${CLAUDE_PLUGIN_ROOT}/scripts/lib/config-loader.sh