---
name: git-smart-commit
description: Automate stage, commit, and push with intelligent conventional commit messages
version: 1.0.0
author: mhattingpete (adapted)
platforms: [claude-code, cursor]
license: MIT
source: https://github.com/mhattingpete/claude-skills-marketplace
---

# Git Smart Commit & Push

Automate the git workflow with intelligent commit message generation.

## Activation Phrases
Triggers on: "push this", "commit and push", "save to github", "push my changes", "commit changes"

## Workflow

### Step 1: Analyze Changes
```bash
git status
git diff --staged
git diff
```

Understand:
- What files changed
- What type of change (feature, fix, refactor, docs, etc.)
- Breaking changes or not

### Step 2: Stage Files
```bash
# Stage all tracked files
git add -u

# Or stage specific files
git add src/feature.py tests/test_feature.py
```

### Step 3: Generate Commit Message
Follow Conventional Commits spec:
```
<type>(<scope>): <short description>

[optional body]

[optional footer]
Co-Authored-By: Claude <claude@anthropic.com>
```

**Types:**
- `feat`: new feature
- `fix`: bug fix
- `refactor`: code restructuring
- `docs`: documentation only
- `test`: adding or updating tests
- `chore`: build, CI, dependencies
- `perf`: performance improvement
- `style`: formatting, no logic change

### Step 4: Commit
```bash
git commit -m "feat(auth): add JWT refresh token rotation

Implements sliding window refresh tokens to improve security.
Tokens are now rotated on each use with 7-day expiry.

Closes #123"
```

### Step 5: Push
```bash
git push origin HEAD
# Or if new branch:
git push -u origin HEAD
```

## Safety Checks
Before pushing:
- [ ] No `.env` or secrets in staged files
- [ ] Tests pass (run `pytest` or equivalent)
- [ ] Branch name matches convention (`feature/`, `fix/`, `chore/`)
- [ ] Not pushing directly to `main` unless intended