{"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, or run a commit workflow. Creates atomic git commits with conventional-commit formatting and optional deep analysis or push. Flags: --all, --deep, --close, --push.","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.478","qualityRationale":"deterministic score 0.48 from registry signals: · indexed on github topic:agent-skills · 56 github stars · SKILL.md body (4,846 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-05-18T18:57:36.117Z","embedding":null,"createdAt":"2026-04-18T22:17:40.780Z","updatedAt":"2026-05-18T18:57:36.117Z","lastSeenAt":"2026-05-18T18:57:36.117Z","tsv":"'-3':543 '/cherry_pick_head':122 '/merge_head':112 '/rebase-merge':102 '1':66 '123':491,493 '2':146,542 '3':189 '4':315 '5':590 '50':445 '6':620 'a/m/d':314 'actual':520 'ad':457 'add':210,257,455,597 'ai':379,385 'alreadi':213 'analysi':35,156,526 'analyz':53,316 'append':166,504,561 'argument':144,145,148,175,393 'ask':10 'atom':24,46,217 'auth':648 'bash':81,83 'behavior':336,337,350 'bodi':160,470,541,599,602 'body/trailer':580 'branch':131 'break':157,528,550,552 'bug':342 'build':357,362 'cach':233,308 'call':72,82 'chang':13,153,158,197,202,207,255,268,279,300,351,413,419,427,464,469,475,479,499,529,551,553 'char':446 'chat':484 'check':75,134,647 'checkout':298 'chore':367,388 'ci':365 'ci/cd':363 'claud':382 'claude.md':381 'clear':139,540 'close':41,165,167,506,521,560,563,574 'code':347,533 'codex':384 'collect':78 'comma/space-separated':173 'commit':1,12,16,21,26,30,44,47,60,151,164,204,218,326,377,433,519,591,594,608 'compos':57,317 'concis':159 'config':380 'contain':274 'context':70,77 'convent':29,59,179 'conventional-commit':28 'count':612 'craft':14 'creat':23,45 'current':228,498 'd':94 'de':588 'de-dupl':587 'deep':34,40,154,155,523,524 'dep':368 'depend':366 'describ':461 'descript':188,449,452 'detect':527 'determin':334,415 'diff':56,192,232,304,307,322 'dir':101,111,121 'discard':295 'distinct':474 'doc':354 'document':353 'duplic':589 'e.g':490 'edit':224 'empti':606 'entir':287 'error':140,200,260,344,617,640 'esbuild':361 'even':535 'exist':208,277,412,626 'explicit':389 'f':104,114 'fail':135,615,638 'feat':341 'file':52,222,223,230,239,253,262,272,288,311,424,468,611 'first':644 'fix':143,343,346,619,642 'flag':38,149 'flight':69 'focus':547 'format':31,369,442 'function':340 'gemini':383 'git':25,43,84,95,100,105,110,115,120,123,128,209,231,246,256,297,306,593,627,632 'git-dir':99,109,119 'github':487 'handl':345 'hash':609 'head':127,636 'hunk':280,408 'hyphen':471,544 'ignor':409 'imper':453 'impract':292 'includ':285,430,515 'infer':182,187,333,397,399,530 'influenc':438 'insid':90 'is-inside-work-tre':88 'isn':538 'issu':172,480,488,494,510,568,572,586 'keyword':177,391 'line':444,472,545,556,565,577 'link':481 'list':171 'log':309 'lowercas':406,458 'm':595,598 'mainten':387 'make':403 'match':503 'max':546 'may':273 'mention':512 'mere':511 'merg':581 'messag':17,61,318,327,440,441 'migrat':557 'modifi':221,244,252,263,271 'mood':454 'multipl':571 'n':168,507,564,575 'name':235 'name-on':234 'never':293 'new':339 'non':605 'non-empti':604 'none':259 'note':558 'number':569 'obvious':405 'one':80,517,555,573 'one-lin':554 'option':33,63 'origin':635 'otherwis':216 'output':607 'overrid':181,186 'owner/repo':492 'pars':87,98,108,118,147 'partial':289 'pass':331,514 'path':402,537 'per':576 'perf':374 'perform':373 'period':460 'pipelin':364 'pre':68,276,411 'pre-exist':275,410 'pre-flight':67 'preced':395 'previous':376 'proceed':215 'produc':324 'provid':570 'pull/rebase':643 'push':37,42,64,161,162,621,623,628,633 'quot':184 'read':191,301,319 'ref':126 'refactor':352 'refer':489 'reorgan':348 'resolv':500 'restor':247 'rev':86,97,107,117 'rev-pars':85,96,106,116 'revert':294,375,378 'right':51 'run':19,73 'scan':482,585 'scope':398,434,448,531 'semant':525 'session':220,227,243,251,266,270,284,426 'session-modifi':219,242,250,269 'set':245,645 'short':130 'show':616,639 'singl':71,330 'skill':3 'skill-commit' 'skip':476,509 'source-paulrberg' 'stage':49,55,190,214,229,238,248,290,303,310,321 'status':129,313 'stop':136 'structur':534 'style':372 'subject':443,596,610 'suggest':142,618,641 'summari':613 'symbol':125 'symbolic-ref':124 'system':358 'take':394 'test':93,103,113,355,356 'text':185 'topic-agent-skills' 'topic-ai-agents' 'trailer':169,508 'transcript':485,584 'transcript-scan':583 'tree':92 'trivial':478 'type':176,180,183,332,338,390,447,451 'type/scope/description':416 'u':634 'uncommit':278 'unrel':267,299,407,418 'unstag':206 'upstream':625,631,646 'url':495 'use':6,592 'user':9 'valu':174 'vite':360 'webpack':359 'whitespac':370 'work':91 'workflow':22,65","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-05-18T18:57:36.117Z"}],"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":56,"topics":["agent-skills","ai-agents"],"license":"mit","html_url":"https://github.com/PaulRBerg/agent-skills","pushed_at":"2026-05-17T10:33:19Z","description":"PRB's collection of agent skills","skill_md_sha":"9885863e4c6dc03278ed902461310120eced04d9","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, or run a commit workflow. Creates atomic git commits with conventional-commit formatting and optional deep analysis or push. Flags: --all, --deep, --close, --push."},"skills_sh_url":"https://skills.sh/PaulRBerg/agent-skills/commit"},"updatedAt":"2026-05-18T18:57:36.117Z"}}