Agent skill
git-commit
Complete git commit workflow for PyPTO including pre-commit review, staging, message generation, and verification. Use when creating commits, preparing changes for commit, or when the user asks to commit changes.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/git-commit-hw-native-sys-pypto
SKILL.md
PyPTO Git Commit Workflow
Prerequisites
Check what changed to determine which agents to run:
git diff --name-only
git diff --cached --name-only
Determine testing needs based on changed files:
| File Types Changed | Run Code Review | Run Testing | Run Clang-Tidy |
|---|---|---|---|
C++ (.cpp, .h) |
✅ Yes | ✅ Yes | ✅ Yes |
Python (.py, bindings, tests) |
✅ Yes | ✅ Yes | ❌ Skip |
Build system (.cmake, CMakeLists.txt) |
✅ Yes | ✅ Yes | ✅ Yes |
Docs only (.md, .rst, docs/) |
✅ Yes | ❌ Skip | ❌ Skip |
Config only (.json, .yaml, .toml, .github/) |
✅ Yes | ❌ Skip | ❌ Skip |
| Mixed (code + docs/config) | ✅ Yes | ✅ Yes | If C++ changed |
Launch appropriate agents IN PARALLEL:
code-reviewer- ALWAYS run for all changestesting- ONLY run if code files changedclang-tidy- Runpython tests/lint/clang_tidy.pyif C++ files changed (via Bash agent)
Workflow
- Analyze changed files to determine testing needs
- Launch in parallel (single message with multiple Task tool calls):
- code-reviewer agent (always)
- testing agent (if code changed)
- clang-tidy via Bash agent:
python tests/lint/clang_tidy.py(if C++ changed)
- Wait for all agents to complete
- Address any issues found
- Stage changes
- Generate commit message
- Commit and verify
Stage Changes
Related changes together:
git add path/to/file1.cpp path/to/file2.h
git diff --staged # Review
Cross-layer pattern (C++ + Python + Type stubs + Tests):
git add include/pypto/ir/expr.h python/bindings/ir_binding.cpp \
python/pypto/pypto_core/__init__.pyi tests/ut/ir/test_expr.py
Never stage: Build artifacts (build/, *.o), temp files, IDE configs
Commit Message Format
Structure: type(scope): description (≤72 chars)
Types: feat, fix, refactor, test, docs, style, chore, perf Scope: Module/component (ir, printer, builder) Description: Present tense, action verb, no period
Good examples:
feat(ir): Add unique identifier field to MemRef
fix(printer): Update printer to use yield_ instead of yield
refactor(builder): Simplify tensor construction logic
test(ir): Add edge case coverage for structural comparison
Bad examples (avoid):
❌ feat(ir): Added feature. # Past tense, has period
❌ Fix bug # Missing type prefix
❌ WIP # Not descriptive
Commit
# Short message
git commit -m "feat(ir): Add tensor rank validation"
# Detailed message (in editor)
git commit
In editor:
feat(ir): Add tensor rank validation
Validates tensor rank is positive before setting shape.
Raises ValueError for invalid ranks.
Updates tests with edge case coverage.
Co-Author Policy
❌ NEVER add AI assistants: No Claude, ChatGPT, Cursor AI, etc.
✅ Only credit human contributors: Co-authored-by: Name <email>
Why? AI tools are not collaborators. Commits reflect human authorship.
Post-Commit Verification
git show HEAD # View commit
git log -1 # Check message
git show HEAD --name-only # Verify files
Fix issues (only if not pushed):
git commit --amend -m "Corrected message" # Fix message
git add file && git commit --amend --no-edit # Add forgotten file
⚠️ Only amend unpushed commits!
Checklist
- Changed files analyzed (code vs docs/config only)
- Code review completed
- Tests passed (if code changed) or skipped (if docs/config only)
- Clang-tidy passed (if C++ changed) or skipped (if no C++)
- Only relevant files staged
- No build artifacts
- Message format:
type(scope): description(≤72 chars, present tense, no period) - No AI co-authors
Remember
A good commit is thoroughly reviewed, groups related changes, has clear "why" message, and attributes only human authors.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?