route-pr-template
Routes a pull request to the correct template based on branch type.
When to use this skill
After validate-branch-name confirms the branch name, and before orchestrate-pr-creation assembles the PR body — to determine which template structure the PR body must follow.
Input
{
branchName: string, // full branch name, e.g. "feat/new-feature"
branchType: string, // alternative: just the type, e.g. "feat"
userSelectedTemplate: string, // optional: explicit user override
}
Behaviour
- Matches the branch type against the static
BRANCH_TYPE_ROUTINGmap. - Uses
userSelectedTemplatewhen provided. - Does not yet load repository template-routing configuration or follow template content verbatim; that guarantee is deferred to T020.
Output
Matched routes and user overrides return:
{
routed: true,
template: string,
reason: string,
fallback: false,
userOverride?: true,
}
Invalid input and unknown branch types use the fallback template and include a warning:
{
routed: false,
template: "pr_feature.md",
reason: "invalid-input" | "unknown-branch-type",
fallback: true,
warning: string,
}
Usage
import { routePrTemplate } from './scripts/route-pr-template.js';
const result = await routePrTemplate({ branchName: 'feat/new-feature' });