CommunityWriting & Editinggithub.com

gener8v/gener8v.claude-skills.engineering

Put work on the correct branch before the first edit. Finds the base branch, starts a well-named branch from the current remote tip, and sets up one worktree per agent for parallel work. Use at the start of any change to a tracked file, such as 'start on issue 42', 'fix this typo', 'set up branches for these three tickets', or before you start sub-agents that edit code. Not for opening or merging a PR (github-pr-merge) or for history rewrites and other risky git commands (git-safety).

What is gener8v.claude-skills.engineering?

gener8v.claude-skills.engineering is a Claude Code agent skill that put work on the correct branch before the first edit. Finds the base branch, starts a well-named branch from the current remote tip, and sets up one worktree per agent for parallel work. Use at the start of any change to a tracked file, such as 'start on issue 42', 'fix this typo', 'set up branches for these three tickets', or before you start sub-agents that edit code. Not for opening or merging a PR (github-pr-merge) or for history rewrites and other risky git commands (git-safety).

Works with✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/gener8v/gener8v.claude-skills.engineering/tree/HEAD/skills/git-branching

Installed? Explore more Writing & Editing skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

Git branching

Every change goes on its own branch. This includes a one-line fix and a change with no issue. Do not commit on the base branch.

1. Find the base branch

Use the first source that gives an answer:

  1. Repository instructions. Read CLAUDE.md, CONTRIBUTING.md and .github/ documents. If they name a base or integration branch, use it.
  2. Remote default branch.
    git symbolic-ref --short refs/remotes/origin/HEAD   # prints origin/<name>
    gh repo view --json defaultBranchRef -q .defaultBranchRef.name
    
  3. Ambiguity. If the remote also has develop or development and no document says which one is the base, ask the user. Do not guess.

When an integration branch (for example develop) is the base, a hotfix for a released version starts from the default branch instead. Use that only when the user calls the work a hotfix.

2. Check where you are

git status --porcelain
git rev-parse --abbrev-ref HEAD
  • If the working tree has changes that you did not make, stop. Ask the user what to do with them.
  • If you are already on a branch for this same work, stay on it.
  • If you are on the base branch with your own uncommitted edits, move them: git switch -c <name> keeps them in the working tree.

3. Start the branch from the remote tip

git fetch origin --prune
git switch -c <name> origin/<base>
git log -1 --oneline

Starting from origin/<base> means that a stale local base branch does no harm. Do not run git pull on the base branch to "catch up" first. It is not necessary.

4. Name the branch

Use the repository convention if it has one. If not, use <type>/<ref>-<slug>:

PartValues
typefeat, fix, docs, chore, refactor, test, release, hotfix
refIssue number (42), pipeline ticket (ticket-007), or nothing
slugTwo to five lowercase words, joined with hyphens

Examples: fix/42-null-session-crash, feat/ticket-007-search-filters, docs/readme-install-steps.

5. While you work

  • Commit in small steps that each make sense alone. Write the subject in the imperative, 72 characters or fewer. Use the body to say why.
  • Do not add a Co-Authored-By: Claude trailer to any commit message. This is a gener8v rule.
  • Before the first push, you can rebase onto origin/<base>. After the branch is pushed, merge the base into the branch instead. A rebase of a pushed branch rewrites history, and engineering:git-safety gates that.
  • Push with a chain that stops on the first failure:
    set -o pipefail
    git fetch origin && <test command> 2>&1 | tail -n 40 && git push -u origin HEAD
    
    Without set -o pipefail, | tail hides the exit code of the command before it. Never pipe a git command or a test command through tail without it.

Parallel work

For two or more agents that edit code at the same time, read resources/parallel-work.md before you start any agent. In short: one batch branch from the base, one worktree and one branch per agent from the batch branch, and no two agents on the same files.

Done when

  • You are on a branch with a clear name, and it starts at the current origin/<base>.
  • git status shows no changes that belong to someone else.

Related skills

  • engineering:github-pr-merge: open the PR when the work is complete.
  • engineering:git-safety: approval rules for force-push, branch deletion and similar commands.
  • engineering:github-issue-workflow: the full lifecycle of an issue or a pipeline ticket. It calls this skill first.

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

gener8v/gener8v.claude-skills.engineering

Find and run a project's test, lint, type-check, build and dev-server commands, read the results correctly, and seed a throwaway database when UI work needs realistic data. Never seeds the project's real or default database. Use before 'run the tests', 'lint this', 'does it build', 'start the app so I can see it', 'seed some demo data', and before you claim that a change works. Not for deployment or CI pipeline design; use the project's own deploy tooling for those.

gener8v/gener8v.claude-skills.engineering

Create or top up a project's documentation set: list what exists, let the user choose which document types to add, collect one shared fact sheet from the code, write the documents (in parallel when there are several), then check them against each other and against the code. Use when asked to 'bootstrap the docs', 'start the documentation', 'we have no README or ARCHITECTURE', or 'fill in the missing docs'. Not for the per-commit update of existing documents (documentation-sync), and not for gener8v pipeline documents (gener8v:brownfield and gener8v:planning make those).

gener8v/gener8v.claude-skills.engineering

Before a commit, find every document that describes what the change touched and update it in the same commit, or confirm in one line that no document needs a change. Catches stale text, missing documentation and facts kept in two places. Use before any commit or PR, and when asked 'are the docs up to date', 'update the docs for this change' or 'did I miss a README change'. Not for creating a documentation set or filling large gaps (documentation-bootstrap), and not for gener8v pipeline documents under .gener8v/, which the pipeline skills own.

gener8v/gener8v.claude-skills.engineering

Approval gate for git commands that destroy work or skip checks: force-push, --no-verify, signing bypass, reset --hard, clean -f, discarding uncommitted edits, branch or tag deletion, rewriting pushed commits and push --mirror. Each one needs the user's explicit approval at that moment; an earlier approval never carries over. Also covers a secrets check before a commit and what to do when a secret is already committed. Use before any of these commands, or when asked to 'force push', 'skip the hooks', 'throw away my changes' or 'delete that branch'. Not for normal branching (git-branching) or the PR flow (github-pr-merge).

Related Skills