Git Commit Skill
Workflow
Step 1: Review changes
Run both commands to get the full picture:
git status --short
git diff --cached --name-status
git status --short shows unstaged modifications and untracked files. git diff --cached catches files that are already staged but not yet committed. Use the union of both outputs.
If both commands return empty, report "nothing to commit" and stop.
Classify each change:
M— modified,??— untracked,D— deleted,R— renamed,A— staged new file
Step 2: Analyze changes and verify consistency
Classify file paths
| Path pattern | Type |
|---|---|
| posts/, articles/, content/ | content/writing |
| .claude/skills/ | skill config |
| src/, *.go, *.py, *.ts, *.R, *.r | code/scripts |
| *.md | documentation |
| *.json, *.yaml, *.toml, *.csv | config/data |
Cascade check (skip if no scripts or data files changed)
If any modified files are scripts or data files:
- Identify downstream files: Find all markdown reports, appendices, and documentation that reference outputs or data from the modified files — search for filename references, table headers, variable names, and output patterns
- Verify consistency: Check that numbers, table data, file paths, and cross-references in downstream files match the current state of the modified scripts and their outputs
- Fix discrepancies: Update any stale numbers, outdated references, or mismatched data in downstream files. Include these fixes in the commit
CLAUDE.md freshness (always run)
If the working directory has a CLAUDE.md, read it and compare against the current project state — not just the changes being committed, but also decisions made during the session, new or renamed files on disk, and structural changes. Update CLAUDE.md before proceeding if any section reflects outdated state.
Step 3: Decide commit strategy
- Single topic: one commit for all files
- Multiple topics: group by directory/topic, one commit per group
Grouping priority:
- Content (one commit per article/document unit)
- Skills (one commit per skill)
- Code changes (group by module)
- Config files (group together)
Step 4: Generate commit message
Follow conventional commits format from rules/git-workflow.md:
<type>: <description>
Types: feat, fix, refactor, docs, test, chore, perf, ci
Examples:
docs: add exploratory analysis notebookfeat: add batch processing to pipelinefix: correct citation formatting in reportchore: update project config
Keep descriptions concise (under 70 chars).
Step 5: Stage and commit
git add <file1> <file2> ...
git commit -m "<message>"
Rules:
- Specify files explicitly — never use
git add .orgit add -A - Exclude temp files (
*.bak-*,.DS_Store,node_modules/)
Step 6: Confirm
Run: git log --oneline -3