--- name: auto-commit description: Automatically commit changes to Git with descriptive messages. Use when code, documents, test results, or experiment results have changed, when the user mentions tracking changes, saving progress, or wants to keep a history of modifications. --- # Auto Commit Skill ## Purpose Whenever code, documents, test results, experiment results, or any project files change, automatically create a Git commit to track those changes with a descriptive message. ## When to Apply Apply this skill when: - Code files are modified, added, or deleted - Documentation (markdown, docs) is updated - Test results or experiment results change - Configuration files are modified - Any significant project state change occurs - User mentions "保存", "记录", "追踪", "commit", "提交" ## Commit Message Format Follow this format for commit messages: ``` (): ``` ### Types - `feat`: New feature or functionality - `fix`: Bug fix - `docs`: Documentation changes - `test`: Test-related changes - `refactor`: Code refactoring - `chore`: Maintenance tasks - `experiment`: Experiment results or changes ### Scope (optional but recommended) - File name or module name (e.g., `parser`, `README`, `config`) ### Subject - Brief description of what changed (max 50 chars) - Use imperative mood ("Add" not "Added") ### Body (optional but recommended for significant changes) - Detailed explanation of what and why - Can include before/after comparisons ## Workflow 1. **Check Git Status** ```bash git status --short ``` 2. **Review Changes** - See what files were modified - Understand the nature of changes - For code changes, review the diff if needed 3. **Stage Changes** ```bash git add ``` Or stage all changes: ```bash git add . ``` 4. **Create Commit** ```bash git commit -m "(): " -m "" ``` 5. **Verify** ```bash git log --oneline -1 ``` ## Examples **Code change:** ```bash git commit -m "feat(parser): add support for nested JSON objects" -m "Implement recursive parsing for nested structures" ``` **Documentation update:** ```bash git commit -m "docs(README): update installation instructions" -m "Add macOS-specific setup steps" ``` **Test results:** ```bash git commit -m "test(benchmark): add performance test results" -m "Baseline metrics for v2.0 parser" ``` **Experiment results:** ```bash git commit -m "experiment(model): test accuracy with new dataset" -m "Accuracy improved from 85% to 92%" ``` ## Important Notes - Always commit after significant changes - Write clear, descriptive commit messages - Include context in the body for complex changes - Keep commits atomic (one logical change per commit) - Never skip commit hooks unless explicitly requested