Generate standardized commit messages and manage code submission workflow. Generic fallback for repos without a project-specific git-commit skill. Use when user says: commit, 提交, git commit, push, 推送, generate commit message, 生成commit message, commit msg, 写commit, or any request to create a git commit or push code for review. NOTE: If the project has a `git-commit` skill (e.g. Gerrit/Vela projects), defer to that instead.
How this skill is triggered — by the user, by Claude, or both
Slash command
/rtos-engineer-toolkit:commit-helperThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Generate standardized commit messages and guide the code submission workflow.
Generate standardized commit messages and guide the code submission workflow.
Scope: This is a generic commit helper. If the project provides a dedicated git-commit skill (common in Gerrit/Vela/NuttX projects), that skill takes precedence over this one — it has deeper integration with project-specific tooling (checkpatch, JIRA, Change-Id management).
Read .claude/rtos-knowledge/conventions.md for commit message format and push model. If not found, invoke project-init first.
Run these commands simultaneously:
git symbolic-ref HEAD 2>/dev/null — verify we are on a named branch (not detached HEAD)git status — verify there are changes to commit; also detect rebase/merge stategit diff --cached — staged changes (primary)git diff — unstaged changes (for staging decisions)git log --oneline -5 2>/dev/null — confirm commit style (may fail on empty repo)Abort conditions (inform user and stop):
git status shows "rebase in progress", or .git/rebase-merge/.git/MERGE_HEAD exists) — tell user to resolve firstgit checkout -b <branch-name>Initial commit (no HEAD yet): git diff --cached still works; git log will fail — skip log silently and infer format from conventions.md only.
Use the format defined in .claude/rtos-knowledge/conventions.md. If not available, infer from git log output.
Common patterns to detect:
<module>: <subject> (NuttX, Linux kernel style)<type>(<scope>): <subject> (Conventional Commits)[MODULE] <subject> (bracket prefix style)Rules (universal):
Before creating the commit, verify the message contains only printable ASCII plus whitespace:
printf '%s\n' "$COMMIT_MSG" | LC_ALL=C tr -d '\t\n\r -~' | wc -c
If the byte count is > 0, non-ASCII characters are present. Rewrite the message in English before proceeding.
Common violations:
git add -A or git add . blindly).env, .env.* — environment secrets*.key, *.pem, *.p12, id_rsa* — private keyscredentials.json, token.json, *.keystore — auth tokensgit diff --cached --stat for unexpectedly large files).claude/ internal state files (unless explicitly project-shared like tasks.json)*.bin, *.elf, *.hex should NOT be staged unless the project explicitly versions firmware binariesRead .claude/rtos-knowledge/coding-style.md (search from workspace root, not git sub-repo root) for the style checker command.
If a checker is specified, run it on the staged files:
<checker-command> <staged-files>
Fix any issues, re-stage, then proceed. If no checker is configured, skip this step.
Create the commit with the validated, ASCII-only message:
git commit -m "$(cat <<'EOF'
<formatted-message>
EOF
)"
For multi-line messages, use a heredoc to preserve formatting. Verify the commit succeeded (exit code 0).
Before pushing, run the pre-submit-review skill on the committed diff:
Fallback: If pre-submit-review skill is not available, skip this step and proceed directly to push (with user confirmation).
Read push model from .claude/rtos-knowledge/conventions.md:
| Model | Command |
|---|---|
| Gerrit | git push <remote> HEAD:refs/for/<branch> |
| GitHub/GitLab PR/MR | Push branch, then create PR/MR |
| Direct push | git push <remote> <branch> |
Rules:
refs/for/): each push creates a new patchset — safe to repeat, not a force-pushChange-Id footer:
# Extract from previous commit
git log --format="%B" -1 | grep "^Change-Id:"
Place Change-Id as the last trailer (after Signed-off-by). If .git/hooks/commit-msg exists and is executable, Change-Id is auto-generated for new commits — do not manually add one in that case.| Failure | Action |
|---|---|
| Style check fails before first commit | Fix, re-stage, create new commit |
| Style check fails after push (Gerrit CI) | Fix, re-stage, amend (preserve Change-Id) |
| Push fails with "not a branch" | Create a named branch first |
| Push fails with "no new changes" | Commit was already submitted — inform user |
| Push fails with auth error | Inform user to check credentials |
| Push fails with hook rejection | Show hook output, do not retry with --no-verify |
| Commit hook fails | Fix the issue, re-stage, create NEW commit (don't amend — the original commit didn't happen) |
Guides creation, editing, and verification of skills for AI coding agents using test-driven development with subagent scenarios. Use when authoring or debugging skills.
npx claudepluginhub kaben123/rtos-engineer-toolkit --plugin rtos-engineer-toolkit