commit
Commit
Overview
Create safe, structured commits with deterministic checks and consistent message quality. Run a guard before staging, then commit using Conventional Commits with a descriptive subject and required body bullets.
Path Resolution (Mandatory)
- Resolve any relative path in this skill from this skill directory, not from the caller's current working directory.
- For this skill, set
skill_dirto the directory that contains this file (commit/SKILL.md), then useskill_dir/scripts/precommit_guard.py. - Do not search for
scripts/precommit_guard.pyat repo root.
Workflow
- Run safety guard:
python3 <skill_dir>/scripts/precommit_guard.py
- Abort immediately if the guard exits non-zero.
- Do not run
git addorgit commitwhen blocked.
- Do not run
- Stage all changes only after guard passes:
git add . -A
- Review staged changes:
git diff --cached --name-onlygit diff --cached --stat
- Compose commit subject and body from the actual staged diff, using the format rules below.
- Execute commit:
git commit -m "<subject>" -m "<body>"
Safety Guard Rules
Abort when any path matches one of these conditions:
- Log-like files:
*.log,*.out,*.errnpm-debug.log*,yarn-debug.log*,yarn-error.log*,pnpm-debug.log*- any file under a
logs/directory, except.gitignore
- Untracked high-risk binary extensions:
.exe,.dll,.so,.dylib,.bin,.class.zip,.tar,.gz,.bz2,.xz,.7z,.rar,.jar.iso,.dmg,.db,.sqlite,.sqlite3
If blocked, list offending files grouped by reason and request user action. Do not auto-delete files.
Commit Message Format
Use Conventional Commits subject:
<type>(<scope>): <description>- Scope is optional, but prefer it when clear.
- Subject must describe what changed (not only intent), be imperative, and avoid trailing period.
- Keep subject concise (prefer <= 72 chars).
Allowed type values:
feat,fix,refactor,docs,test,chore,build,ci,perf,style,revert
Require commit body:
- Provide bullet lines summarizing key changes and impact.
- Reflect the actual staged/uncommitted changes, not only the latest conversation turn or user message.
- Mention migration/risk notes when relevant.
- Use concise, factual bullets.
Example:
Subject:
fix(auth): handle token refresh race in session middleware
Body:
- Serialize refresh attempts per user session to prevent duplicate refresh calls.- Add timeout handling so failed refresh does not block subsequent requests.- Update session middleware tests for concurrent request scenarios.
Execution Notes
- Prefer one logical commit for the current request.
- If changes are unrelated, split into separate commits and repeat the guard + staging flow for each.
- If message quality is uncertain, summarize staged diff first, then derive subject/body.
More from bohdan-shulha/skills
qt-qml-attachments
>-
17commit-jira
Create and execute Git commits with a required JIRA-style subject and required body. Use when the user asks to commit changes, write commit messages, or prepare a clean commit and expects a ticket-prefixed subject. Always run a pre-commit safety guard first, abort on log files or untracked high-risk binary extensions, then stage with `git add . -A`.
10claude-cli-agent-protocol
>-
10plan-b
Create a concise plan for coding/build tasks, especially when users say "I want to make..." or "I need to do...". Use to generate a final plan by aggregating multiple subagent plan variants, include ASCII diagrams/flows/UI mockups when possible, and follow the create-plan style (read-only scan, minimal questions).
8repo-wiki
Generate and maintain a living repo wiki, specs, PRDs, and architecture docs in .repo-wiki/ so coding agents can navigate the codebase with strong context. Use for codebase discovery, PR-driven documentation updates, module docs, architecture maps, feature specs, and deleting stale knowledge when code changes.
1