Git commit

From hw-native-sys/simpler · View interactive version

Git commit is an AI agent skill from the GitHub repository hw-native-sys/simpler. Complete git commit workflow including pre-commit review, staging, message generation, and verification. Use when creating commits or preparing changes for commit.

How to use this skill

Skill file

Git Commit Workflow

Prerequisites

Check what changed to determine review/test needs:

git diff --name-only
git diff --cached --name-only

| File Types Changed | Run Tests |

| ------------------ | --------- |

| C++ (.cpp, .h) | Yes |

| Python (.py) | Yes |

| Build system (CMakeLists.txt) | Yes |

| Docs only (.md) | Skip |

| Config only (.gitignore, .json) | Skip |

Pre-Commit Testing

When tests are needed, follow the testing skill for the full strategy: see CODE0 — "Pre-Commit Testing Strategy" section.

Stage Changes

Stage related changes together, never stage build artifacts (build/, *.o, outputs/).

git add path/to/file1.cpp path/to/file2.h
git diff --staged  # Review before committing

Commit Message Format

Subject Line

Type: concise description (under 72 characters, imperative mood, no period)

Types:

| Type | Usage |

| ---- | ----- |

| Add | new feature or file |

| Fix | bug fix |

| Update | enhancement to existing feature |

| Refactor | restructuring without behavior change |

| Support | tooling, profiling, CI infrastructure |

| Sim | simulation-specific changes |

| CI | CI/CD pipeline changes |

Body (required for multi-file changes)

Separate from subject by a blank line. Explain what changed and why. Use bullet points for multiple items. Wrap at 72 characters.

Describe what the change does and why it is correct — not the plan or

step sequence that produced it. No Phase 1 / Step 2 / Gap #3 framing and no

"first did X, then changed to Y" working-process narration (see

CODE0 §1, which applies the same ban to

comments and commit messages).

When to include a body:

Good examples:

Add: paged attention kernel with batch support

- Implement batch-level KV-cache slot allocation in orchestration
- Add softmax_prepare kernel for cross-batch score normalization
- Golden test covers batch_size=4 with variable sequence lengths
Fix: resolve cross-pipeline race in softmax_prepare

PIPE_V and PIPE_S barriers were missing between score accumulation
and softmax normalization, causing sporadic mismatches on hardware
when AICore pipelines overlapped.
Support: restructure .ai-instructions into .claude/skills and rules

- Move coding conventions to .claude/rules/ (auto-loaded)
- Move git-commit and testing workflows to .claude/skills/ (on-demand)
- Rename test-sim/test-device commands to test-example-* for clarity
- Add test-runtime-* commands for runtime-scoped testing
- Add pre-commit testing strategy with npu-smi and nproc detection

Simple changes (body optional):

Fix: typo in vector_example golden.py

Bad examples:

x  Added new feature.              # Past tense, has period
x  fix bug                         # Lowercase type
x  WIP                             # Not descriptive
x  Chore: update gitignore         # Invalid type
x  Support: update stuff           # Vague, no body for multi-file change
x  Add: graph exec — Phase 1 record, Step 2 replay, Gap #3 fixed
                                    # Plan/process framing: say what+why, not the steps

Co-Author Policy

Never add AI co-author lines. Commits reflect human authorship only.

Exception — squash with multiple human authors: When squashing commits from different people (e.g., updating someone else's PR), preserve all other human authors with Co-authored-by: trailers — one per author. This is passed in by commit-and-push when it detects other authors before squashing.

Fix: resolve cross-pipeline race in softmax_prepare

Co-authored-by: Alice <alice@example.com>
Co-authored-by: Bob <bob@example.com>

Pre-Commit Hook Policy

All pre-commit hook errors must be fixed before committing — including pre-existing ones. When a hook (check-headers, cpplint, markdownlint, clang-format, etc.) reports errors in files touched by your commit, fix every error even if it existed before your changes. The principle: any file you modify must leave the commit with zero hook violations.

Post-Commit Verification

git log -1              # Check message
git show HEAD --stat    # Verify staged files

Fix unpushed commits only:

git commit --amend -m "Corrected message"

Checklist

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.