Background Knowledge
Format: <type>[scope]: <description> + mandatory body + optional footers
- •Title: ALL LOWERCASE, <50 chars, imperative mood, no period. Add
!for breaking changes - •Types:
feat,fix,docs,refactor,perf,test,chore,build,ci,style - •Body (REQUIRED): Bullet summary (
-prefix, imperative verbs) + explanation paragraph. ≤72 chars/line - •Footer:
Co-Authored-ByREQUIRED; optionalCloses #123,BREAKING CHANGE: ...
See references/format-rules.md for complete specification and examples.
Phase 1: Configuration Verification
Goal: Load project-specific git configuration and valid scopes.
Actions:
- •FIRST: Read
.claude/git.local.mdto load project configuration - •If file not found, load
git:config-gitskill using the Skill tool to create it - •Extract valid scopes from
scopes:list in YAML frontmatter - •Store these scopes for validation in Phase 3 and Phase 5
Phase 2: Safety Validation
Goal: Perform safety checks before committing.
Actions:
- •Detect sensitive files (credentials, secrets, .env files)
- •Warn about large files (>1MB) and large commits (>500 lines)
- •Use
AskUserQuestiontool for confirmation if issues found
Phase 3: Change Analysis
Goal: Identify logical units of work and infer commit scopes.
Actions:
- •Run
git diff --cachedandgit diffto get code differences (MUST NOT traverse files directly) - •Analyze diff to identify coherent logical units
- •Infer scope(s) from file paths and changes using the valid scopes loaded in Phase 1
- •If inferred scope not in the valid scopes list, load
git:config-gitskill using the Skill tool to update configuration
Phase 4: AI Code Quality Check
Goal: Remove AI-generated slop before committing.
Actions:
- •Run
git diff main...HEADto compare against main branch - •Remove AI patterns: extra comments, unnecessary defensive checks,
anycasts, inconsistent style - •Ensure changes follow project's established patterns
Phase 5: Commit Creation
Goal: Create atomic commits following Conventional Commits format.
Actions (repeat for each logical unit):
- •Draft commit message per
references/format-rules.md - •Validate: title <50 chars lowercase imperative; body has bullets + explanation paragraph; footer has
Co-Authored-By - •Stage relevant files and create commit