Smart Commit with Quality Gates
You are helping the user create a well-formatted commit with pre-commit validation.
Workflow
Check Staged Changes
git status
git diff --cached --stat
- Show what files are staged
- If nothing staged, ask user what to add
Pre-Commit Quality Checks
Run local quality gates before committing:
Python syntax (if .py files changed):
flake8 skill/ --count --select=E9,F63,F7,F82 --show-source
Bash syntax (if .sh files changed):
bash -n install.sh
bash -n hooks/pre-commit.sh
Secret scan:
git diff --cached | grep -iE "(api_key|api_secret|password|token|AWS_ACCESS)" || echo "No secrets detected"
Generate Conventional Commit Message
Ask user about the change:
- Type: feat, fix, docs, style, refactor, perf, test, build, ci, chore
- Scope: installer, skill, command, agent, docs, ci, workflows
- Description: what changed (imperative mood)
- Why: reason for change (optional body)
- Issue: related issue number
Format:
<type>(<scope>): <description>
[optional body explaining why]
[optional footer: Closes #123]
Validate Message Format
- Check format matches Conventional Commits
- Ensure subject is imperative mood ("add" not "added")
- Verify no period at end
- Check length < 50 characters for subject
Create Commit
git commit -m "<generated message>"
Post-Commit Actions
- Show commit hash
- Show commit in log
- Ask if user wants to push
Examples
Feature commit:
git commit -m "feat(installer): add Windows PowerShell support
Adds install.ps1 script with equivalent functionality to
install.sh for Windows users.
Closes #42"
Fix commit:
git commit -m "fix(skill): correct Python syntax validation
Fix flake8 configuration to properly detect syntax errors.
Previous config was too permissive.
Fixes #156"
Docs commit:
git commit -m "docs: update GitHub workflows documentation
Add troubleshooting section and configuration examples."
Quality Gates
Before committing, ensure:
- ✅ No syntax errors
- ✅ No hardcoded secrets
- ✅ Conventional Commits format
- ✅ Related issue linked (for feat/fix)
- ✅ Files staged are relevant to commit message
Interactive Flow
- Show staged changes
- Run quality checks
- Ask for commit details (type, scope, description)
- Generate commit message
- Show preview
- Confirm with user
- Execute commit
- Display result
Use clear prompts and provide the exact commands for the user to run.
1---2name: smart-commit-with-quality-gates3description: You are helping the user create a well-formatted commit with pre-commit validation.4---56# Smart Commit with Quality Gates78You are helping the user create a well-formatted commit with pre-commit validation.910## Workflow11121. **Check Staged Changes**13 ```bash14 git status15 git diff --cached --stat16 ```17 - Show what files are staged18 - If nothing staged, ask user what to add19202. **Pre-Commit Quality Checks**2122 Run local quality gates before committing:2324 **Python syntax** (if .py files changed):25 ```bash26 flake8 skill/ --count --select=E9,F63,F7,F82 --show-source27 ```2829 **Bash syntax** (if .sh files changed):30 ```bash31 bash -n install.sh32 bash -n hooks/pre-commit.sh33 ```3435 **Secret scan**:36 ```bash37 git diff --cached | grep -iE "(api_key|api_secret|password|token|AWS_ACCESS)" || echo "No secrets detected"38 ```39403. **Generate Conventional Commit Message**4142 Ask user about the change:43 - Type: feat, fix, docs, style, refactor, perf, test, build, ci, chore44 - Scope: installer, skill, command, agent, docs, ci, workflows45 - Description: what changed (imperative mood)46 - Why: reason for change (optional body)47 - Issue: related issue number4849 **Format:**50 ```51 <type>(<scope>): <description>5253 [optional body explaining why]5455 [optional footer: Closes #123]56 ```57584. **Validate Message Format**59 - Check format matches Conventional Commits60 - Ensure subject is imperative mood ("add" not "added")61 - Verify no period at end62 - Check length < 50 characters for subject63645. **Create Commit**65 ```bash66 git commit -m "<generated message>"67 ```68696. **Post-Commit Actions**70 - Show commit hash71 - Show commit in log72 - Ask if user wants to push7374## Examples7576**Feature commit:**77```bash78git commit -m "feat(installer): add Windows PowerShell support7980Adds install.ps1 script with equivalent functionality to81install.sh for Windows users.8283Closes #42"84```8586**Fix commit:**87```bash88git commit -m "fix(skill): correct Python syntax validation8990Fix flake8 configuration to properly detect syntax errors.91Previous config was too permissive.9293Fixes #156"94```9596**Docs commit:**97```bash98git commit -m "docs: update GitHub workflows documentation99100Add troubleshooting section and configuration examples."101```102103## Quality Gates104105Before committing, ensure:106- ✅ No syntax errors107- ✅ No hardcoded secrets108- ✅ Conventional Commits format109- ✅ Related issue linked (for feat/fix)110- ✅ Files staged are relevant to commit message111112## Interactive Flow1131141. Show staged changes1152. Run quality checks1163. Ask for commit details (type, scope, description)1174. Generate commit message1185. Show preview1196. Confirm with user1207. Execute commit1218. Display result122123Use clear prompts and provide the exact commands for the user to run.