| name | git |
| description | Check local changes, generate commit message and commit local changes, push commits to remote repo. |
Git Commit and Push Skill
You have permission to use git for committing and pushing to remote
repositories.
Trigger Conditions
Use this skill when explicitly asked to:
- "commit and push"
- "git commit"
- "push changes"
- "create a commit"
Pre-commit Checks
Before proceeding, ALWAYS:
- Run
git status to inspect the repository state
- Abort if NO changes are detected (no modified, added, or deleted files)
- Abort if there are uncommitted changes already staged (warn user first)
- Identify the current branch using
git branch --show-current
File Staging
Use git add . to stage all changes, OR:
- Use
git add <specific-files> if only certain files should be committed
- Review staged files with
git diff --cached before committing
Commit Message Generation
Generate commit messages following Conventional Commits format:
<type>(<scope>): <imperative-mood-summary>
Type Selection Rules
Scan changed files and determine type using this PRIORITY ORDER:
- fix - Bug fixes, error corrections, or issue references (highest
priority)
- feat - New features or functionality
- refactor - Code restructuring without behavior changes
- perf - Performance improvements
- style - Formatting, linting, missing semicolons (no logic changes)
- docs - Documentation, README, comments
- test - Test files only
- chore - Config, tooling, dependencies, CI/CD (lowest priority)
Scope Guidelines
- Use scope for: module names, package names, feature areas (e.g.,
auth,
api, cli)
- Omit scope when: changes span multiple areas or repo-wide
Summary Format
- Use imperative mood: "add" not "added" or "adds"
- Lowercase first letter
- No trailing period
- Keep under 50 characters when possible
Examples
feat(auth): add OAuth2 login support
fix(api): return 404 for missing resources
refactor(parser): extract validation logic
docs(readme): update installation instructions
chore(deps): bump lodash to 4.17.21
Commit Execution
- Generate the commit message based on rules above
- Run:
git commit -m "<message>"
- Verify commit succeeded by checking return code
Push Execution
After successful commit:
- Run:
git push
- If first-time push to new branch, use:
git push -u origin <branch-name>
- Handle authentication errors gracefully (prompt user for credentials if
needed)
Error Handling
- No changes: Abort with message "No changes to commit"
- Git errors: Report specific error message, do not retry blindly
- Push failures: Check for conflicts, suggest
git pull --rebase if
applicable
- Hook failures: Report pre-commit hook errors, do not bypass
(
--no-verify)
Safety Guidelines
- NEVER use
--force or --force-with-lease unless explicitly requested
- NEVER bypass hooks with
--no-verify unless explicitly requested
- ALWAYS confirm before pushing to shared/production branches
- Prefer descriptive commit messages over vague ones like "update" or "fix"