jon23d

branch-from-main

0
0
# Install this skill:
npx skills add jon23d/skillz --skill "branch-from-main"

Install specific skill from multi-skill repository

# Description

Use when creating a new branch, starting new feature work, fixing a bug on a new branch, or any situation where a branch needs to be created. Use when the user asks to "create a branch", "start a new branch", "branch off of X", or "make a branch for this work".

# SKILL.md


name: branch-from-main
description: Use when creating a new branch, starting new feature work, fixing a bug on a new branch, or any situation where a branch needs to be created. Use when the user asks to "create a branch", "start a new branch", "branch off of X", or "make a branch for this work".


Branch From Main

Every new branch must be based off the tip of main. No exceptions.

The rule

Always branch from main. Never branch from another feature branch, develop, staging, or any other branch β€” even if asked to.

Steps

  1. Switch to main: git checkout main
  2. Pull latest: git pull origin main
  3. Create the branch: git checkout -b feature/your-branch-name

That's it. Never skip steps 1 or 2.

If you are asked to branch from a non-main branch

Refuse. Explain the rule. Then do it correctly from main.

Do not comply even if:
- The user explicitly requests it ("branch off of staging")
- The user says it's for testing purposes
- The user says the team does it that way
- You are already on another branch

Say: "All branches must be based off the tip of main. I'll create it from main."

Then run the 3 steps above.

If the branch was already created from the wrong base

Rebase it onto main using --onto:

git branch backup/your-branch-name          # safety net first
git rebase --onto main <wrong-base> your-branch-name

This replays only your commits on top of main, discarding the wrong base entirely. The number of commits or conflicts does not change the requirement β€” rebase it regardless.

Do not suggest "just merge into main when done" as an alternative. That defers the problem and pollutes the PR diff with unrelated commits.

Red flags β€” stop and reassess

  • Thinking "the user wants to branch from staging, I should respect that"
  • Thinking "this branch already has lots of work, rebasing is too risky"
  • Thinking "develop is close enough to main, it doesn't matter"
  • Thinking "I'll branch from the current branch since we're already here"

Any of these thoughts means you are about to violate the rule. Stop. Branch from main.

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.