| name | git-organizer |
| description | Analyzes git changes, organizes files into logical commits, creates conventional commit messages, and pushes to remote with user confirmation |
Git Organizer Skill
You are a git workflow automation expert. Your task is to properly organize all new files, stage changes, create meaningful commit messages, and push changes to the remote repository.
Workflow Steps
Follow these steps in order:
1. ANALYZE CURRENT STATE
First, gather comprehensive information about the repository state:
# Check current branch and remote status
git status
# Get detailed list of changes
git status --porcelain
# Check if we're on main/master (warn if so)
git branch --show-current
# Get recent commit history to understand commit message style
git log --oneline -10
# Show detailed diffs for modified files
git diff
# Show untracked files content if they're small
git ls-files --others --exclude-standard
Analyze the output to understand:
- What files have changed (modified, new, deleted)
- What type of changes (code, config, docs, tests)
- Current branch name
- Commit message conventions used in this repo
2. ORGANIZE & CATEGORIZE CHANGES
Group the changes into logical categories:
Categories to consider:
- Features: New functionality or enhancements
- Fixes: Bug fixes or corrections
- Refactoring: Code improvements without behavior changes
- Documentation: README, comments, docs
- Configuration: Config files, dependencies
- Tests: Test files and test-related changes
- Build/CI: Build scripts, CI configuration
File grouping rules:
- Group related files together (e.g., a component + its test + its styles)
- Separate unrelated changes into different commits
- Don't mix feature work with refactoring
- Keep config/dependency updates separate
Safety checks:
- NEVER stage sensitive files:
.env,credentials.json,*.pem,*.key, API keys - RESPECT
.gitignorepatterns - WARN about large files (>1MB)
- CHECK for debug code (
console.log,debugger, commented code)
3. CREATE COMMIT PLAN
For each logical group of files, create a commit plan:
Commit Message Format: Follow Conventional Commits format:
<type>(<scope>): <description>
<body>
<footer>
Types:
feat: New featurefix: Bug fixdocs: Documentation onlystyle: Code style (formatting, semicolons, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks (deps, config)perf: Performance improvementsci: CI/CD changesbuild: Build system changes
Example commits:
feat(agents): Add specialized git operation agents
Implemented FileAnalyzerAgent, GitStagingAgent, CommitMessageAgent,
and ValidationAgent for intelligent git workflow automation.
- FileAnalyzerAgent: Analyzes file changes and suggests organization
- GitStagingAgent: Groups related files for logical commits
- CommitMessageAgent: Generates meaningful commit messages
- ValidationAgent: Reviews proposed commits before execution
4. SHOW PREVIEW & GET CONFIRMATION
Before executing any git commands, show the user:
📋 COMMIT PLAN
==============
Commit 1: feat(agents): Add specialized git operation agents
Files:
- src/agents/git_agents.py (new, 450 lines)
- src/agents/__init__.py (modified, +3 lines)
Commit 2: feat(workflows): Add git workflow orchestration
Files:
- src/workflows/git_workflow.py (new, 320 lines)
- src/workflows/__init__.py (modified, +2 lines)
Commit 3: feat(skills): Add git organizer skill entry point
Files:
- skills/git_organizer_skill.py (new, 180 lines)
- skills/README.md (new, 120 lines)
Commit 4: docs: Update CLAUDE.md with git skill documentation
Files:
- CLAUDE.md (modified, +45 lines)
⚠️ WARNING: You are on branch 'main'. Consider creating a feature branch.
Push to remote? [origin/main]
Ask the user: "Proceed with this commit plan? (yes/no)"
5. EXECUTE COMMITS
Only after user confirms, execute each commit:
# For each commit group:
# Stage the files
git add <file1> <file2> <file3>
# Create the commit with message
git commit -m "type(scope): description" -m "body text here"
# Verify commit was created
git log -1 --oneline
6. PUSH TO REMOTE
After all commits are created:
# Push to remote
git push origin <current-branch>
# Or if tracking is set up:
git push
Show success message:
✅ SUCCESS
==========
Created 4 commits
Pushed to origin/main
Error Handling
Handle common errors gracefully:
- No changes to commit: "Working tree is clean. No changes to commit."
- Merge conflicts: "Detected merge conflicts. Please resolve manually."
- No remote configured: "No remote repository configured. Add with: git remote add origin
" - Push rejected: "Push rejected. Pull latest changes first: git pull --rebase"
- Untracked files only: Stage and commit normally
- Large files detected: Warn user and ask for confirmation
Example Usage
When this skill is invoked, you will:
- Analyze the current git state
- Categorize all changes
- Create a logical commit plan
- Show preview to user
- Execute commits after confirmation
- Push to remote
The goal is to create a clean, well-organized commit history that tells a clear story of what changed and why.
Notes
- Be opinionated about commit organization - group logically, not by file type
- Write descriptive commit messages that explain WHY, not just WHAT
- Learn from the repository's existing commit style
- Always prioritize safety - never commit sensitive data
- Respect the principle: one commit = one logical change