Run quality gates, review staged changes for issues, and create a well-crafted conventional commit. Use when saying "commit", "git commit", "save my changes", or ready to commit after making changes.
git clone https://github.com/rohitg00/pro-workflow.git--- name: smart-commit description: Run quality gates, review staged changes for issues, and create a well-crafted conventional commit. Use when saying "commit", "git commit", "save my changes", or ready to commit after making changes. user-invocable: true --- # Smart Commit ## Trigger Use when saying "commit", "save changes", or ready to commit after making changes. ## Workflow 1. Check current state and identify what to commit. 2. Run quality gates (lint, typecheck, tests on affected files). 3. Scan staged changes for issues. 4. Draft a conventional commit message from the diff. 5. Stage specific files, create the commit. 6. Prompt for learnings from this change. ## Commands ```bash git status git diff --stat npm run lint 2>&1 | tail -5 npm run typecheck 2>&1 | tail -5 npm test -- --changed --passWithNoTests 2>&1 | tail -10 git add <specific files> git commit -m "<type>(<scope>): <summary>" ``` ## Code Review Scan Before committing, check staged changes in **production code** (not test files) for: - `console.log` / `debugger` statements (suppressed in test files — see Review Suppressions) - TODO/FIXME/HACK comments without ticket references (e.g., `TODO(JIRA-123)` is fine) - Hardcoded secrets or API keys - Leftover test-only code Flag any issues before proceeding. ## Commit Message Format ``` <type>(<scope>): <short summary> <body - what changed and why> ``` **Types:** feat, fix, refactor, test, docs, chore, perf, ci, style ## Guardrails - Never skip quality gates unless user explicitly says to. - Stage specific files by name. Never `git add -A` or `git add .`. - Summary under 72 characters. Body explains *why*, not *what*. - No generic messages ("fix bug", "update code"). - Reference issue numbers when applicable. ## Output - Quality gate results (pass/fail) - Issues found in staged changes - Suggested commit message - Commit hash after committing - Prompt: any learnings to capture? ## Review Suppressions Do NOT flag these during the pre-commit scan. They add noise without catching real bugs: - Threshold, config value, or feature flag changes (limits, timeouts, retry counts) - Import reordering that does not change runtime behavior - Whitespace-only or formatting-only changes - Adding or removing `console.log` in test files - TODO/FIXME comments (tracked separately in issue trackers) - Variable or parameter renames that do not change behavior
1. **Stage your changes** in Git (e.g., `git add .`). Then run this skill by pasting the prompt template with your repository details. 2. **Review the output** for issues, suggestions, and the proposed commit message. Use `git status` to verify staged changes if unsure. 3. **Address critical issues** (e.g., security, linting) before committing. For example, run `npm run lint -- --fix` or update environment variables. 4. **Customize the commit message** if needed, then commit using the suggested format (e.g., `git commit -m "feat: add user auth"`). 5. **Optional:** Use tools like `commitlint` or Git hooks to enforce conventional commits in your workflow. Tip: Save the prompt template as a snippet in your IDE for quick access.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/rohitg00/pro-workflow/tree/main/skills/smart-commitCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Review the staged changes in [REPOSITORY_PATH] for potential issues like syntax errors, security vulnerabilities, or linting problems. Then, generate a conventional commit message following the [COMMIT_MESSAGE_FORMAT] convention (e.g., 'feat: add user authentication'). Include a brief description of the changes and any breaking changes. Suggest improvements if the changes are not ready to commit. Repository: [GIT_REPO_URL]
### Commit Review Summary **Repository:** `acme-corp/employee-portal` **Branch:** `feature/user-auth` **Staged Changes:** 12 files modified (800+ lines) #### Issues Detected: 1. **Security:** Hardcoded API key in `src/config.js` (line 42). Risk: High. Suggest using environment variables. 2. **Linting:** 14 ESLint errors (e.g., unused variables in `src/utils/validation.js`). 3. **Breaking Change:** Modified `User` model schema in `models/User.js` without updating database migrations. #### Suggested Commit Message: ``` feat: add user authentication with JWT - Implement JWT-based auth for login/logout - Add middleware for token validation - Update User model to include `lastLogin` field BREAKING CHANGE: Existing sessions will be invalidated on deploy. ``` #### Recommended Next Steps: 1. Replace hardcoded API key with `process.env.API_KEY`. 2. Fix ESLint errors by running `npm run lint -- --fix`. 3. Generate a new migration for the `lastLogin` field: `npx sequelize-cli migration:generate --name add-lastLogin-to-User`. Would you like me to generate a corrected commit message after addressing these issues?
skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan