| name | smart-commit |
| description | This skill should be used when user asks to commit changes to git repository. Triggers on Ukrainian/English phrases like "закоміть зміни", "commit changes", "створи коміт", "зроби коміт", or any request to create git commits. Creates atomic commits with semantic file grouping using conventional commit format. |
Smart Commit
CRITICAL: Always use SubTask for file analysis to keep main context clean. NOT MAIN AGENT!
Overview
Intelligently analyze git changes by delegating file reading and diff analysis to subtasks using the Task tool, detect semantic relationships between changes, and create atomic commits that are independently functional.
Only ask for clarification when explicitly requested by the user.
Workflow
1. Get List of Changed Files
Run git commands to see what changed:
git status
git diff --name-only
git ls-files --others --exclude-standard
2. Analyze Changes Using Task Tool
CRITICAL: You MUST use the Task tool with subagent_type=general-purpose to analyze files in parallel subtasks.
For each changed file, launch a subtask using:
SubTask tool with:
- subagent_type: "general-purpose"
- description: "Analyze file diff"
- prompt: "Analyze git diff for [filename]. Extract:
1. Changed symbols (functions, classes, components, types)
2. Change type (feat, fix, refactor, test, docs)
3. Related files (imports, tests)
Return compact JSON: {symbols: [...], type: '...', related: [...]}"
Launch ALL file analysis tasks in PARALLEL (single message with multiple Task calls).
After all subtasks complete, collect results and group files by:
- Shared symbols: Files changing same functions/classes = one group
- Test + Implementation: Tests with code they test = one group
- Logical area: Fallback to directory-based grouping (first 2 path levels)
3. Security Check
NEVER commit sensitive files:
.envfiles (except.env.example)credentials.json,*.key,*.pem- Files with "secrets" or "private" in name
Flag these as "⚠️ SENSITIVE FILES - DO NOT COMMIT"
4. Group Files Intelligently
Based on subtask analysis results, group files:
- Find shared symbols: If files A and B both change function
extractKnowledge= same group - Match tests with code:
test_extractor.py+extractor.py= same group - Merge related areas: All
.artifacts/together, all.claude/skills/together, all.ziptogether - Keep atomic: Each group must be independently committable
5. Create Logical Commits
For each group of files (excluding sensitive):
Stage the group: git add [files from group]
Check diff: git diff --cached to understand changes
Create commit message:
- Format: {type}({scope}): {description}
- Types: feat, fix, refactor, perf, style, docs, test, chore, ci, revert
- Scopes: backend, frontend, bot, worker, nginx, db, docker, deps, config, ci
- Description: Clear, concise summary (50 chars max)
- Breaking changes: Add ! after scope, example: feat(api)!: redesign auth
- NO "Generated with Claude" footer
- NO Co-Authored-By lines
Commit: git commit -m "message"
6. Behavior
Default (no user clarification requested):
- Automatically group and commit without asking
- Use conventional commit format
- Create separate commits per logical group
When user requests clarification:
- Show proposed groups and commit messages
- Ask for approval before committing
- Allow user to adjust grouping
7. Intelligent Grouping Strategy
Semantic relationships (not hardcoded paths):
- Test + Implementation: Tests grouped with code they test (shared symbols)
- Related symbols: Files changing same functions/classes/components
- Logical area: Fallback grouping by directory context (first 2 levels)
- Sensitive files: Always detected and flagged separately
Detection methods:
- Diff analysis to extract changed symbols (functions, classes, exports)
- Keyword detection (fix, feat, refactor, perf, etc.) from changes
- File type semantics (test files, docs, config)
- Import/type relationship tracking
Example
User request: "commit changes"
Skill workflow:
- Get changed files list (git commands)
- Launch subtasks to analyze diffs for each file
- Collect symbol/keyword analysis from subtasks
- Group intelligently:
- Group 1:
backend/services/extractor.py+backend/tests/test_extractor.py(shared symbols) - Group 2:
frontend/components/TopicSelector.tsx+frontend/types/topic.ts(related changes) - Group 3: All
.artifacts/files (same category) - Group 4: All
.claude/skills/files (skills together) - Group 5:
docs/architecture/knowledge.md(standalone docs)
- Group 1:
- Create 5 atomic commits without asking
- Done
User request: "commit changes, ask me first"
Skill workflow:
- Analyze as above using subtasks
- Show proposed groups and commit messages
- Wait for user approval
- Create commits
Notes
- Keep commits atomic - each group should be independently reviewable
- No footers - only commit header line
- Follow existing commit style - check
git logfor project patterns - Don't ask by default - only when user explicitly requests clarification