plan-branch-strategy
Ensures work is on a named branch before edits. Use at session start when on main, at planning time before implementation, or when the feature-branch hook blocks edits on main.
Works with
--- name: plan-branch-strategy description: Ensures work is on a named branch before edits. Use at session start when on main, at planning time before implementation, or when the feature-branch hook blocks edits on main. license: MIT --- # Plan branch strategy ## When to use - **First action in a coding session** (after cloning context): if the repo is on `main`, create a branch before modifying files. - Start of Phase 2 (plan) per [docs/technical/AGENTS.md](../../../docs/technical/AGENTS.md). - Any time you notice `git branch --show-current` is `main` and you intend to commit. ## Why [branch-policy.mdc](../../../.cursor/rules/branch-policy.mdc) and [merge-via-pr](../merge-via-pr/SKILL.md): deliverable work merges to `main` only via pull request. Commits made directly on `main` bypass that workflow. ## Instructions 1. Show current branch: `git branch --show-current`. 2. If the result is **`main`** (or you are in detached HEAD), update and branch: ```bash git checkout main git pull origin main git checkout -b feature/NNN-short-slug ``` Use `feature/`, `task/`, `chore/`, or `docs/` per issue type; include the GitHub issue number when there is one (e.g. `feature/128-api-v1-implementation`). 3. If you **already changed files on `main`** but have **not** committed, run only: ```bash git checkout -b feature/NNN-short-slug ``` Git keeps your working tree; new commits go on the new branch. 4. Verify: `git branch --show-current` is not `main`. ## Naming See [CLAUDE.md § Git workflow](../../../CLAUDE.md#git-workflow) and [github-integration.mdc](../../../.cursor/rules/github-integration.mdc). ## Integration - Runs before implementation-heavy skills (e.g. [test](../test/SKILL.md) after code changes). - Pairs with [merge-via-pr](../merge-via-pr/SKILL.md) for push and PR. ## Note on Cursor skills This repository gitignores `.cursor/skills` (see [SKILLS_SETUP.md](../../../docs/technical/SKILLS_SETUP.md)). This file is the **committed** copy for Claude Code; keep it in sync with any sibling `plan-branch-strategy` skill in your global Cursor skills pack.
More Git Workflows skills
git-commit
github/awesome-copilot
Execute git commit with conventional commit message analysis, intelligent staging, and message generation. Use when user asks to commit changes, create a git commit, or mentions "/commit". Supports: (1) Auto-detecting type and scope from changes, (2) Generating conventional commit messages from diff, (3) Interactive commit with optional type/scope/description overrides, (4) Intelligent file staging for logical grouping
git-workflow-and-versioning
addyosmani/agent-skills
Structures git workflow practices. Use when making any code change. Use when committing, branching, resolving conflicts, or when you need to organize work across multiple parallel streams. Use when cutting a release, choosing a semantic version bump, tagging, or writing a changelog.
resolve-merge-conflicts
warpdotdev/common-skills
Resolve Git merge conflicts by extracting only unresolved paths, conflict hunks, and compact diffs instead of loading whole files into context. Use when a merge, rebase, cherry-pick, or stash pop stops on conflicts, when `git status` shows unmerged paths, or when files contain conflict markers.

