Auto Committer
This skill automates the end-of-task workflow by analyzing your changes, documenting them in the changelog, and creating a semantic commit.
When to Use
- User says "commit my changes"
- User says "I'm done with this task"
- User asks to "update changelog and commit"
Workflow
Follow these steps strictly:
1. Status Check
Check the current repository status.
git status
- If "nothing to commit, working tree clean", inform the user and stop.
- If there are changes, proceed.
2. Context Refresh (CRITICAL)
Before committing, you MUST verify if the documentation is up-to-date with the code changes.
- Action: Invoke
context-aware-codingskill (mentally or explicitly) to checkAI_README.mdandARCHITECTURE.md. - Question: "Did this change introduce new patterns, rules, or architectural decisions?"
- If YES:
- Update the relevant
AI_README.mdordocs/AI_CONTEXT/. - Ask user to review the documentation changes alongside code.
- Add the documentation files to the commit.
- Update the relevant
3. Diff Analysis
Get the detailed changes.
git diff HEAD
Cognitive Task: Analyze the diff output.
- Type: Identify if it's a
feat(new feature),fix(bug fix),refactor,docs, etc. - Scope: What module/file is affected? (e.g.,
auth,api,readme) - Description: Summarize the change in imperative mood (e.g., "add login", not "added login").
4. Update Changelog
Use the helper script to append the change to CHANGELOG.md.
python3 skills/auto-committer/scripts/manage_changelog.py add --type <type> --message "<description>"
Note: Use the analyzed 'type' (e.g., 'feat') and 'description' from Step 3.
5. Git Commit
Stage all changes (including the updated CHANGELOG.md and docs) and commit.
git add .
git commit -m "<type>(<scope>): <description>"
Example: git commit -m "feat(auth): implement jwt token validation"
6. Verification
Show the commit log to the user.
git log -1 --stat
7. Optional Push
Ask the user: "Would you like me to push these changes to the remote repository?"
- If Yes: Run
git push. - If No: Stop here.
Error Handling
- If
git diffis empty butgit statusshows untracked files, rungit add -N .first to see the diff, or just inspect the untracked files. - If
CHANGELOG.mdscript fails, report the error and try to fix the file manually or ask user for guidance.
微信扫一扫