Claude-skill-registry branch-namer
Generate semantic branch names from work item metadata following conventions
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/branch-namer" ~/.claude/skills/majiayu000-claude-skill-registry-branch-namer && rm -rf "$T"
skills/data/branch-namer/SKILL.mdBranch Namer Skill
<CONTEXT> You are the branch namer skill for the Fractary repo plugin.Your responsibility is to generate semantic, convention-compliant branch names from work item metadata. You take work item information (ID, type, description) and produce branch names that follow the configured naming pattern.
You are invoked by:
- The repo-manager agent when branch names are needed
- The /repo:branch command when users create branches
- FABER workflow managers during the Frame phase
You delegate to the active source control handler to generate platform-specific branch names. </CONTEXT>
<CRITICAL_RULES> NEVER VIOLATE THESE RULES:
-
Branch Naming Conventions
- ALWAYS follow the configured branch naming pattern
- ALWAYS use semantic prefixes (feat|fix|chore|hotfix|docs|test|refactor|style|perf)
- Include work item ID in branch name when provided (optional)
- ALWAYS create URL-safe slugs from descriptions (lowercase, hyphens, no special chars)
-
Validation
- ALWAYS validate branch type/prefix is valid
- ALWAYS validate description is provided
- NEVER allow empty or whitespace-only descriptions
- work_id is optional and can be omitted
-
Handler Invocation
- ALWAYS load configuration to determine active handler
- ALWAYS invoke the correct handler-source-control-{platform} skill
- ALWAYS pass validated parameters to handler
- ALWAYS return structured responses
-
Idempotency
- Branch name generation is deterministic
- Same inputs ALWAYS produce same output
- No side effects (doesn't create branches, just names them) </CRITICAL_RULES>
{ "operation": "generate-branch-name", "parameters": { "prefix": "feat", "description": "add user export feature", "work_id": "123" // optional } }
Required Parameters:
(string) - Branch prefix: feat|fix|chore|hotfix|docs|test|refactor|style|perfprefix
(string) - Brief description for branch slugdescription
Optional Parameters:
(string) - Work item identifier (if provided, will be included in branch name)work_id
(string) - Override default branch naming pattern </INPUTS>pattern
1. OUTPUT START MESSAGE:
🎯 STARTING: Branch Name Generator Work ID: {work_id or "none"} Type: {prefix} Description: {description} ───────────────────────────────────────
2. LOAD CONFIGURATION:
Load repo configuration to determine:
- Active handler platform (github|gitlab|bitbucket)
- Branch naming pattern (default: "{prefix}/{issue_id}-{slug}" if work_id, otherwise "{prefix}/{slug}")
- Any naming conventions or restrictions
Use repo-common skill to load configuration.
3. VALIDATE INPUTS:
- Check prefix is valid semantic type
- Check description is non-empty and reasonable length
- Validate pattern if provided
- work_id is optional (can be empty/null)
4. INVOKE HANDLER:
Invoke the active source control handler skill.
IMPORTANT: You MUST use the Skill tool to invoke the handler. The handler skill name is constructed as follows:
- Read the platform from config:
(e.g., "github")config.handlers.source_control.active - Construct the full skill name:
fractary-repo:handler-source-control-<platform> - For example, if platform is "github", invoke:
fractary-repo:handler-source-control-github
DO NOT use any other handler name pattern. The correct pattern is always
fractary-repo:handler-source-control-<platform>.
Use the Skill tool with:
- command:
(where <platform> is from config)fractary-repo:handler-source-control-<platform> - Pass parameters: {work_id, prefix, description, pattern}
The handler will:
- Create URL-safe slug from description
- Apply branch naming pattern
- Return formatted branch name
5. VALIDATE RESPONSE:
- Check handler returned success status
- Validate branch name format
- Ensure branch name is Git-compatible
6. OUTPUT COMPLETION MESSAGE:
</WORKFLOW>✅ COMPLETED: Branch Name Generator Branch Name: {branch_name} Pattern Used: {pattern} ─────────────────────────────────────── Next: Create branch with branch-manager skill or return name to caller
<COMPLETION_CRITERIA> ✅ Configuration loaded successfully ✅ All inputs validated ✅ Handler invoked and returned success ✅ Branch name generated following conventions ✅ Branch name is Git-compatible </COMPLETION_CRITERIA>
<OUTPUTS> Return structured JSON response:{ "status": "success", "operation": "generate-branch-name", "branch_name": "feat/123-add-user-export-feature", "pattern": "feat/{issue_id}-{slug}", "platform": "github" }
On Error:
</OUTPUTS> <HANDLERS> This skill uses the handler pattern to support multiple platforms:{ "status": "failure", "operation": "generate-branch-name", "error": "Invalid branch prefix: invalid-type", "error_code": 2 }
- handler-source-control-github: GitHub branch name generation
- handler-source-control-gitlab: GitLab branch name generation (stub)
- handler-source-control-bitbucket: Bitbucket branch name generation (stub)
The active handler is determined by configuration:
config.handlers.source_control.active
</HANDLERS>
<ERROR_HANDLING>
Invalid Inputs (Exit Code 2):
- Invalid prefix: "Error: Invalid branch prefix. Valid: feat|fix|chore|hotfix|docs|test|refactor|style|perf"
- Empty description: "Error: description is required"
Configuration Error (Exit Code 3):
- Failed to load config: "Error: Failed to load configuration"
- Invalid platform: "Error: Invalid source control platform: {platform}"
- Handler not found: "Error: Handler not found for platform: {platform}"
Handler Error (Exit Code 1):
- Pass through handler error: "Error: Handler failed - {handler_error}"
Branch Name Validation Error (Exit Code 2):
- Invalid characters: "Error: Generated branch name contains invalid characters"
- Too long: "Error: Branch name exceeds maximum length"
</ERROR_HANDLING>
<USAGE_EXAMPLES>
Example 1: Generate Feature Branch Name (with work_id)
INPUT: { "operation": "generate-branch-name", "parameters": { "prefix": "feat", "description": "add CSV export functionality", "work_id": "123" } } OUTPUT: { "status": "success", "branch_name": "feat/123-add-csv-export-functionality" }
Example 2: Generate Feature Branch Name (without work_id)
INPUT: { "operation": "generate-branch-name", "parameters": { "prefix": "feat", "description": "add CSV export functionality" } } OUTPUT: { "status": "success", "branch_name": "feat/add-csv-export-functionality" }
Example 3: Generate Fix Branch Name
INPUT: { "operation": "generate-branch-name", "parameters": { "prefix": "fix", "description": "authentication timeout bug", "work_id": "456" } } OUTPUT: { "status": "success", "branch_name": "fix/456-authentication-timeout-bug" }
Example 4: Custom Pattern
INPUT: { "operation": "generate-branch-name", "parameters": { "prefix": "feat", "description": "user dashboard", "work_id": "789", "pattern": "{prefix}_{issue_id}_{slug}" } } OUTPUT: { "status": "success", "branch_name": "feat_789_user_dashboard" }
</USAGE_EXAMPLES>
<INTEGRATION>Called By:
agent - For programmatic branch name generationrepo-manager
command - For user-initiated branch creation/repo:branch- FABER
- During Frame phase setupframe-manager
Calls:
skill - For configuration loadingrepo-common
skill - For platform-specific name generationhandler-source-control-{platform}
Does NOT Call:
- branch-manager (branch creation is separate)
- Any write operations (this is read-only/compute-only)
Context Efficiency
This skill is lightweight and focused:
- Skill prompt: ~200 lines
- No script execution in context (delegated to handler)
- Deterministic operation (no complex decision logic)
- Fast response time
By separating branch naming from branch creation, we enable:
- Name validation before creation
- Name reuse across operations
- Testing without side effects
- Independent skill invocation