
gitcommitsmart
by chrislyons
SKILL.md
name: git.commit.smart description: Intelligently create git commits with proper formatting, conventional commit style, and Carbon ACX footer conventions.
git.commit.smart
Purpose
This skill automates the creation of high-quality git commits for Carbon ACX by:
- Analyzing staged changes to understand what changed and why
- Drafting commit messages following conventional commit format
- Matching existing repository commit style
- Including standardized Claude Code footer
- Handling pre-commit hook failures gracefully
- Ensuring no secrets or credentials are committed
When to Use
Trigger Patterns:
- "Create a commit"
- "Commit these changes"
- "Make a commit with..."
- User has staged changes and needs to commit
- After completing a task that modified files
Do NOT Use When:
- No changes are staged (
git statusshows clean) - User wants to review changes first (show diff instead)
- Creating a pull request (use
git.pr.createskill instead) - Amending existing commits (different workflow)
Allowed Tools
bash- Run git commands (status, diff, log, add, commit)read_file- Read modified files for contextgrep- Search for patterns in changes
Access Level: 2 (File Modification - can create commits)
Tool Rationale:
bash: Required for all git operationsread_file: Helps understand changes for better commit messagesgrep: Search commit history for style patterns
Explicitly Denied:
- No
--no-verifyflag (never skip hooks) - No force operations
- No git config modifications
- No committing files in
.gitignorepatterns
Expected I/O
Input:
- Type: Commit request (implicit or explicit)
- Context: Staged files ready to commit
- Optional: User-provided commit message hint or scope
Example:
"Commit the UX improvements to the dashboard"
"Create a commit for these changes"
"Commit with message: fix typo in README"
Output:
- Type: Git commit successfully created
- Format: Commit hash + message summary
- Includes:
- Files committed (summary)
- Commit message used
- Commit hash
- Next steps suggestion (push, create PR, run tests)
Validation:
- Commit message follows conventional format
- No secrets detected in changes
- Pre-commit hooks passed (or handled)
- Commit footer includes Claude Code attribution
Dependencies
Required:
- Git repository (
.gitdirectory exists) - Git configured with user.name and user.email
- Changes staged for commit (
git addalready run)
Optional:
- Pre-commit hooks installed
ghCLI for GitHub integration (for suggesting PR creation)
Workflow
Step 1: Gather Context
Run in parallel:
git status
git diff --staged
git log --oneline -10
Analysis:
- What files are staged?
- What type of changes (features, fixes, docs, chores)?
- What's the commit message style in recent history?
Step 2: Draft Commit Message
Format:
<type>(<scope>): <subject>
<body>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
Conventional Commit Types:
feat- New featurefix- Bug fixchore- Maintenance, dependencies, toolingdocs- Documentation onlyrefactor- Code restructuring without behavior changetest- Adding or updating testsstyle- Formatting, whitespace, missing semicolonsperf- Performance improvements
Scope Examples:
web- Modern web app (apps/carbon-acx-web)site- Static React sitecalc- Derivation enginedata- CSV data filesworkers- Cloudflare Workersci- CI/CD workflows
Subject Line:
- Max 72 characters
- Imperative mood ("add feature" not "added feature")
- No period at end
- Lowercase after colon
Body:
- Explain WHY, not WHAT (what is in the diff)
- Wrap at 100 characters
- Use bullet points for multiple reasons
- Reference issues:
Closes #123,Relates to #456
Step 3: Create Commit
Use HEREDOC for message:
git commit -m "$(cat <<'EOF'
feat(web): add dark mode toggle to dashboard
Users requested ability to switch between light and dark themes
for extended analysis sessions. This adds a theme toggle in the
header that persists preference to localStorage.
Closes #42
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"
Step 4: Handle Pre-commit Hooks
If hook fails:
- Read hook output
- Determine failure type:
- Linter errors: Fix automatically if possible, re-commit
- Formatter changes: Files were modified by hook
- Test failures: Report to user, cannot auto-fix
If hook modified files:
# Check if safe to amend
git log -1 --format='%an %ae' # Verify we're the author
git status # Verify not pushed yet
# If both checks pass:
git add .
git commit --amend --no-edit
If unsafe to amend:
- Create NEW commit with hook fixes (never amend other developers' work)
Step 5: Confirm Success
git log -1 --oneline
git status
Report to user:
- ✅ Commit created:
abc1234 feat(web): add dark mode toggle - Files committed: 3 files changed, 127 insertions(+), 45 deletions(-)
- Next steps: Run tests, push to remote, or create PR?
Examples
Example 1: Feature Commit
User: "Commit the new emission chart component"
Claude Process:
- Run
git status,git diff --staged,git log -10 - Analyze changes: New React component in
apps/carbon-acx-web/src/components/ - Draft message:
feat(web): add EmissionChart component for layer visualization Creates reusable chart component using Recharts to display emission data by layer. Includes responsive design, hover tooltips, and accessibility labels. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> - Execute commit
- Report success with hash
Example 2: Fix Commit
User: "Commit the bug fix"
Claude Process:
- Analyze staged changes: Fix in
calc/derive.pyline 245 - Read recent commits for style
- Draft message:
fix(calc): correct emission factor calculation for aviation layer Previous calculation was using wrong unit conversion factor (kg instead of tCO2e). This fixes the multiplier to match the emission_factors.csv schema. Fixes #128 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> - Execute commit
- Suggest running
pytest tests/to verify fix
Example 3: Chore Commit with Pre-commit Hook
User: "Commit the dependency updates"
Claude Process:
- Analyze:
package.jsonandpnpm-lock.yamlmodified - Draft message:
chore(deps): update React and TypeScript dependencies - React 18.2.0 → 18.3.1 (security patch) - TypeScript 5.5.3 → 5.5.4 (bug fixes) All tests pass with updated versions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> - Execute
git commit - Pre-commit hook runs and fails: ESLint finds unused imports
- Read hook output, identify issue
- Run
pnpm run lint --fixto auto-fix - Check authorship: matches current user ✅
- Check pushed: branch is ahead, not pushed ✅
- Amend commit:
git add . git commit --amend --no-edit - Report: "Commit created (with pre-commit lint fixes applied)"
Example 4: Documentation Commit
User: "Commit the README updates"
Claude Process:
- Analyze: Only
README.mdchanged - Draft message:
docs: update installation instructions for pnpm workspaces Clarifies the difference between running commands from repo root vs within app directory. Adds troubleshooting section for common pnpm workspace issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> - Execute commit
- Suggest: "Documentation updated. Ready to push or create PR?"
Example 5: Multi-file Refactor
User: "Commit these refactoring changes"
Claude Process:
- Analyze: 8 files changed across
apps/carbon-acx-web/src/ - Identify pattern: Moving components to new directory structure
- Draft message:
refactor(web): reorganize components into feature-based folders Restructures components from flat directory to feature-based organization: - charts/ - All visualization components - forms/ - Activity and data entry forms - layout/ - Headers, footers, navigation No functional changes, only file moves and import updates. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> - Execute commit
- Suggest: "Run
pnpm testto verify imports still resolve correctly"
Limitations
Scope Limitations:
- Cannot commit unstaged changes (user must
git addfirst) - Cannot resolve merge conflicts (different skill)
- Cannot amend commits by other authors (safety constraint)
- Cannot skip pre-commit hooks without user approval
Known Edge Cases:
- Empty commits (no changes staged) → Report error, suggest
git add - Detached HEAD state → Warn user, suggest checking out branch
- Merge in progress → Warn, suggest completing or aborting merge first
- Untracked files only → Remind to
git addfiles first
Performance Constraints:
- Very large diffs (1000+ files) may take 10-20 seconds to analyze
- Binary files can't be analyzed for context (rely on filenames)
Security Boundaries:
- Scans for common secret patterns (.env, credentials, API keys)
- Rejects commits with potential secrets (warns user)
- Cannot detect all possible credential formats
- User must manually review sensitive changes
Validation Criteria
Success Metrics:
- ✅ Commit message follows conventional commit format
- ✅ Commit includes Claude Code footer
- ✅ Type and scope appropriate for changes
- ✅ Subject line ≤72 characters
- ✅ Body explains WHY (not just WHAT)
- ✅ No secrets detected in commit
- ✅ Pre-commit hooks passed or handled
- ✅ User informed of success and next steps
Failure Modes:
- ❌ No staged changes → Ask user to
git addfiles - ❌ Secret detected → Reject commit, warn user
- ❌ Pre-commit hook failed → Report error, suggest fixes
- ❌ Commit type unclear → Ask user for clarification
- ❌ Git not configured → Report error, suggest
git config
Recovery:
- If uncertain about commit type: Ask user
- If hook fails repeatedly: Show error, ask user to investigate
- If secret detected: Explain pattern matched, ask user to confirm false positive
- If commit message unclear: Draft and ask user to review before committing
Related Skills
Composes With:
git.pr.create- After committing, create pull requestgit.branch.manage- Create branch before committingschema.linter- Validate data files before committing changes
Dependencies:
- None - foundational skill
Alternative Skills:
- For PRs:
git.pr.create - For releases:
git.release.prep
Maintenance
Owner: Workspace Team (shared skill) Review Cycle: Monthly Last Updated: 2025-10-24 Version: 1.0.0
Maintenance Notes:
- Update conventional commit types if Carbon ACX adds new categories
- Adjust secret detection patterns as new credential types emerge
- Review pre-commit hook handling as repo hooks evolve
- Keep commit message examples synchronized with actual repo style
Score
Total Score
Based on repository quality metrics
SKILL.mdファイルが含まれている
ライセンスが設定されている
100文字以上の説明がある
GitHub Stars 100以上
3ヶ月以内に更新がある
10回以上フォークされている
オープンIssueが50未満
プログラミング言語が設定されている
1つ以上のタグが設定されている
Reviews
Reviews coming soon