/commit Command
Create a well-crafted commit after running pro-workflow quality checks. The/commit command enforces quality gates, scans for issues, and drafts conventional commit messages.
Syntax
The 6-Step Process
Pre-Commit Checks
Review what’s being committed:Checks:
- Any unstaged changes to include?
- Any files that shouldn’t be committed (.env, credentials, large binaries)?
Quality Gates
Run lint, typecheck, and tests:Decision:
- All checks passing → Proceed
- Any failures → Fix before committing
- Skip only if user explicitly says to
Code Review
Scan staged changes for issues:Patterns to flag:
console.log/debuggerstatements- TODO/FIXME/HACK comments without tickets
- Hardcoded secrets or API keys
- Leftover test-only code
Commit Message
Draft a conventional commit message:Types: feat, fix, refactor, test, docs, chore, perf, ci, styleRules:
- Summary under 72 characters
- Body explains why, not what
- Reference issue numbers when applicable
- No generic messages (“fix bug”, “update code”)
Stage and Commit
Stage specific files and commit:Rules:
- Stage specific files, not
git add -A - Show the commit hash and summary after
Options
—no-verify
Skip quality gates (use sparingly):—amend
Amend the previous commit:- Fix typo in commit message
- Add forgotten file to last commit
- Squash fixup into last commit
- Only amend commits that haven’t been pushed
- Never amend commits on shared branches
—push
Push to remote after committing:Conventional Commit Format
Commit Types
| Type | When to Use | Example |
|---|---|---|
| feat | New feature or capability | feat(auth): add rate limiting to login |
| fix | Bug fix | fix(api): handle null user in session middleware |
| refactor | Code restructuring, no behavior change | refactor(db): extract connection pool logic |
| test | Adding or updating tests | test(auth): add tests for password reset flow |
| docs | Documentation changes | docs(api): update rate limit documentation |
| chore | Maintenance, deps, config | chore(deps): upgrade express to 4.18.2 |
| perf | Performance improvements | perf(query): add index on user_id column |
| ci | CI/CD pipeline changes | ci(github): add workflow for integration tests |
| style | Formatting, linting, whitespace | style(auth): fix eslint warnings |
Scope
The scope is optional but recommended:- Module names:
auth,api,frontend - File paths:
api/users,frontend/components - Features:
rate-limiting,caching,logging
Body
Explain why the change was made:Example Flow
Quality Gate Configuration
Quality gates are configurable inconfig.json:
Best Practices
Commit Often
Make small, focused commits. Easier to review, revert, and understand.
Run Gates Always
Only skip quality gates for emergency hotfixes. Gates prevent bugs from entering history.
Write Good Messages
Explain why the change was made. Future you will thank you.
Capture Learnings
After committing, run
/learn-rule if you learned something new.Troubleshooting
Quality gates keep failing
Quality gates keep failing
If quality gates consistently fail:
-
Run gates manually to see full output:
- Fix existing issues first before new changes
-
Adjust gate commands if needed:
-
Disable specific gates temporarily:
Commit message keeps getting rejected
Commit message keeps getting rejected
If commit messages don’t follow conventions:
-
Check the format:
- Use valid types: feat, fix, refactor, test, docs, chore, perf, ci, style
- Keep summary concise (no periods at the end)
- Add body for non-trivial changes
Code review flags false positives
Code review flags false positives
If code review incorrectly flags code:
-
Explain why the pattern is intentional:
-
Override the warning:
- Adjust scan patterns in hooks if needed
Related Commands
/develop
Multi-phase development with commit at the end
/wrap-up
Full session audit with commit check
/learn-rule
Capture learnings after committing
Smart Commit Skill
Deep dive on smart commit patterns
Next Steps
- Configure Quality Gates
- Learn Conventional Commits
- Set up Git Hooks