From git
Creates Git Flow hotfix branch from main for emergency production fixes. Validates name and clean state, pulls latest main, sets remote tracking, pushes branch, suggests patch version bump.
How this command is triggered — by the user, by Claude, or both
Slash command
/git:hotfix <hotfix-name>Files this command reads when invoked
This command is limited to the following tools:
The summary Claude sees in its command listing — used to decide when to auto-load this command
# Git Flow Hotfix Branch Create emergency hotfix branch: **$ARGUMENTS** ## Current Repository State - Current branch: !`git branch --show-current` - Git status: !`git status --porcelain` - Latest production tag: !`git describe --tags --abbrev=0 origin/main 2>/dev/null || echo "No tags on main"` - Main branch status: !`git log main..origin/main --oneline 2>/dev/null | head -3 || echo "No remote tracking for main"` - Commits on main since last tag: !`git log $(git describe --tags --abbrev=0 origin/main 2>/dev/null)..origin/main --oneline 2>/dev/null | wc -l | tr -d ' '` ## Task Create a ...
Create emergency hotfix branch: $ARGUMENTS
git branch --show-currentgit status --porcelaingit describe --tags --abbrev=0 origin/main 2>/dev/null || echo "No tags on main"git log main..origin/main --oneline 2>/dev/null | head -3 || echo "No remote tracking for main"git log $(git describe --tags --abbrev=0 origin/main 2>/dev/null)..origin/main --oneline 2>/dev/null | wc -l | tr -d ' 'Create a Git Flow hotfix branch for emergency production fixes:
Critical Checks:
$ARGUMENTS is provided and descriptive
critical-security-patch, payment-gateway-fix, auth-bypass-fixfix, hotfix1, bugmain branch is present⚠️ IMPORTANT: Hotfix Usage Guidelines
Hotfixes are ONLY for:
NOT for:
# Switch to main branch
git checkout main
# Pull latest production code
git pull origin main
# Create hotfix branch from main
git checkout -b hotfix/$ARGUMENTS
# Set up remote tracking
git push -u origin hotfix/$ARGUMENTS
Analyze the latest tag to suggest hotfix version:
Current production version: v1.2.0
Hotfix version: v1.2.1
Version bump: PATCH (third number incremented)
Hotfix Version Rules:
✓ Switched to main branch
✓ Pulled latest production code from origin/main
✓ Created branch: hotfix/$ARGUMENTS
✓ Set up remote tracking: origin/hotfix/$ARGUMENTS
✓ Pushed branch to remote
🔥 Hotfix Branch Ready: hotfix/$ARGUMENTS
Branch: hotfix/$ARGUMENTS
Base: main (production)
Will merge to: main AND develop
Suggested version: v1.2.1
⚠️ CRITICAL HOTFIX WORKFLOW
This is an EMERGENCY production fix. Follow these steps:
1. 🔍 Identify the Issue
- Reproduce the bug
- Understand the root cause
- Document the impact
2. 🛠️ Implement the Fix
- Make MINIMAL changes
- Focus ONLY on the critical issue
- Avoid refactoring or improvements
- Add tests to prevent regression
3. 🧪 Test Thoroughly
- Test the specific fix
- Run full regression tests
- Test on production-like environment
- Verify no side effects
4. 📝 Document the Fix
- Update version in package.json
- Add entry to CHANGELOG.md
- Document the bug and fix
- Include reproduction steps
5. 🚀 Deploy Process
- Create PR to main
- Get expedited review
- Run /finish to merge and tag
- Deploy to production immediately
- Monitor for issues
🎯 Next Steps:
1. Fix the critical issue (MINIMAL changes only)
2. Test thoroughly: npm test
3. Update version: v1.2.1
4. Create emergency PR: gh pr create --label "hotfix,critical"
5. Get fast-track approval
6. Run /finish to merge to main AND develop
7. Deploy to production
8. Monitor systems closely
⚠️ Remember:
- Hotfix will be merged to BOTH main and develop
- Tag v1.2.1 will be created on main
- Production deployment should happen immediately
- Team should be notified of the hotfix
No Hotfix Name Provided:
❌ Hotfix name is required
Usage: /hotfix <hotfix-name>
Examples:
/hotfix critical-security-patch
/hotfix payment-processing-failure
/hotfix auth-bypass-vulnerability
⚠️ IMPORTANT: Hotfixes are for CRITICAL production issues only!
For non-critical fixes, use:
/feature <name> - Regular bug fixes
Invalid Hotfix Name:
❌ Invalid hotfix name: "fix"
Hotfix names should be:
- Descriptive of the issue
- Use kebab-case format
- Indicate severity/urgency
Examples:
✅ critical-security-patch
✅ payment-gateway-timeout
✅ user-data-corruption-fix
❌ fix
❌ bug1
❌ hotfix
Uncommitted Changes:
⚠️ Uncommitted changes detected in working directory:
M src/file.js
A test.js
Hotfixes require a clean working directory.
Options:
1. Commit your changes first
2. Stash them: git stash
3. Discard them: git checkout .
⚠️ This is an emergency hotfix. Please clean your working directory.
Main Branch Behind Remote:
⚠️ Local main is behind origin/main by 2 commits
✓ Pulling latest production code...
✓ Fetched 2 commits
✓ Main is now synchronized with production
✓ Ready to create hotfix branch
Not a Critical Issue:
⚠️ Hotfix Confirmation Required
Is this a CRITICAL production issue that requires immediate attention?
Critical issues include:
- Security vulnerabilities
- Production system failures
- Data loss or corruption
- Payment/transaction failures
If this is NOT critical, consider:
- Creating a feature branch instead
- Waiting for the next release cycle
- Using regular bug fix workflow
Proceed with hotfix? [y/N]
🔥 Emergency Hotfix Checklist
Issue Identification:
- [ ] Bug is confirmed and reproducible
- [ ] Root cause is identified
- [ ] Impact is documented
- [ ] Stakeholders are notified
Development:
- [ ] Fix is minimal and focused
- [ ] No unnecessary changes included
- [ ] Tests added to prevent regression
- [ ] Code reviewed (if time permits)
Testing:
- [ ] Fix verified in local environment
- [ ] Unit tests passing
- [ ] Integration tests passing
- [ ] Tested on production-like environment
- [ ] No side effects detected
Documentation:
- [ ] CHANGELOG.md updated
- [ ] Version bumped (PATCH)
- [ ] Bug description documented
- [ ] Fix explanation documented
- [ ] Deployment notes prepared
Deployment:
- [ ] PR created with "hotfix" and "critical" labels
- [ ] Fast-track approval obtained
- [ ] Production deployment plan ready
- [ ] Rollback plan documented
- [ ] Monitoring alerts configured
- [ ] Team notified of deployment
Post-Deployment:
- [ ] Fix verified in production
- [ ] Systems monitored for issues
- [ ] Metrics show improvement
- [ ] Hotfix merged back to develop
- [ ] Post-mortem scheduled (if needed)
After implementing the fix, update the version:
# Update package.json version (PATCH bump)
npm version patch --no-git-tag-version
# Update CHANGELOG.md
cat >> CHANGELOG.md << EOF
## [v1.2.1] - $(date +%Y-%m-%d) - HOTFIX
### 🔥 Critical Fixes
- Fix $ARGUMENTS: [brief description]
- Root cause: [explanation]
- Impact: [who/what was affected]
- Resolution: [what was fixed]
EOF
# Commit version bump
git add package.json CHANGELOG.md
git commit -m "chore(hotfix): bump version to v1.2.1
Critical fix for $ARGUMENTS
🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>"
gh pr create \
--title "🔥 HOTFIX v1.2.1: $ARGUMENTS" \
--body "$(cat <<'EOF'
## 🔥 Emergency Hotfix
**Severity**: Critical
**Version**: v1.2.1
**Issue**: $ARGUMENTS
## Problem Description
[Detailed description of the production issue]
## Root Cause
[Explanation of what caused the issue]
## Fix Implementation
[Description of the fix applied]
## Testing
- [x] Issue reproduced locally
- [x] Fix verified locally
- [x] Unit tests passing
- [x] Integration tests passing
- [x] Tested on staging environment
## Deployment Plan
1. Merge to main
2. Tag as v1.2.1
3. Deploy to production immediately
4. Monitor for 30 minutes
5. Merge back to develop
## Rollback Plan
[How to rollback if issues occur]
## Monitoring
[What to monitor post-deployment]
---
**⚠️ This is a critical production hotfix requiring immediate deployment**
🤖 Generated with Claude Code
EOF
)" \
--base main \
--head hotfix/$ARGUMENTS \
--label "hotfix,critical,priority-high" \
--assignee @me \
--reviewer team-leads
Hotfix Workflow in Git Flow:
main (v1.2.0) ──────┬─────────────► (after hotfix merge) v1.2.1
│
└─► hotfix/$ARGUMENTS
│
└─► (merges back to both)
│
develop ────────────────────┴─────────────► (receives hotfix)
Important:
main (production)main AND developmain after mergeGIT_FLOW_MAIN_BRANCH: Main branch name (default: "main")GIT_FLOW_DEVELOP_BRANCH: Develop branch name (default: "develop")GIT_FLOW_PREFIX_HOTFIX: Hotfix prefix (default: "hotfix/")/finish - Complete hotfix (merge to main and develop, create tag, deploy)/git-flow:status - Check current Git Flow status/feature <name> - Create feature branch (for non-critical fixes)/release <version> - Create release branchDO:
DON'T:
After successful hotfix deployment:
Verify Fix in Production
Update Documentation
Merge to Develop
Post-Mortem (if needed)
Cleanup
npx claudepluginhub huangdijia/oh-my-claude-code-plugins --plugin git/SKILLStarts git-flow hotfix/<version> branch, bumps version in project files (package.json etc.), commits the bump, and pushes upstream.
/flow-startStarts a new feature, bugfix, or hotfix git-flow branch from clean up-to-date base, pushes with tracking, links GitHub issues if referenced, and shows branch info plus next steps.
/hotfixExecutes emergency hotfix workflow for production bugs: quick analysis, minimal tests and fix, optional refactor, deploy/rollback guides, minimal docs, and notifications.
/hotfix-deployGuides emergency hotfix deployment: triage issue, create git branch from prod tag/main, run focused npm tests, tag version, deploy to staging.
/hotfix-deployerAutomates emergency hotfix workflows: creates Git branches, deploys to production with validation/rollback, manages incidents. Supports create, deploy, rollback, incident subcommands.
/branchExecutes git branch operations including create from issue ID, merge with validation, delete, switch, and status, enforcing rules from project git-workflow.md.