Skip to content

using-git-worktrees: $LOCATION and $BRANCH_NAME used in Step 1 code block without prior assignment #1797

Description

@specterslient95-lgtm

skills/using-git-worktrees/SKILL.md Step 1 includes a "Create the Worktree" code block that uses $LOCATION and $BRANCH_NAME shell variables without either documenting them as agent-supplied placeholders or showing assignment lines:

# Determine path based on chosen location
path="$LOCATION/$BRANCH_NAME"

git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"

Neither variable is assigned earlier in the SKILL.md, and there is no preceding line of the form LOCATION=... / BRANCH_NAME=.... An agent reading the workflow and executing the block verbatim ends up running git worktree add "/" -b "" (both vars empty), which fails with an empty-branch-name error.

The earlier prose (lines 60–76) does discuss how to pick a location and the implicit branch name, but the variables in the code block are presented as if already in scope.

Suggested fix

Prepend explicit assignment lines so the block is runnable:

# Use the LOCATION you chose above (e.g., ".worktrees" or a project-specific path)
LOCATION="<chosen-location>"
# Use BRANCH_NAME based on the task (e.g., "feat-add-login")
BRANCH_NAME="<chosen-branch-name>"

# Determine path based on chosen location
path="$LOCATION/$BRANCH_NAME"

git worktree add "$path" -b "$BRANCH_NAME"
cd "$path"

Or, if the intent is for the agent to fill the variables before pasting the block, document that explicitly above the code fence (e.g., "Agent fills: LOCATION = …, BRANCH_NAME = …").

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions