{"data":{"slug":"discovered-1cf498a542cd1495f9bc58a2d7be8cdea74a3191c4b44a8a","title":"Git Workflow for Commit-Manager: Conventional Commits, Branch Naming, and Push Policy","summary":"Enforce conventional commits, branch naming conventions, and push policies for a clean and documented git history. The skill ensures that only your files are committed, and that commits are properly formatted and pushed according to defined rules.","url":"https:\/\/skillshunter.net\/skills\/discovered-1cf498a542cd1495f9bc58a2d7be8cdea74a3191c4b44a8a","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-1cf498a542cd1495f9bc58a2d7be8cdea74a3191c4b44a8a","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-1cf498a542cd1495f9bc58a2d7be8cdea74a3191c4b44a8a.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-1cf498a542cd1495f9bc58a2d7be8cdea74a3191c4b44a8a\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before using this skill, ensure that the `commit-manager` agent is installed and configured. Always invoke this skill when starting work, creating commits, pushing, or wiring `pre-commit` \/ `Stop` hooks that touch git. Use `git add -- <path>` to add files by pathspec, never `git add -A`.","instructions":"---\nname: git-workflow\nversion: 2.2.0\ndescription: >\n  Git workflow for commit-manager: Conventional Commits, branch naming, push\n  policy, post-push gh run verification, and multi-instance scoped commits via\n  scope.ts (FORBIDDEN: git add -A \/ git add .). Invoke when starting a feature,\n  creating commits, pushing, or wiring git-related hooks.\n---\n\n# Git Workflow\n\n**ALWAYS invoke when starting work, creating commits, pushing, or wiring `pre-commit` \/ `Stop` hooks that touch git.**\n\n> The git history is documentation. A reader six months from now should understand *why*, not just *what*. The commit-manager agent enforces the message format below; this skill defines what counts as compliant.\n\n## 0. Scoped commit (multi-instance) \u2014 READ BEFORE ANY `git add`\n\nThis worktree may host more than one agent session (Claude \/ Kimi \/ Grok) at once.\n`git add -A`, `git add .`, `git add -u` and `git commit -a` bundle a **peer\u2019s**\nuncommitted files into your commit. They are FORBIDDEN.\n\n```bash\nnpx tsx \"$CLAUDE_PROJECT_DIR\/.claude\/hooks\/scope.ts\" status\nnpx tsx \"$CLAUDE_PROJECT_DIR\/.claude\/hooks\/scope.ts\" commit \"<type>(<scope>): <subject>\"\n# optional: \u2026 commit \"docs: \u2026\" --push\n```\n\nSource of truth: `.claude\/state\/sessions\/<id>.json#filesTouched` (from `post-tool-use`).\n\n| `scope` exit | Meaning | Response |\n|---|---|---|\n| 0 | committed only your files | continue |\n| 1 | session unresolved (\u22652 active, no `$CLAUDE_SESSION_ID`) | `peers.ts list` \u2192 retry with `--session <short-id>`. **Never** fall back to `git add -A` |\n| 2 | peer touched one of your files (last 5 min) | `peers.ts notify`, wait, retry; `--include-conflicted` only if the user says so |\n\nFiles changed via Bash\/formatter\/codegen may be missing from `filesTouched` \u2014 add **by pathspec** (`git add -- <path>`), never `-A`.\n\n## 1. Branch naming\n\n```\nfeature\/<short-kebab-description>\nfix\/<bug-id-or-description>\nrefactor\/<area-changed>\nchore\/<maintenance-task>\ndocs\/<scope>\nci\/<workflow-area>\n```\n\nRules:\n- Always kebab-case, never spaces or underscores.\n- \u2264 50 chars; longer goes in the PR description.\n- One feature per branch.\n\n## 2. Conventional Commits \u2014 required format\n\n```\n<type>(<scope>): <subject>\n\n<body \u2014 wrapped at ~72 cols; bullets when \u2265 3 files affected>\n```\n\n| Type | When |\n|---|---|\n| `feat` | New user-visible capability |\n| `fix` | Bug fix |\n| `refactor` | Internal change, no behavior change |\n| `perf` | Performance improvement |\n| `test` | Tests added\/changed only |\n| `docs` | Documentation only |\n| `chore` | Build, deps, tooling \u2014 nothing user-visible |\n| `ci` | CI\/CD config |\n| `style` | Formatting only |\n| `revert` | Reverts a prior commit |\n| `build` | Build system \/ bundler config |\n\nSubject:\n- \u2264 50 chars\n- imperative (\"add login retry\", not \"added\", not \"adds\")\n- no trailing period\n- lowercase first word (after the type\/scope prefix)\n\nBody (only when \u2265 3 files or non-obvious *why*):\n- explain motivation, trade-offs, links to issues\n- bullet list when summarizing multiple changes\n\n### Example\n\n```\nfeat(auth): add session refresh with rotating cookies\n\n- Issue rotated session id on each login + every 7 days\n- Persist previous id for 30s grace window to avoid races\n- Drop legacy cookie name `sid` from response set; honor on read\n```\n\n### **No AI-attribution footers** *(commit-manager v2.0.0+ rule)*\n\nDo **not** append:\n```\nGenerated with Claude Code\nCo-Authored-By: Claude <noreply@anthropic.com>\n```\n\nThe commit message describes the change. Tooling provenance lives in CI artifacts, signed commits, or release metadata \u2014 not in every commit body.\n\n## 3. Two valid flows\n\nThe repo's CLAUDE.md (or `git-workflow` overlay) declares which is in effect.\n\n### Flow A \u2014 direct-to-main (small repos, single contributor, fast iteration)\n\n```\n1. Pull main, ensure clean tree\n2. Make changes\n3. Quality gate green\n4. Commit \u2192 push to main\n```\n\n### Flow B \u2014 feature branch + merge (multi-contributor, CI gates required)\n\n```\n1. From clean main, create branch:    git checkout -b feature\/<name>\n2. Work, commit incrementally\n3. Quality gate green\n4. Push branch:                       git push -u origin HEAD\n5. Open PR; CI must pass\n6. Merge (squash or rebase \u2014 never merge commit on main)\n7. Delete branch local + remote\n8. Checkout main, pull\n```\n\nEnd state in **both flows**: clean tree, on `main`, in sync with `origin\/main`. The Stop validator enforces this.\n\n## 4. Push policy\n\n| Operation | Allowed | Notes |\n|---|---|---|\n| `git push` to feature branch | \u2705 Always | Force-push only if branch is yours and not yet reviewed |\n| `git push` to main | \u2705 When tree clean and CI green locally | Branch protection should reject otherwise |\n| `git push --force-with-lease` to feature branch | \u2705 Preferred over `--force` | Refuses if remote moved since your last fetch |\n| `git push --force` to main | \u274c Never | Re-writes shared history |\n| `git push --no-verify` | \u274c Never | Bypasses hooks intentionally configured to gate |\n\n## 5. Pre-flight checklist (commit-manager runs this internally)\n\n- [ ] Working tree status reviewed (`git status -sb`)\n- [ ] Diff reviewed (`git diff --stat HEAD` then `git diff` if needed)\n- [ ] Quality gate passed (typecheck \/ lint \/ tests \/ build)\n- [ ] Security gate passed (`security-auditor` clean)\n- [ ] No secrets in diff (gitleaks)\n- [ ] CLAUDE.md `## Recent Changes` updated (PREPEND a new `### YYYY-MM-DD \u00b7 branch \u00b7 vX.Y.Z` block \u2014 append-only LIFO, cap 10; `domain-updater` v3.0.0+ does this automatically post-commit)\n- [ ] Conventional commit message drafted\n- [ ] Push target confirmed (`origin main` vs `origin feature\/*`)\n\n## 5.5. Post-push CI verification (GitHub Actions)\n\n**After every successful `git push` to a GitHub remote**, verify Actions for that commit. Local gates \u2260 remote CI. Majority of projects here use GitHub Actions. See memory `post-push-ci-verification.md` and `commit-manager` Step 5.5.\n\n```bash\nSHA=$(git rev-parse HEAD)\n\n# List runs for this commit\ngh run list --commit \"$SHA\" --limit 10\n\n# Watch incomplete runs until they finish (fail the shell if a run fails)\nfor id in $(gh run list --commit \"$SHA\" --json databaseId,status \\\n  --jq '.[] | select(.status != \"completed\") | .databaseId'); do\n  gh run watch \"$id\" --exit-status\ndone\n\n# Summarize conclusions\ngh run list --commit \"$SHA\" --json name,conclusion,url \\\n  --jq '.[] | \"\\(.conclusion)\\t\\(.name)\\t\\(.url)\"'\n```\n\nOn failure:\n\n```bash\ngh run view <run-id> --log-failed   # or open the URL from gh run list\n```\n\n| Skip when | Report as |\n|---|---|\n| `origin` is not GitHub | `CI: skipped (non-GitHub remote)` |\n| `gh` missing \/ not authenticated | `CI: skipped (gh unavailable)` |\n| No `.github\/workflows\/` | `CI: skipped (no workflows)` |\n\nNever claim **deploy \/ release \/ npm publish** success unless the matching workflow job concluded `success` (or the user confirmed outside CI).\n\n## 6. Tags & releases\n\n```bash\n# Annotated tags only \u2014 lightweight tags are stripped by some hosts\ngit tag -a v1.2.3 -m \"Release v1.2.3\"\ngit push origin v1.2.3\n```\n\nSemver: bump `MAJOR.MINOR.PATCH` per breaking\/feature\/fix.\n\n## 7. Recovering from mistakes\n\n| Situation | Fix |\n|---|---|\n| Bad commit not pushed | `git reset --soft HEAD~1`, fix, re-commit via `scope.ts commit` |\n| Bad commit pushed to feature branch | `git commit --amend` then `git push --force-with-lease` |\n| Bad commit pushed to main | `git revert <sha>` and push the revert (NEVER force-push main) |\n| Pushed a secret | Follow `secrets-management` rotation triage (contain before revoke if compromise suspected) |\n| Wrong branch | `git stash`, `git checkout <correct>`, `git stash pop` |\n| `scope` exits 1 | `peers.ts list` \u2192 `scope commit --session <short-id>` |\n| `scope` exits 2 | `peers.ts notify`, wait, retry |\n| Committed a peer's file | revert\/soft-reset if unpushed, then `scope commit`; notify peer |\n\n## Rules\n\n- **NEVER** `git add -A` \/ `git add .` \/ `git add -u` \/ `git commit -a` \u2014 use `scope.ts commit`\n- **NEVER** widen staging to work around a `scope` refusal\n\n- **NEVER** force-push `main` \/ `master`\n- **NEVER** `--no-verify` to bypass hooks\n- **ALWAYS** Conventional Commits, no AI-attribution footers\n- **ALWAYS** end on `main` with a clean tree (Stop validator enforces)\n- **ALWAYS** verify GitHub Actions after push (or document an explicit skip)\n- **ONE** feature per branch (or per direct-to-main commit batch)\n\n## See Also\n\n- `commit-manager` agent \u2014 drives the message + push + **CI verify** pipeline\n- Memory `post-push-ci-verification.md` \u2014 always-on post-push checklist\n- `quality-gate` \u2014 the local gate the commit-manager waits for before commit\n- `secrets-management` \u2014 gitleaks 3-layer (pre-commit, CI, push protection)\n- `ci-pipelines` \u2014 workflow authorship + failing-job triage\n","use_cases":["Enforce conventional commit messages across a team","Ensure proper branch naming for feature, fix, and refactor branches","Automate quality gate checks before committing and pushing","Avoid conflicts by ensuring only your files are committed","Verify CI pipelines after pushing to feature or main branches"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/0x57-1\/start-vibing-stacks\/blob\/6e398b34c4dfe73ac8f809216b218856b8e02ff4\/stacks\/_shared\/skills\/git-workflow\/SKILL.md","source_commit":"6e398b34c4dfe73ac8f809216b218856b8e02ff4","license":null,"version":null,"listing_approved_at":"2026-12-03","created_at":"2026-12-02T09:11:16.000000Z","updated_at":"2026-12-03T16:20:08.000000Z","seo_title":"Git Workflow for Commit-Manager: Conventional Commits and Branch Rules","seo_description":"A structured Git workflow that enforces conventional commits, branch naming conventions, and push policies. Ensures clean, documented history and avoids conflicts with un","seo_keywords":["git workflow","conventional commits","branch naming","commit manager","ci pipeline verification","git push policy","code quality gate"]}}