skills/git-workflows/skills/branch/SKILL.md
Use when creating a new git branch following the project's branch naming conventions.
npx skillsauth add dtsong/my-claude-setup git-branchInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
.., shell metacharacters, or null bytes.--from): must be a valid existing ref. Reject shell metacharacters and .. traversal.Create a new branch with proper naming conventions, optionally from a specific base.
/git-branch feat/dark-mode # Create feature branch
/git-branch fix/login-bug # Create bugfix branch
/git-branch feat/api-v2 --from main # Create from specific base
/git-branch --suggest "add login" # Suggest branch name from description
| Prefix | Use For | Example |
|--------|---------|---------|
| feat/ | New features | feat/dark-mode |
| fix/ | Bug fixes | fix/login-validation |
| refactor/ | Code refactoring | refactor/auth-module |
| docs/ | Documentation | docs/api-reference |
| test/ | Test additions/fixes | test/auth-coverage |
| chore/ | Maintenance tasks | chore/update-deps |
| hotfix/ | Urgent production fixes | hotfix/security-patch |
BRANCH_NAME="$1"
# Check for valid prefix
if [[ ! "$BRANCH_NAME" =~ ^(feat|fix|refactor|docs|test|chore|hotfix)/ ]]; then
echo "Warning: Branch name doesn't follow conventions."
echo "Recommended prefixes: feat/, fix/, refactor/, docs/, test/, chore/, hotfix/"
fi
# Check for invalid characters
if [[ "$BRANCH_NAME" =~ [[:space:]] ]]; then
echo "Error: Branch name cannot contain spaces. Use hyphens instead."
exit 1
fi
# Check length
if [ ${#BRANCH_NAME} -gt 50 ]; then
echo "Warning: Branch name is quite long. Consider shortening."
fi
if ! git diff --quiet || ! git diff --cached --quiet; then
echo "You have uncommitted changes."
echo "Options:"
echo " /git-stash - Stash changes first"
echo " /commit - Commit changes first"
exit 1
fi
# Default to current branch, or use specified base
BASE_BRANCH="${FROM_BRANCH:-$(git branch --show-current)}"
# Fetch to ensure we have latest
git fetch origin "$BASE_BRANCH" 2>/dev/null || true
# Create branch from base
git checkout -b "$BRANCH_NAME" "$BASE_BRANCH"
# Set up tracking if base has remote
if git rev-parse --verify "origin/$BASE_BRANCH" >/dev/null 2>&1; then
echo "Created from origin/$BASE_BRANCH (latest)"
fi
Created branch: feat/dark-mode
Base: main (up to date with origin/main)
Current position: abc1234 Latest commit on main
Branch is local only. To publish:
/git-push -u
Next steps:
- Make your changes
- /commit to commit
- /git-push to publish
- /commit-push-pr to create PR
When using --suggest:
Suggested branch names for "add user login feature":
1. feat/user-login (Recommended)
2. feat/add-user-login
3. feat/login-feature
Enter your choice or provide custom name:
Branch 'feat/dark-mode' already exists.
Options:
/git-switch feat/dark-mode # Switch to existing branch
/git-branch feat/dark-mode-v2 # Create with different name
When --suggest is used, generate names based on description:
# Example: "fix the authentication bug in login form"
# Result: fix/auth-bug-login-form
-, /, _feat/JIRA-123-dark-mode--from main after pulling/git-switch to change between branches/git-branches to see all branches/commit-push-pr when ready to create PR| Path | Load Condition | Content Summary |
|------|---------------|-----------------|
| ../../references/naming-conventions.md | Branch name validation | Branch naming convention rules and prefix definitions |
testing
Use to convert a Word .docx file to PDF and/or verify its page count. Triggers on: converting docx to pdf, rendering a document, checking how many pages a docx produces, or asserting a page-count constraint (e.g. a resume must stay 2 pages). Wraps LibreOffice headless conversion.
development
Security audit checklist for web applications. Use when reviewing, auditing, or hardening a web app's security posture. Covers rate limiting, auth headers, IP blocking, CORS, security middleware, input validation, file upload limits, ORM usage, and password hashing. Triggers on requests like "review security", "harden this app", "security audit", "check for vulnerabilities", or when building/reviewing API endpoints.
development
Interactive wizard to craft effective prompts using Claude Code best practices
tools
Use when batch labeling, prioritizing, and assigning GitHub issues during triage sessions.