Skill
commit-changes
Check staged changes first; otherwise use context-discovered file changes to stage and commit with a generated message.
Compatibility: Requires a git repository and edited-file context in the current session.
Install this skill
npx skills add adiutama/skills --skill commit-changes Invoked as /commit-changes [scope-hint] [--skip-stage].
Step 1 — Operating contract
- Changed-file source is session context (edited/open/recent/user-listed files).
- Never use CLI to discover modified files (no
git status, no broad working-tree diffs). - CLI is allowed only for staged detection, staging execution, and commit execution.
- Stage by default; skip only when
--skip-stageis explicit. - Ask at most one focused clarification when intent is ambiguous.
Step 2 — Workflow
- Detect staged files first:
- Run
git diff --cached --name-status. - If staged files exist, skip discovery/staging and continue to step 5.
- Run
- If step 1 is empty, discover modified files from context only:
- Build
target_filesfrom edited/open/recent/user-listed files. - Classify each file as Create/Update/Delete from context/tooling.
- If
target_filesis empty, ask user to provide files and stop.
- Build
- Reconcile staged vs modified sets:
- Compare step 1 and step 2 results as a safety check.
- In normal flow here, step 1 is empty and step 2 is non-empty.
- If staged files appear mid-flow (race/manual staging), show both sets and ask one focused confirmation before staging.
- Stage changes (default):
- If
--skip-stageis present, do not rungit add. - Otherwise run
git add -- <target_files...>.
- If
- Draft one default commit message:
- Conventional Commit format.
- Imperative subject, <= 72 chars.
- Concise body focused on why/impact.
- Scope: prefer
[scope-hint]if it matches; otherwise infer one short dominant scope; omit when mixed. - Present this default directly; only generate A/B/C variants when explicitly requested.
- Commit immediately after message generation:
git commit -m "<subject>"(no body)git commit -m "<subject>" -m "<body>"(with body)
Do not ask for staging confirmation.
skills/commit-changes/SKILL.md