agentleFS
dagarre00dagarre00/claude-code-template/.agents/skills/feature-branching/SKILL.md

feature-branching

Skill1 starsChanged 3 months agoMITView on GitHub

Conductor-only. Branching procedure — when and how to branch, batching todos, pausing mid-task, syncing with develop, and cleaning up after a merge. Commit and branch naming live in docs/wiki/git-conventions.md. Trigger on "start branch", "feat/", "fix/", "batch todos", "finish feature".

  • Commits and pushes

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After it, docs/wiki/log.md (merged by union) may be out of order: node tools/workflow-mcp/verify.mjs --sort-log and commit the result with …

    line 72

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Branching

Code (feat/*, fix/*, refactor/*, perf/*) is built on a branch cut from develop and merged by PR. Living documentation and maintenance (docs/wiki/, docs/raw/, .agents/ config) commit directly to develop, or ride the active branch (rule 19). Naming and commit format: docs/wiki/git-conventions.md.

Starting work

  1. Clean tree: git status --porcelain prints nothing. Dirty → human-checkpoint (or see Mid-task pause).
  2. Sync develop — fetch + merge --ff-only, not pull, so a diverged develop fails safely:

    git checkout develop || { echo "could not switch to develop — stop and run human-checkpoint"; exit 1; }
    if git remote get-url origin >/dev/null 2>&1; then
      git fetch origin develop "refs/heads/<type>/<slug>:refs/remotes/origin/<type>/<slug>" 2>/dev/null || git fetch origin develop || { echo "fetch failed — stop and run human-checkpoint"; exit 1; }
      git merge --ff-only origin/develop || { echo "develop has diverged from origin — stop and run human-checkpoint"; exit 1; }
    fi

    A --ff-only failure means develop diverged → human-checkpoint; never force or rebase it. The fetch and merge share one guard, so with no origin both are skipped and the block works off local develop (a merge outside the guard would fail with not something we can merge).

  3. Create or resume <type>/<slug> — <type> ∈ feat, fix, chore, docs, refactor, test, perf:

    git checkout "<type>/<slug>" 2>/dev/null || git checkout -b "<type>/<slug>"
    if git rev-parse --verify "origin/<type>/<slug>" >/dev/null 2>&1; then
      git merge --ff-only "origin/<type>/<slug>" || { echo "<type>/<slug> has diverged from origin — stop and run human-checkpoint"; exit 1; }
    fi

    The rev-parse guard tells "no remote branch yet" (fine — first push to come) apart from "it exists and diverged" (stop — another session pushed here).

<slug> equals the entity-page slug — the branch, the entity page, the plan scratch (.handoff/<slug>-plan.md) and the test names all key off it. Pick it once.

Which command branches

CommandBranch
/project:workfeat/<slug>, created before the failing test
/project:interview, /project:wiki, /project:reviewnone — on develop (via sync-develop.md) or the active feat/*
/project:adversarynone — the existing feat/*/fix/*/chore/*; develop only for the release review

Already on a branch whose work this belongs to → stay, and let its PR carry the change.

Batching todos

Two todos share a branch only when all hold: same entity page, the second depends on the first, and splitting them yields a meaningless intermediate PR. A batch shares a branch, a plan and a PR — never a commit — and 2+ todos trigger the planner.

Mid-task pause

Interrupted before a green commit boundary:

  • Preferred — checkpoint. Stage your paths explicitly (never git add -p: an interactive prompt hangs with no human), commit wip: <what's in flight>, and git tag checkpoint-$(date -u +%Y%m%dT%H%M%SZ). On resume, git reset HEAD~1 and continue.
  • Fallback — stash, only for a tiny change resumed within the same session: git stash push -m "wip: <what>", later git stash pop. Never leave a stash across sessions.

Syncing a long-running branch

Merge develop in early and often — the conflict surface only grows:

git fetch origin develop
git merge origin/develop     # conflicts: git-recovery skill
<test command>               # a merge can bring breakage — re-verify
git push

After it, docs/wiki/log.md (merged by union) may be out of order: node tools/workflow-mcp/verify.mjs --sort-log and commit the result with the merge. Never rebase a pushed branch as routine sync — sessions share branches concurrently. Rebase + --force-with-lease needs explicit human approval; bare --force, never.

After the human merges the PR

git checkout develop
git fetch origin develop && git merge --ff-only origin/develop
git branch -d feat/<slug>              # safe delete: refuses if unmerged
git push origin --delete feat/<slug>

Anti-patterns

  • Committing code to develop or main. Branch first.
  • git commit -a or git add -A. Stage your own paths explicitly (rule 21).
  • Squashing to hide the Red→Green trace. History is the evidence the loop ran.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.