branching
Skill1 starsChanged 2 months agoMITView on GitHub
Use when creating a branch, naming it, deciding whether to use a worktree, or handling secrets accidentally committed to history — branch naming convention, trunk protection, and secrets-removal procedure.
- Reads credentials
- Deletes or force-pushes
- Commits and pushes
Files
Branching
Full reference: .github/BRANCHING_STRATEGY.md (worktree deep-dive,
.gitignore policy, lifecycle walkthrough). This skill is the actionable
summary.
The core rule
Never commit directly to main/master/trunk/develop/production/
release/*. Always: branch → commit → push → PR → merge. This repo
enforces it locally via git config core.hooksPath .github/hooks
(already set here) — don't rely on the admin bypass.
Branch naming
{type}/{description}, lowercase, hyphens not underscores, short and
specific.
| Type | Purpose |
feature/ | New feature or enhancement |
fix/ | Bug fix |
refactor/ | No behavior change |
test/ | Testing improvements |
docs/ | Documentation only |
chore/ | Maintenance, deps, config |
perf/ | Performance improvement |
ci/ | CI/CD changes |
Good: feature/user-authentication, fix/email-validation-crash.
Bad: update, Feature/UserAuth, fix_everything.
Worktrees
A worktree is a second working directory backed by the same repo, so you can have several branches checked out at once without stashing or re-cloning.
Reach for one when:
- Running long tests/builds on one branch while you keep coding another.
- Reviewing a PR branch without disturbing your in-progress work.
- Running agents in parallel — give each agent/task its own worktree so concurrent runs never fight over one working tree or index. This is the highest-value case for an agent harness.
Skip it for a single quick edit on an already-clean, already-scoped branch — a plain branch switch is cheaper. That exception does not apply once either mandatory condition below is true.
Mandatory, not a preference, before starting new feature/fix implementation work (not Q&A, not read-only investigation) when either is true:
git status --porcelainis non-empty (a dirty tree), or- the current branch is unrelated to the task (someone else's topic
branch, a
chore/*tree, anything not already scoped to this work).
In that state, git checkout -b directly in the current checkout is
disallowed — isolate first:
git fetch origin
git worktree add -b feature/<short-name> .worktrees/feature-<short-name> origin/main
cd .worktrees/feature-<short-name>❌ git checkout -b feature/foo on top of a chore/* branch carrying
100 modified files.
✅ git worktree add -b feature/foo .worktrees/feature-foo origin/main.
This check runs before the first file edit, on its own — it is not something to ask the user about. A prompt like "let's build X" authorizes starting the work, not skipping isolation. Only ask the user when choosing between multiple clean strategies (e.g. a branch name); never ask whether a dirty tree should be isolated — just do it.
A consumer project without full harness-hook wiring has no automatic
signal for this rule — tools/harness-session-start.sh is an optional,
standalone script (no hook installation required) that prints this same
warning at session start when the tree is dirty; wire it into a
project's own session-start step if useful (issue #249, item 7).
The rules that bite:
- One branch per worktree — git refuses to check the same branch out in two worktrees at once.
- Keep them in
.worktrees/{branch-name}/(gitignored — it's in.github/.gitignore.template), not scattered sibling directories. - Hooks are shared by default — worktrees share one
.gitconfig andcore.hooksPath, so trunk protection and the pre-push hook apply in all of them; you won't accidentally sidestep them by moving to a worktree (short of deliberately enabling per-worktree config). - Remove with git, not
rm -rf—git worktree remove <dir>(orgit worktree pruneif you already deleted it by hand), so git's bookkeeping stays consistent.
Full mechanics (submodule caveat, cleanup): .github/BRANCHING_STRATEGY.md.
If a secret was committed
Act immediately — rotate the secret regardless of whether history cleanup succeeds; treat anything that touched git history as compromised.
- Preferred: BFG Repo Cleaner
on a fresh mirror clone:
bfg --delete-files .envthengit push --force. See.github/BRANCHING_STRATEGY.mdfor the full command sequence. - Fallback:
git filter-repo --path .env --invert-paths(the modern, maintained replacement forfilter-branch). - Rotate the secret. Tell everyone with a clone to re-clone, not pull.
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- nguyenthanhtat/screen1-claude★ 2same name
- lintangknitto/agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository77 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- .cursor/rules/accessibility.mdcCursor rule
- .cursor/rules/agentharness-router.mdcCursor rule
- .cursor/rules/agentic-loops.mdcCursor rule
- .cursor/rules/api-design.mdcCursor rule
- .cursor/rules/audit-review-followup.mdcCursor rule
- .cursor/rules/big-work-plan-review.mdcCursor rule
- .cursor/rules/branching.mdcCursor rule
- .cursor/rules/clean-architecture.mdcCursor rule
- .cursor/rules/code-review-api.mdcCursor rule
- .cursor/rules/code-review-db.mdcCursor rule
- .cursor/rules/code-review.mdcCursor rule
- .cursor/rules/code-review-ui.mdcCursor rule
- .cursor/rules/committing.mdcCursor rule
- .cursor/rules/database-conventions.mdcCursor rule
- .cursor/rules/dependency-audit.mdcCursor rule
- .cursor/rules/dependency-injection.mdcCursor rule
- .cursor/rules/design-patterns.mdcCursor rule
- .cursor/rules/docker-conventions.mdcCursor rule
- .cursor/rules/error-handling.mdcCursor rule
- .cursor/rules/file-placement-policy.mdcCursor rule
- .cursor/rules/github-issue-triage.mdcCursor rule
- .cursor/rules/go-conventions.mdcCursor rule
- .cursor/rules/harness-feedback.mdcCursor rule
- .cursor/rules/logging.mdcCursor rule
- .cursor/rules/multi-agent-coordination.mdcCursor rule
- .cursor/rules/mutation-testing.mdcCursor rule
- .cursor/rules/performance-profiling.mdcCursor rule
- .cursor/rules/planning-with-files.mdcCursor rule
- .cursor/rules/port-agent-config.mdcCursor rule
- .cursor/rules/project-bootstrap.mdcCursor rule
- .cursor/rules/python-conventions.mdcCursor rule
- .cursor/rules/react-best-practices.mdcCursor rule
- .cursor/rules/refactoring.mdcCursor rule
- .cursor/rules/requirements-clarification.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/solid-principles.mdcCursor rule
- .cursor/rules/testing.mdcCursor rule
- .cursor/rules/typescript-conventions.mdcCursor rule
- accessibilitySkill
- agentic-loopsSkill
- api-designSkill
- audit-review-followupSkill
- big-work-plan-reviewSkill
- clean-architectureSkill
- code-review-apiSkill
- code-review-dbSkill
- code-reviewSkill
- code-review-uiSkill
- committingSkill
- database-conventionsSkill
- dependency-auditSkill
- dependency-injectionSkill
- design-patternsSkill
- docker-conventionsSkill
- error-handlingSkill
- file-placement-policySkill
- github-issue-triageSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

