Branch

From rajitsaha/100xprism · View interactive version

Branch is an AI agent skill from the GitHub repository rajitsaha/100xprism. Create a feature branch from the default branch with a descriptive, conventional name.

How to use this skill

Skill file

Branch — Create Feature Branch

Create a feature branch from the default branch with a descriptive, conventional name.

Do NOT ask for permission. Create the branch and push it.


Step 1 — Detect default branch

PROJECT_ROOT=$(git rev-parse --show-toplevel)
cd "$PROJECT_ROOT"
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@')
DEFAULT_BRANCH="${DEFAULT_BRANCH:-main}"
CURRENT_BRANCH=$(git branch --show-current)
echo "Default branch: $DEFAULT_BRANCH"
echo "Current branch: $CURRENT_BRANCH"

If not on the default branch, warn:

⚠️ Currently on '$CURRENT_BRANCH', not '$DEFAULT_BRANCH'.
Creating branch from current HEAD. Proceed only if intentional.

Step 2 — Pull latest

git fetch origin
git checkout "$DEFAULT_BRANCH"
git pull origin "$DEFAULT_BRANCH"

Step 3 — Generate branch name

Derive a branch name from the task description using conventional prefixes:

| Prefix | Use when |

|:-------|:---------|

| feat/ | New feature |

| fix/ | Bug fix |

| chore/ | Maintenance, deps, config |

| refactor/ | Code restructuring |

| docs/ | Documentation only |

| test/ | Test additions or fixes |

Naming rules:

Examples:

"Add user authentication"         → feat/add-user-auth
"Fix login timeout bug"           → fix/login-timeout
"Update dependencies"             → chore/update-deps
"Refactor payment module"         → refactor/payment-module
"Add API documentation"           → docs/api-docs

Step 4 — Create and push branch

BRANCH_NAME="<prefix>/<slug>"
git checkout -b "$BRANCH_NAME"
git push -u origin "$BRANCH_NAME"

If the branch already exists locally or remotely:

git checkout "$BRANCH_NAME"
git pull origin "$BRANCH_NAME" 2>/dev/null || true

Output

╔══════════════════════════════════════════════════════╗
║               BRANCH CREATED                          ║
╠══════════════════════════════════════════════════════╣
║ Branch:   feat/add-user-auth                         ║
║ Base:     main (up to date)                          ║
║ Remote:   origin/feat/add-user-auth ✅                ║
╠══════════════════════════════════════════════════════╣
║ STATUS: Ready to work                                ║
╚══════════════════════════════════════════════════════╝
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.