validate-branch-name
Validates a branch name follows {type}/{scope}-{short-title} format.
When to use this skill
Before any PR is created or updated, and whenever a branch name needs to be checked against this repository's branching convention (e.g. docs/BRANCHING_STRATEGY.md).
Input
{
branchName: string, // e.g. "feat/pr-agent-consolidation-portability"
config: object, // optional: override allowed types through config.allowed_types only
}
Behaviour
- Rejects branch names using a forbidden prefix (
claude/,copilot/,openai/). - Rejects a branch type not in the repository's approved-type list.
- Rejects a name that doesn't match
{type}/{scope}-{short-title}.
Output
{ valid: boolean, errors: string[] }
Usage
import { validateBranchName } from "./scripts/validate-branch-name.js";
const result = await validateBranchName({ branchName: "feat/my-feature" });