Skill: samber/conventional-git (version 1.2.0)

--- name: conventional-git description: Conventional Commits v1.0.0 branch naming, worktree naming, and commit message standards for GitHub and GitLab projects. Use when creating branches, naming worktrees, writing commits, generating commit messages, reviewing branch conventions, or setting up changelog automation. Apply when your project needs consistent git history, SemVer-driven releases, parseable changelog generation, or automatic issue closing. Trigger when the user asks how to name a worktree, create a git worktree, or organize worktrees alongside branches. user-invocable: true license: MIT compatibility: Designed for Claude Code or similar AI coding agents. Requires git. metadata: author: samber version: "1.2.0" openclaw: emoji: "📝" homepage: https://github.com/samber/cc-skills requires: bins: - git allowed-tools: Read Edit Write Glob Grep Bash(git:*) Bash(gh:*) --- # Conventional Commits & Branch Naming Follow Conventional Commits v1.0.0 for both branch names and commit messages — consistent naming lets tools auto-generate changelogs, enforce SemVer bumps, and filter history by concern. ## Branch Naming Format: `<type>/[issue-]<description>` — lowercase, hyphens only, no special chars except `/`. ``` feat/user-authentication feat/42-user-authentication fix/login-race-condition fix/87-login-race-condition docs/api-reference-update refactor/payment-module ``` Prefix with the issue number when one exists — GitHub and GitLab auto-link it and it makes `git log` immediately traceable to the tracker. Keep the description under 50 characters — most git UIs truncate branch names in lists around that length. Match the type to the work you're doing — this is the contract readers use to understand the branch purpose at a glance. NEVER include `worktree` in a branch name — git worktrees are a local checkout mechanism, not a branch concept; the name would leak implementation details into the remote and confuse other contributors. ## Worktree Naming Worktrees are local checkout directories — they never appear in the remote. Place them under `.claude/worktrees/` and name them by replacing the branch `/` separator with `-`. ``` git worktree add .claude/worktrees/feat-user-authentication feat/user-authentication git worktree add .claude/worktrees/fix-87-login-race-condition fix/87-login-race-condition ``` The directory name mirrors the branch name so `git worktree list` stays readable and each worktree is immediately traceable to its branch without inspecting the checkout. Run `git worktree list` before creating a new one — reuse an existing worktree if it already covers the same branch. Keep worktrees scoped to a single branch. Doing unrelated work inside someone else's worktree obscures which changes belong where and makes cleanup error-prone. Remove the worktree once its branch is merged — either after a local merge or after the pull/merge request is closed on the remote. Stale worktrees accumulate and make `git worktree list` unreadable. ```bash git worktree remove .claude/worktrees/feat-user-authentication # branch merged locally git worktree prune # remove refs to already-deleted directories ``` ## Commit Message Format ``` <type>[optional scope]: <description> [optional body] [optional footer(s)] ``` **Types:** | Type | SemVer | When | | ---------- | ------ | ---------------------------- | | `feat` | MINOR | New feature | | `fix` | PATCH | Bug fix | | `docs` | — | Docs only | | `style` | — | Formatting, no logic change | | `refactor` | — | Restructure, no feature/fix | | `perf` | — | Performance improvement | | `test` | — | Add/fix tests | | `build` | — | Build system, deps | | `ci` | — | CI config | | `chore` | — | Anything else (not src/test) | | `revert` | — | Reverts a previous commit | **Rules:** - Subject line ≤ 72 characters — git log and GitHub/GitLab UIs silently truncate longer subjects - Imperative mood: "add" not "added" — reads as an instruction, not a history log - No capital letter, no trailing period — enforces uniform parsing by changelog tools - Body separated by blank line — parsers split header/body at the first blank line - Breaking changes: use `!` after type/scope, or add `BREAKING CHANGE:` footer (triggers MAJOR bump) — body-only descriptions are invisible to changelog tools - `revert` commits SHOULD include `This reverts commit <hash>.` in the body — `git revert` generates this automatically; don't strip it - NEVER add a Claude signature, AI agent attribution, or `Co-authored-by` trailer for Claude or any other AI agent to commits **Examples:** ``` feat(auth): add JWT token refresh ``` ``` fix: prevent race condition on concurrent requests Introduce request ID and reference to latest request. Dismiss responses from stale requests. ``` ``` refactor!: drop support for Go 1.18 BREAKING CHANGE: Go 1.18 no longer supported; uses stdlib APIs from 1.21+ ``` ## Closing Issues via Commit Messages Both GitHub and GitLab detect keywords in commit messages and automatically close the referenced issue when the commit lands on the default branch. Place the reference in the **footer** (preferred — keeps the subject line clean). **Keywords:** `close`, `closes`, `closed`, `fix`, `fixes`, `fixed`, `resolve`, `resolves`, `resolved` — case-insensitive. **GitHub:** ``` fix(auth): prevent token expiry race condition Closes #42 Closes owner/repo#99 ``` - Triggers when merged into the **default branch** (usually `main`) - Cross-repo: `Closes owner/repo#42` - Close multiple: `Closes #42, closes #43` - Works in PR descriptions too **GitLab:** ``` feat: add dark mode support Resolves #101 Closes group/project#42 ``` - Triggers when merged into the **default branch** (configurable per project) - Cross-project: `Closes group/project#42` - Close multiple: `Closes #101, closes #102` - Works in MR descriptions too **Tip:** Pair with the commit type — `fix:` closing a bug issue, `feat:` closing a feature request — keeps the changelog semantically coherent. ## Common Mistakes | Mistake | Fix | | --- | --- | | `feat: Added login page` | `feat: add login page` — imperative, no capital | | `fix: fix bug.` | `fix: fix bug` — no trailing period | | Subject over 72 chars | Shorten; move detail to body | | Breaking change only in body | Add `!` or `BREAKING CHANGE:` footer — tools won't detect body-only | | `feat(adding-auth): ...` | `feat(auth): ...` — scope is a noun, not a verb | | Closes #42 in subject line | Move to footer — keeps subject clean and parseable | ## Best Practices - Align branch type and commit type — `feat/auth-*` branch → `feat(auth):` commits - One concern per branch — mixing fixes into feature branches obscures the changelog - Use scope consistently within a branch — `feat(auth):` throughout, not `feat(user):` mid-way - **Squash merge:** when squash-merging a PR/MR, the branch commits are collapsed into one — the PR/MR title becomes the commit message. If the title doesn't follow conventional commits format, changelog generation breaks silently. Always set the PR title before squashing.

