{"id":"03a1d662-cdad-4187-a552-4cd7fd8727a8","shortId":"xGQkN6","kind":"skill","title":"commit","tagline":"This skill should be used when the user asks to \"commit changes\", \"craft a commit message\", \"stage and commit\", \"commit only session edits\", or run a commit workflow with flags like --all, --deep, --close, or --push. Creates atomic git commits with heuristic analysis, conventiona","description":"# Git Commit\n\nCreate atomic commits by staging the right files, analyzing the staged diff, composing a conventional commit message, and optionally pushing.\n\n## Workflow\n\n### 1) Pre-flight + context (single call)\n\nRun all checks and context collection in one bash call:\n\n```bash\ngit rev-parse --is-inside-work-tree \\\n  && ! test -d \"$(git rev-parse --git-dir)/rebase-merge\" \\\n  && ! test -f \"$(git rev-parse --git-dir)/MERGE_HEAD\" \\\n  && ! test -f \"$(git rev-parse --git-dir)/CHERRY_PICK_HEAD\" \\\n  && git symbolic-ref HEAD \\\n  && git status --short --branch\n```\n\nIf any check fails, stop with a clear error and suggested fix.\n\nArguments: `$ARGUMENTS`\n\n### 2) Parse arguments\n\n- Flags:\n  - `--all` commit all changes\n  - `--deep` deep analysis, breaking changes, concise body\n  - `--push` push after commit\n  - `--close <issue_numbers>` append `Closes #N` trailers for listed issues (comma/space-separated)\n- Value arguments:\n  - Type keyword (any conventional type) overrides inferred type\n  - Quoted text overrides inferred description\n\n### 3) Stage + read diff\n\n- If `--all`:\n  - If no changes at all: error \"No changes to commit\"\n  - If unstaged changes exist: `git add -A`\n  - If already staged: proceed\n- Otherwise (atomic commits):\n  - Session-modified files = files edited in this session\n  - Currently staged files: `git diff --cached --name-only`\n  - For staged files NOT in session-modified set: `git restore --staged <file>`\n  - For session-modified files with changes: `git add <file>`\n  - If none: error \"No files modified in this session\"\n- **Unrelated changes**: session-modified files may contain pre-existing uncommitted changes (hunks not from this session). Include the entire file—partial staging is impractical. Never revert, discard, or `git checkout` unrelated changes.\n- Read the staged diff once: `git diff --cached`\n- Log staged files with status (A/M/D)\n\n### 4) Analyze + compose message\n\nRead the staged diff and produce the commit message in a single pass.\n\n**Type inference** — determine from behavior:\n\n| Behavior | Type |\n|---|---|\n| New functionality | `feat` |\n| Bug fix / error handling | `fix` |\n| Code reorganization, no behavior change | `refactor` |\n| Documentation | `docs` |\n| Tests | `test` |\n| Build system (webpack, vite, esbuild) | `build` |\n| CI/CD pipelines | `ci` |\n| Dependencies | `chore(deps)` |\n| Formatting / whitespace only | `style` |\n| Performance | `perf` |\n| Reverting previous commit | `revert` |\n| AI config (CLAUDE.md, .claude/, .gemini/, .codex/) | `ai` |\n| Other maintenance | `chore` |\n\nExplicit type keyword in arguments takes precedence over inference.\n\n**Scope** — infer only when path makes it obvious (lowercase).\n\n**Unrelated hunks** — ignore pre-existing changes when determining type/scope/description. If unrelated changes are in the same file as session changes, they are included in the commit scope but should not influence the message.\n\n**Message format:**\n\n- Subject line (<= 50 chars): `type(scope): description` or `type: description`\n- Imperative mood (\"add\" not \"added\"), lowercase, no period\n- Describe what the change does, not which files changed\n- Body: hyphenated lines for distinct changes; skip for trivial changes\n\n**Issue linking** — scan the chat transcript for GitHub issue references (e.g. `#123`, `owner/repo#123`, issue URLs) that the current changes resolve. For each match, append a `Closes #N` trailer. Skip issues merely mentioned in passing; include only ones the commit actually closes.\n\n**If `--deep`:**\n\n- Deep semantic analysis; detect breaking changes\n- Infer scope from code structure even when path isn't clear\n- Body: 2-3 hyphenated lines max, focus on WHY\n- Breaking change: `BREAKING CHANGE:` + one-line migration note\n\n**If `--close`:**\n\n- Append a `Closes #N` line for each issue number provided\n- Multiple issues: one `Closes #N` per line in the body/trailer\n- Merge with transcript-scanned issues; de-duplicate\n\n### 5) Commit\n\n- Use `git commit -m \"subject\"` (add `-m \"body\"` only if body is non-empty)\n- Output: commit hash + subject + file count summary\n- If failed: show error + suggest fix\n\n### 6) Push (if `--push`)\n\n- If upstream exists: `git push`\n- If no upstream: `git push -u origin HEAD`\n- If failed: show error + suggest fix (pull/rebase first, set upstream, check auth)","tags":["commit","agent","skills","paulrberg","agent-skills","ai-agents"],"capabilities":["skill","source-paulrberg","skill-commit","topic-agent-skills","topic-ai-agents"],"categories":["agent-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/PaulRBerg/agent-skills/commit","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add PaulRBerg/agent-skills","source_repo":"https://github.com/PaulRBerg/agent-skills","install_from":"skills.sh"}},"qualityScore":"0.475","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 50 github stars · SKILL.md body (4,296 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T00:56:17.952Z","embedding":null,"createdAt":"2026-04-18T22:17:40.780Z","updatedAt":"2026-04-22T00:56:17.952Z","lastSeenAt":"2026-04-22T00:56:17.952Z","tsv":"'-3':546 '/cherry_pick_head':125 '/merge_head':115 '/rebase-merge':105 '1':69 '123':494,496 '2':149,545 '3':192 '4':318 '5':593 '50':448 '6':623 'a/m/d':317 'actual':523 'ad':460 'add':213,260,458,600 'ai':382,388 'alreadi':216 'analysi':44,159,529 'analyz':56,319 'append':169,507,564 'argument':147,148,151,178,396 'ask':10 'atom':39,49,220 'auth':651 'bash':84,86 'behavior':339,340,353 'bodi':163,473,544,602,605 'body/trailer':583 'branch':134 'break':160,531,553,555 'bug':345 'build':360,365 'cach':236,311 'call':75,85 'chang':13,156,161,200,205,210,258,271,282,303,354,416,422,430,467,472,478,482,502,532,554,556 'char':449 'chat':487 'check':78,137,650 'checkout':301 'chore':370,391 'ci':368 'ci/cd':366 'claud':385 'claude.md':384 'clear':142,543 'close':35,168,170,509,524,563,566,577 'code':350,536 'codex':387 'collect':81 'comma/space-separated':176 'commit':1,12,16,20,21,28,41,47,50,63,154,167,207,221,329,380,436,522,594,597,611 'compos':60,320 'concis':162 'config':383 'contain':277 'context':73,80 'convent':62,182 'conventiona':45 'count':615 'craft':14 'creat':38,48 'current':231,501 'd':97 'de':591 'de-dupl':590 'deep':34,157,158,526,527 'dep':371 'depend':369 'describ':464 'descript':191,452,455 'detect':530 'determin':337,418 'diff':59,195,235,307,310,325 'dir':104,114,124 'discard':298 'distinct':477 'doc':357 'document':356 'duplic':592 'e.g':493 'edit':24,227 'empti':609 'entir':290 'error':143,203,263,347,620,643 'esbuild':364 'even':538 'exist':211,280,415,629 'explicit':392 'f':107,117 'fail':138,618,641 'feat':344 'file':55,225,226,233,242,256,265,275,291,314,427,471,614 'first':647 'fix':146,346,349,622,645 'flag':31,152 'flight':72 'focus':550 'format':372,445 'function':343 'gemini':386 'git':40,46,87,98,103,108,113,118,123,126,131,212,234,249,259,300,309,596,630,635 'git-dir':102,112,122 'github':490 'handl':348 'hash':612 'head':130,639 'heurist':43 'hunk':283,411 'hyphen':474,547 'ignor':412 'imper':456 'impract':295 'includ':288,433,518 'infer':185,190,336,400,402,533 'influenc':441 'insid':93 'is-inside-work-tre':91 'isn':541 'issu':175,483,491,497,513,571,575,589 'keyword':180,394 'like':32 'line':447,475,548,559,568,580 'link':484 'list':174 'log':312 'lowercas':409,461 'm':598,601 'mainten':390 'make':406 'match':506 'max':549 'may':276 'mention':515 'mere':514 'merg':584 'messag':17,64,321,330,443,444 'migrat':560 'modifi':224,247,255,266,274 'mood':457 'multipl':574 'n':171,510,567,578 'name':238 'name-on':237 'never':296 'new':342 'non':608 'non-empti':607 'none':262 'note':561 'number':572 'obvious':408 'one':83,520,558,576 'one-lin':557 'option':66 'origin':638 'otherwis':219 'output':610 'overrid':184,189 'owner/repo':495 'pars':90,101,111,121,150 'partial':292 'pass':334,517 'path':405,540 'per':579 'perf':377 'perform':376 'period':463 'pipelin':367 'pre':71,279,414 'pre-exist':278,413 'pre-flight':70 'preced':398 'previous':379 'proceed':218 'produc':327 'provid':573 'pull/rebase':646 'push':37,67,164,165,624,626,631,636 'quot':187 'read':194,304,322 'ref':129 'refactor':355 'refer':492 'reorgan':351 'resolv':503 'restor':250 'rev':89,100,110,120 'rev-pars':88,99,109,119 'revert':297,378,381 'right':54 'run':26,76 'scan':485,588 'scope':401,437,451,534 'semant':528 'session':23,223,230,246,254,269,273,287,429 'session-modifi':222,245,253,272 'set':248,648 'short':133 'show':619,642 'singl':74,333 'skill':3 'skill-commit' 'skip':479,512 'source-paulrberg' 'stage':18,52,58,193,217,232,241,251,293,306,313,324 'status':132,316 'stop':139 'structur':537 'style':375 'subject':446,599,613 'suggest':145,621,644 'summari':616 'symbol':128 'symbolic-ref':127 'system':361 'take':397 'test':96,106,116,358,359 'text':188 'topic-agent-skills' 'topic-ai-agents' 'trailer':172,511 'transcript':488,587 'transcript-scan':586 'tree':95 'trivial':481 'type':179,183,186,335,341,393,450,454 'type/scope/description':419 'u':637 'uncommit':281 'unrel':270,302,410,421 'unstag':209 'upstream':628,634,649 'url':498 'use':6,595 'user':9 'valu':177 'vite':363 'webpack':362 'whitespac':373 'work':94 'workflow':29,68","prices":[{"id":"f21243cc-77d0-4de4-a6b3-c4f50be3ff37","listingId":"03a1d662-cdad-4187-a552-4cd7fd8727a8","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"PaulRBerg","category":"agent-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T22:17:40.780Z"}],"sources":[{"listingId":"03a1d662-cdad-4187-a552-4cd7fd8727a8","source":"github","sourceId":"PaulRBerg/agent-skills/commit","sourceUrl":"https://github.com/PaulRBerg/agent-skills/tree/main/skills/commit","isPrimary":false,"firstSeenAt":"2026-04-18T22:17:40.780Z","lastSeenAt":"2026-04-22T00:56:17.952Z"}],"details":{"listingId":"03a1d662-cdad-4187-a552-4cd7fd8727a8","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"PaulRBerg","slug":"commit","github":{"repo":"PaulRBerg/agent-skills","stars":50,"topics":["agent-skills","ai-agents"],"license":"mit","html_url":"https://github.com/PaulRBerg/agent-skills","pushed_at":"2026-04-20T16:22:56Z","description":"PRB's collection of agent skills","skill_md_sha":"9a6d6d571d823eaf83960484b4bb40e5964526e6","skill_md_path":"skills/commit/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/PaulRBerg/agent-skills/tree/main/skills/commit"},"layout":"multi","source":"github","category":"agent-skills","frontmatter":{"name":"commit","description":"This skill should be used when the user asks to \"commit changes\", \"craft a commit message\", \"stage and commit\", \"commit only session edits\", or run a commit workflow with flags like --all, --deep, --close, or --push. Creates atomic git commits with heuristic analysis, conventional-commit formatting, staging rules, optional deep analysis, and optional push."},"skills_sh_url":"https://skills.sh/PaulRBerg/agent-skills/commit"},"updatedAt":"2026-04-22T00:56:17.952Z"}}