ensure-feature-branch

Create and checkout a feature or bug branch when on a mainline or release branch.

8|Updated Feb 4, 2026
One-click install
npx skills add https://github.com/hutchic/.cursor --skill ensure-feature-branch
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ensure-feature-branch
Source: https://github.com/hutchic/.cursor/tree/main/.cursor/skills/git/ensure-feature-branch
Command: npx skills add https://github.com/hutchic/.cursor --skill ensure-feature-branch

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents direct commits or pushes to mainline or release branches by ensuring you are always on a feature or bug branch. If the current branch is a mainline (main, master, dev) or a release branch (release/*), it creates and checks out a new branch.

Core Features & Use Cases

  • Detects mainline and release branches (main, master, dev, release/*) and considers them non-feature branches.
  • Creates a new feature or bug branch with a descriptive name and checks it out, ensuring subsequent work lands on the correct branch.
  • Suitable for workflows, pre-commit hooks, or manual requests to guard against accidental commits to mainline or release branches.

Quick Start

Create and checkout a new feature or bug branch when you are on a mainline or release branch, deriving a short, descriptive branch name and switching to it.

Frequently Asked Questions about ensure-feature-branch

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent direct commits to a main or release branch?

To prevent direct commits to a mainline or release branch, you can enforce a workflow or pre-commit hook that automatically creates and checks out a new feature or bug branch before any changes are saved.

How do I automatically switch to a feature branch in Git?

You can automatically switch to a feature branch by using a workflow tool that detects when you are on main, master, or dev, derives a descriptive branch name with a feat/ or fix/ prefix, and checks it out for you.

What are the best Git branching strategies to protect mainline branches?

Effective Git branching strategies protect mainline branches by detecting references like main, master, dev, and release/*, then forcing developers to create and switch to prefixed feature or bug branches before committing work.

Can I use pre-commit hooks to enforce feature branch creation?

Yes, pre-commit hooks can enforce feature branch creation by evaluating the current branch name during the commit process and automatically switching to a newly created feat/ or fix/ branch if a mainline is detected.

Does this workflow support release branches like release/*?

Yes, this workflow supports release branches by explicitly detecting patterns like release/* alongside main, master, and dev, treating them as non-feature branches to prevent direct commits.

Why should I always work on a feature or bug branch instead of main?

Always working on a feature or bug branch prevents accidental direct pushes to mainline branches, ensuring your version control history remains stable and changes are isolated before integration.