path: evals/evals.json
content: {
  "skill_name": "conventional-git",
  "metadata": {
    "eval_methodology": "adversarial — each eval has a trap the model falls into without the skill",
    "without_skill_runner_note": "When running without-skill evals, disable ALL skills from this plugin AND any external git-related skills (e.g., gh-cli). External git skills may compensate for missing conventional-git guidance and inflate without-skill scores."
  },
  "evals": [
    {
      "id": 1,
      "prompt": "I use git worktrees to isolate my feature branches. Create a branch name for implementing OAuth login.",
      "trap": "Without the skill, the model naturally echoes 'worktree' from the prompt into the branch name (e.g., feat/worktree-oauth-login). The skill explicitly forbids 'worktree' in branch names.",
      "expected_output": "A branch name like feat/oauth-login — does NOT contain 'worktree'. May include an explanation of why worktree should not appear in branch names.",
      "files": [],
      "assertions": [
        { "id": "1.1", "description": "branch name does NOT contain the word 'worktree'" },
        { "id": "1.2", "description": "branch name starts with 'feat/'" },
        { "id": "1.3", "description": "branch name is entirely lowercase and uses hyphens only (no underscores, no special chars except '/')" },
        { "id": "1.4", "description": "response explains why 'worktree' should not appear in branch names (it is a local checkout mechanism, not a branch concept)" },
        { "id": "1.5", "description": "branch name description part is 50 characters or fewer" }
      ]
    },
    {
      "id": 2,
      "prompt": "I'm working on GitHub issue #87 to fix the login race condition. Give me the branch name.",
      "trap": "Without the skill, the model omits the issue number and outputs fix/login-race-condition. The skill requires prefixing with the issue number when one exists.",
      "expected_output": "fix/87-login-race-condition — issue number comes BEFORE the description, not after.",
      "files": [],
      "assertions": [
        { "id": "2.1", "description": "branch name includes the issue number '87'" },
        { "id": "2.2", "description": "issue number '87' appears BEFORE the description (e.g., fix/87-login, not fix/login-87)" },
        { "id": "2.3", "description": "branch name starts with 'fix/'" },
        { "id": "2.4", "description": "branch name is entirely lowercase and uses hyphens only" },
        { "id": "2.5", "description": "branch name description part (after the issue number) is 50 characters or fewer" }
      ]
    },
    {
      "id": 3,
      "prompt": "I'm adding authentication to the app. I just created a UserAuthService class. Write the commit.",
      "trap": "Without the skill, the model echoes the gerund from the prompt into the scope: feat(adding-authentication): or feat(user-auth-service):. The skill's Common Mistakes table says scope must be a noun, not a verb.",
      "expected_output": "feat(auth): add user auth service — scope is a short noun, not a gerund or verb phrase.",
      "files": [],
      "assertions": [
        { "id": "3.1", "description": "scope does NOT end in '-ing' (no gerund like 'adding', 'implementing', 'creating')" },
        { "id": "3.2", "description": "scope does NOT contain 'adding', 'implementing', or 'creating' as part of the scope name" },
        { "id": "3.3", "description": "scope is a short noun (e.g., 'auth', 'user', 'authentication') — 1-2 words max" },
        { "id": "3.4", "description": "type is 'feat'" },
        { "id": "3.5", "description": "description uses imperative mood (e.g., 'add', 'implement', 'create') — not past tense" },
        { "id": "3.6", "description": "description starts with lowercase letter" }
      ]
    },
    {
      "id": 4,
      "prompt": "We always squash-merge PRs on this project. Our PR title for this branch is 'Add user dashboard feature'. What should I know before merging?",
      "trap": "Without the skill, the model discusses squash merging in general (commits collapse into one) but does NOT warn that the PR title becomes the single commit message and must follow Conventional Commits format — a silent changelog-breaking failure.",
      "expected_output": "Warn that the PR title becomes the commit message after squash, flag that 'Add user dashboard feature' does not follow Conventional Commits format (missing type prefix), and suggest a corrected title.",
      "files": [],
      "assertions": [
        { "id": "4.1", "description": "warns that the PR title becomes the single commit message after squash merge" },
        { "id": "4.2", "description": "explicitly states the PR title must follow Conventional Commits format" },
        { "id": "4.3", "description": "flags that 'Add user dashboard feature' is invalid because it lacks a type prefix" },
        { "id": "4.4", "description": "suggests a corrected PR title using Conventional Commits format (e.g., 'feat: add user dashboard')" }
      ]
    },
    {
      "id": 5,
      "prompt": "I fixed the null pointer crash reported in issue #42. Write the commit message.",
      "trap": "Without the skill, the model often embeds the issue reference in the subject line (e.g., 'fix: resolve #42 null pointer crash'). The skill requires closing keywords to appear in the footer only, to keep the subject clean and parseable.",
      "expected_output": "Subject line is clean (no #42 in subject). 'Closes #42' or equivalent appears in the footer, separated by a blank line.",
      "files": [],
      "assertions": [
        { "id": "5.1", "description": "subject line does NOT contain '#42', 'close', 'closes', 'fix', 'fixes', or 'resolve' referencing the issue number" },
        { "id": "5.2", "description": "'Closes #42' or equivalent closing keyword + reference appears in the footer (separated from body or subject by a blank line)" },
        { "id": "5.3", "description": "subject line uses imperative mood" },
        { "id": "5.4", "description": "type is 'fix'" },
        { "id": "5.5", "description": "subject line does not end with a trailing period" }
      ]
    },
    {
      "id": 6,
      "prompt": "I upgraded all npm packages to their latest versions. Write the commit message.",
      "trap": "Without the skill, the model almost universally writes 'chore: upgrade npm dependencies'. The skill maps dependencies to the 'build' type (build system, deps), not 'chore'.",
      "expected_output": "build: upgrade npm dependencies (or similar) — type is 'build', NOT 'chore'.",
      "files": [],
      "assertions": [
        { "id": "6.1", "description": "type is 'build'" },
        { "id": "6.2", "description": "type is NOT 'chore'" },
        { "id": "6.3", "description": "description uses imperative mood" },
        { "id": "6.4", "description": "description starts with lowercase letter" },
        { "id": "6.5", "description": "no trailing period at end of subject line" }
      ]
    },
    {
      "id": 7,
      "prompt": "I ran `git revert abc1234f` which reverted the JWT implementation commit. Format the commit message for this revert.",
      "trap": "Without the skill, the model rewrites the body with a custom explanation (e.g., 'Reverted due to instability'). The skill says revert commits SHOULD include 'This reverts commit <hash>.' — the git-generated text must not be stripped.",
      "expected_output": "revert: revert JWT implementation — body contains 'This reverts commit abc1234f.' (the git-generated phrasing, not a custom rewrite).",
      "files": [],
      "assertions": [
        { "id": "7.1", "description": "type is 'revert'" },
        { "id": "7.2", "description": "body includes the phrase 'This reverts commit' (standard git-generated phrasing)" },
        { "id": "7.3", "description": "commit hash 'abc1234f' is referenced in the body" },
        { "id": "7.4", "description": "description uses imperative mood" },
        { "id": "7.5", "description": "no trailing period at end of subject line" }
      ]
    },
    {
      "id": 8,
      "prompt": "We completely redesigned the config file format. Old config files no longer work. Write the commit message.",
      "trap": "Without the skill, models often describe the breaking change in the body only ('Note: this is a breaking change') without using '!' or a BREAKING CHANGE: footer. The skill explicitly states body-only descriptions are invisible to changelog tools.",
      "expected_output": "Commit uses '!' after type/scope AND/OR 'BREAKING CHANGE:' in footer. Does NOT rely solely on body text to signal the breaking change.",
      "files": [],
      "assertions": [
        { "id": "8.1", "description": "commit includes '!' after type/scope (e.g., 'feat!:' or 'refactor!:') OR includes 'BREAKING CHANGE:' in the footer" },
        { "id": "8.2", "description": "does NOT rely solely on body text to signal the breaking change (body-only phrases like 'Note: breaking change' without ! or footer are insufficient)" },
        { "id": "8.3", "description": "type is NOT 'fix' (a config redesign is feat/refactor, not a fix)" },
        { "id": "8.4", "description": "description uses imperative mood" },
        { "id": "8.5", "description": "description starts with lowercase letter" }
      ]
    },
    {
      "id": 9,
      "prompt": "I'm on branch feat/payment-integration. While implementing the payment feature, I discovered and fixed a small bug in the existing checkout flow. Should I use 'fix:' or 'feat:' for the commit, and is there anything else I should consider?",
      "trap": "Without the skill, the model says 'use fix: for the bug' without flagging the one-concern-per-branch principle. The skill teaches that mixing concerns on a feature branch obscures the changelog.",
      "expected_output": "Either recommends a separate fix/ branch for the bug, or explicitly discusses the tradeoff — must explain that mixing concerns obscures the changelog.",
      "files": [],
      "assertions": [
        { "id": "9.1", "description": "does NOT simply say 'use fix: for the bug' without any discussion of the concern-mixing problem" },
        { "id": "9.2", "description": "either recommends creating a separate fix/ branch for the bug, OR explicitly discusses the tradeoff of mixing concerns on a feature branch" },
        { "id": "9.3", "description": "explains that mixing concerns (feat + fix) on one branch obscures the changelog" },
        { "id": "9.4", "description": "if advising to keep the fix on the feature branch, explains the scope/type implications (not just 'use fix:')" }
      ]
    },
    {
      "id": 10,
      "prompt": "My commit in the 'backend' repo fixes an issue in the 'frontend' repo (issue #99, owned by GitHub org 'acme'). Write the commit footer to automatically close it on GitHub.",
      "trap": "Without the skill, the model outputs wrong cross-repo formats: 'Closes frontend#99' (missing owner) or 'Closes acme#99' (missing repo) or plain '#99' (closes in current repo). The skill documents the correct GitHub format: owner/repo#number.",
      "expected_output": "Footer contains 'Closes acme/frontend#99' — the full owner/repo#number cross-repo format.",
      "files": [],
      "assertions": [
        { "id": "10.1", "description": "footer uses 'Closes', 'Fixes', 'Resolves', or equivalent keyword (case-insensitive)" },
        { "id": "10.2", "description": "issue reference uses the full 'owner/repo#number' format (e.g., 'acme/frontend#99')" },
        { "id": "10.3", "description": "does NOT use just '#99' (ambiguous — would close an issue in the current repo, not the frontend repo)" },
        { "id": "10.4", "description": "does NOT use just 'frontend#99' (missing owner — not a valid GitHub cross-repo reference)" },
        { "id": "10.5", "description": "the closing reference is placed in the footer, not the subject line" }
      ]
    }
  ]
}


Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: clean (LOW)