Branch Namer:AI 驱动的 Git 分支命名工具 - Openclaw Skills

作者:互联网

2026-04-17

AI教程

什么是 branch-namer?

Branch Namer 是一款专注于提高效率的实用工具,旨在通过简单的描述生成专业的 Git 分支名称,从而简化版本控制。作为 Openclaw Skills 库的核心组件,它消除了手动命名的常见摩擦,有助于保持代码库的整洁。它能理解用户意图并建议符合行业最佳实践的名称,确保您的代码库保持清晰可读,且无需承担手动命名的脑力负担。

通过利用 AI 解释开发者的意图,它能生成简短、具有描述性的 kebab-case(烤肉串式)名称,使工作流保持井然有序。无论您是独立开发还是在大团队中协作,该工具都为版本控制管理提供了一种标准化方法,是任何开发者 Openclaw Skills 工具包中必不可少的补充。

下载入口:https://github.com/openclaw/skills/tree/main/skills/lxgicstudios/branch-name-gen

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install branch-name-gen

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 branch-name-gen。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

branch-namer 应用场景

  • 开启新功能并需要立即获得标准化名称。
  • 确保分布式工程团队的命名一致性,避免代码库混乱。
  • 快速创建带有工单编号和自定义前缀的分支,以便进行项目跟踪。
  • 为 CI/CD 流水线和自动部署脚本标准化分支名称。
branch-namer 工作原理
  1. 开发者通过命令行提供任务的纯英语描述。
  2. AI 分析描述以确定合适的工作类别(例如:功能、修复或日常事务)。
  3. 该工具生成符合常规命名模式的简洁 kebab-case 分支名称。
  4. 可选地,该工具可以执行 git checkout 命令来自动创建并切换到新分支。

branch-namer 配置指南

由于工具通过 npx 运行,因此不需要永久安装。您必须拥有 Node.js 18 或更高版本,并在环境中配置有效的 OpenAI API 密钥。

# 设置您的 API 密钥
export OPENAI_API_KEY=sk-...

# 运行工具
npx ai-branch "add user authentication with OAuth"

branch-namer 数据架构与分类体系

Branch Namer 与您的本地 Git 环境交互,并为生成的分支名称遵循特定的输出结构,以确保与大多数 Openclaw Skills 工作流兼容。

组件 格式 用途
前缀 [类型]/ 对工作进行分类 (feature/, bugfix/, hotfix/, chore/)
别名 kebab-case 任务的简短、URL 友好型描述
工单 (可选) 字符串 在分支名称前添加追踪 ID,如 PROJ-123

示例输出:feature/PROJ-123-add-oauth-support

name: branch-namer
description: Generate descriptive git branch names from plain English. Use when you need a branch name that follows conventions.

Branch Namer

Naming branches is harder than it should be. Is it feature/user-auth or feat/add-user-authentication? This tool generates consistent, conventional branch names from plain English descriptions.

One command. Zero config. Just works.

Quick Start

npx ai-branch "add user authentication with OAuth"

What It Does

  • Generates branch names following common conventions (feature/, bugfix/, hotfix/)
  • Keeps names short but descriptive
  • Uses kebab-case consistently
  • Can create the branch for you with --create flag
  • Supports custom prefixes and formats

Usage Examples

# Get a branch name suggestion
npx ai-branch "fix the login button not working on mobile"

# Create the branch immediately
npx ai-branch "add dark mode support" --create

# Use a specific prefix
npx ai-branch "update dependencies" --prefix chore

# Include ticket number
npx ai-branch "user profile page crashes on load" --ticket PROJ-123

Best Practices

  • Be specific in your description - "fix bug" gives worse results than "fix crash when user has no profile photo"
  • Include context - Mention the feature area: "checkout flow: add shipping address validation"
  • Use --create sparingly - Review the suggestion first, especially on shared repos
  • Match team conventions - If your team uses different prefixes, use --prefix

When to Use This

  • Starting a new feature and blanking on a good branch name
  • Want consistent naming across your team
  • Working on multiple tasks and need to track what each branch does
  • Onboarding and not sure what naming conventions the team uses

Part of the LXGIC Dev Toolkit

This is one of 110+ free developer tools built by LXGIC Studios. No paywalls, no sign-ups, no API keys on free tiers. Just tools that work.

Find more:

  • GitHub: https://github.com/LXGIC-Studios
  • Twitter: https://x.com/lxgicstudios
  • Substack: https://lxgicstudios.substack.com
  • Website: https://lxgicstudios.com

Requirements

No install needed. Just run with npx. Node.js 18+ recommended. Requires OPENAI_API_KEY environment variable.

export OPENAI_API_KEY=sk-...
npx ai-branch --help

How It Works

Takes your description and determines the appropriate branch type (feature, fix, chore, etc.). Extracts key terms and creates a concise, readable branch name following conventional naming patterns. Can optionally run git checkout -b for you.

License

MIT. Free forever. Use it however you want.