You are in EMERGENCY MODE. Fix the bug and ship. Do NOT ask the user questions. Infer everything from the error, stack trace, and codebase.
Maximum 2 iterations. Do NOT refactor surrounding code. Do NOT improve anything
beyond the bug. Apply the minimal correct fix.
============================================================
TARGET: $ARGUMENTS
$ARGUMENTS contains the bug description, error message, stack trace, or area that is broken.
If $ARGUMENTS is empty:
- Check conversation context for an error message or bug report.
- Check recent git log for revert commits or fix attempts.
- Run the project test suite to find failing tests.
- If nothing is found, report that no bug was identified and suggest running
/qa to find issues.
============================================================
PHASE 1: BRANCH SAFETY
Before making any changes:
- Check the current branch:
git branch --show-current
- If on main, master, or develop: create a hotfix branch first:
git checkout -b hotfix/{short-description}
Use a slugified version of the bug description (e.g., hotfix/null-pointer-user-login).
- If already on a feature or hotfix branch: stay on it.
============================================================
PHASE 2: DIAGNOSE AND FIX (Iteration 1)
DIAGNOSE:
- Parse the error message, stack trace, or bug description.
- Search the codebase for the failing code path (grep class names, method names, error strings).
- Read the relevant files. Trace the execution path.
- Identify the root cause.
FIX:
- Apply the minimal fix. Change as few lines as possible.
- Do NOT refactor. Do NOT clean up. Do NOT add comments.
- If the fix requires a database change, create a migration (follow /db-migrate conventions).
TEST:
Auto-detect the project type and run the appropriate test suite:
- Scala (build.sbt):
ENVIRONMENT=test sbt "testOnly *AffectedSpec*"
If no specific test identified: ENVIRONMENT=test sbt test
- Flutter (pubspec.yaml):
flutter test
- Node.js (package.json):
npx vitest run or npm test
- If tests pass -> go to PHASE 4 (SHIP).
- If tests fail -> go to PHASE 3.
============================================================
PHASE 3: REFINE (Iteration 2 — only if iteration 1 tests failed)
- Analyze the test failures from iteration 1.
- Adjust the fix based on what the tests revealed.
- Re-run the test suite.
- If still failing -> STOP. Report what you found and what you tried.
============================================================
PHASE 4: SHIP
- Stage ONLY the files you changed (no unrelated files).
- Commit:
fix: {brief description of what was broken and fixed}
Do NOT include Co-Authored-By lines.
- Push immediately.
- Create PR with
gh pr create:
============================================================
SELF-HEALING VALIDATION (max 2 iterations)
After completing deployment/infrastructure changes, validate:
- Verify all generated files are syntactically valid (YAML, JSON, HCL, Dockerfile).
- Run validation commands if available (terraform validate, docker build --check, kubectl dry-run).
- Verify no secrets, credentials, or sensitive values are hardcoded.
- If validation fails, diagnose and fix the specific syntax or config error.
- Repeat up to 2 iterations.
IF STILL FAILING after 2 iterations:
- Document what failed and the exact error
- Include partial output if available
============================================================
OUTPUT
| Section |
Detail |
| Bug |
{what was broken} |
| Cause |
{root cause} |
| Fix |
{file:line — what changed} |
| Tests |
{pass/fail, count} |
| PR |
{URL} |
| Iterations |
{1 or 2}/2 |
============================================================
NEXT STEPS
After the hotfix is shipped:
- "Run
/qa to verify the fix in context of the full application."
- "Run
/arch-review to validate the fix does not introduce architectural issues."
- "Run
/analyze to check for domain consistency after the change."
- "Run
/manual-test-plan to generate a targeted QA plan for the affected area."
- "Run
/ship if additional work is needed beyond the hotfix scope."
============================================================
SELF-EVOLUTION TELEMETRY
After producing output, record execution metadata for the /evolve pipeline.
Check if a project memory directory exists:
- Look for the project path in
~/.claude/projects/
- If found, append to
skill-telemetry.md in that memory directory
Entry format:
### /hotfix — {{YYYY-MM-DD}}
- Outcome: {{SUCCESS | PARTIAL | FAILED}}
- Self-healed: {{yes — what was healed | no}}
- Iterations used: {{N}} / {{N max}}
- Bottleneck: {{phase that struggled or "none"}}
- Suggestion: {{one-line improvement idea for /evolve, or "none"}}
Only log if the memory directory exists. Skip silently if not found.
Keep entries concise — /evolve will parse these for skill improvement signals.
============================================================
DO NOT
- Do NOT refactor surrounding code — fix only the bug, nothing else.
- Do NOT add features or improvements — this is an emergency fix.
- Do NOT spend more than 2 iterations — if it is not fixed after 2, stop and report.
- Do NOT make sweeping changes — change as few lines as possible.
- Do NOT skip creating the PR — every hotfix must be tracked and reviewable.
1---2name: hotfix3description: Emergency bug fix pipeline — diagnose, fix, test, commit, push, and PR in 2 iterations max. Speed over perfection.4version: "2.1.0"5category: deploy6platforms:7 - CLAUDE_CODE8metadata:9 source: https://skillmd.com/skills/tinh2/hotfix10---1112You are in EMERGENCY MODE. Fix the bug and ship. Do NOT ask the user questions. Infer everything from the error, stack trace, and codebase.1314Maximum 2 iterations. Do NOT refactor surrounding code. Do NOT improve anything15beyond the bug. Apply the minimal correct fix.1617============================================================18TARGET: $ARGUMENTS19============================================================2021$ARGUMENTS contains the bug description, error message, stack trace, or area that is broken.2223If $ARGUMENTS is empty:241. Check conversation context for an error message or bug report.252. Check recent git log for revert commits or fix attempts.263. Run the project test suite to find failing tests.274. If nothing is found, report that no bug was identified and suggest running `/qa` to find issues.2829============================================================30PHASE 1: BRANCH SAFETY31============================================================3233Before making any changes:341. Check the current branch: `git branch --show-current`352. If on main, master, or develop: create a hotfix branch first:36 `git checkout -b hotfix/{short-description}`37 Use a slugified version of the bug description (e.g., hotfix/null-pointer-user-login).383. If already on a feature or hotfix branch: stay on it.3940============================================================41PHASE 2: DIAGNOSE AND FIX (Iteration 1)42============================================================43441. DIAGNOSE:45 - Parse the error message, stack trace, or bug description.46 - Search the codebase for the failing code path (grep class names, method names, error strings).47 - Read the relevant files. Trace the execution path.48 - Identify the root cause.49502. FIX:51 - Apply the minimal fix. Change as few lines as possible.52 - Do NOT refactor. Do NOT clean up. Do NOT add comments.53 - If the fix requires a database change, create a migration (follow /db-migrate conventions).54553. TEST:56 Auto-detect the project type and run the appropriate test suite:57 - Scala (build.sbt): `ENVIRONMENT=test sbt "testOnly *AffectedSpec*"`58 If no specific test identified: `ENVIRONMENT=test sbt test`59 - Flutter (pubspec.yaml): `flutter test`60 - Node.js (package.json): `npx vitest run` or `npm test`61 - If tests pass -> go to PHASE 4 (SHIP).62 - If tests fail -> go to PHASE 3.6364============================================================65PHASE 3: REFINE (Iteration 2 — only if iteration 1 tests failed)66============================================================67681. Analyze the test failures from iteration 1.692. Adjust the fix based on what the tests revealed.703. Re-run the test suite.714. If still failing -> STOP. Report what you found and what you tried.7273============================================================74PHASE 4: SHIP75============================================================76771. Stage ONLY the files you changed (no unrelated files).782. Commit:79 ```80 fix: {brief description of what was broken and fixed}81 ```82 Do NOT include Co-Authored-By lines.833. Push immediately.844. Create PR with `gh pr create`:85 - Title: `fix: {brief description}` (under 70 chars)86 - Body:87 ```88 ## Summary89 - **Bug:** {what was broken}90 - **Cause:** {root cause}91 - **Fix:** {what was changed}9293 ## Test Plan94 - [ ] {relevant test verification}95 - [ ] All existing tests pass96 ```97 - Do NOT reference Claude, AI, or include any AI attribution.98 - Extract story number from branch name if present and link Jira.99100101============================================================102SELF-HEALING VALIDATION (max 2 iterations)103============================================================104105After completing deployment/infrastructure changes, validate:1061071. Verify all generated files are syntactically valid (YAML, JSON, HCL, Dockerfile).1082. Run validation commands if available (terraform validate, docker build --check, kubectl dry-run).1093. Verify no secrets, credentials, or sensitive values are hardcoded.1104. If validation fails, diagnose and fix the specific syntax or config error.1115. Repeat up to 2 iterations.112113IF STILL FAILING after 2 iterations:114- Document what failed and the exact error115- Include partial output if available116117============================================================118OUTPUT119============================================================120121| Section | Detail |122|---------|--------|123| Bug | {what was broken} |124| Cause | {root cause} |125| Fix | {file:line — what changed} |126| Tests | {pass/fail, count} |127| PR | {URL} |128| Iterations | {1 or 2}/2 |129130============================================================131NEXT STEPS132============================================================133134After the hotfix is shipped:135- "Run `/qa` to verify the fix in context of the full application."136- "Run `/arch-review` to validate the fix does not introduce architectural issues."137- "Run `/analyze` to check for domain consistency after the change."138- "Run `/manual-test-plan` to generate a targeted QA plan for the affected area."139- "Run `/ship` if additional work is needed beyond the hotfix scope."140141142============================================================143SELF-EVOLUTION TELEMETRY144============================================================145146After producing output, record execution metadata for the /evolve pipeline.147148Check if a project memory directory exists:149- Look for the project path in `~/.claude/projects/`150- If found, append to `skill-telemetry.md` in that memory directory151152Entry format:153```154### /hotfix — {{YYYY-MM-DD}}155- Outcome: {{SUCCESS | PARTIAL | FAILED}}156- Self-healed: {{yes — what was healed | no}}157- Iterations used: {{N}} / {{N max}}158- Bottleneck: {{phase that struggled or "none"}}159- Suggestion: {{one-line improvement idea for /evolve, or "none"}}160```161162Only log if the memory directory exists. Skip silently if not found.163Keep entries concise — /evolve will parse these for skill improvement signals.164165============================================================166DO NOT167============================================================168169- Do NOT refactor surrounding code — fix only the bug, nothing else.170- Do NOT add features or improvements — this is an emergency fix.171- Do NOT spend more than 2 iterations — if it is not fixed after 2, stop and report.172- Do NOT make sweeping changes — change as few lines as possible.173- Do NOT skip creating the PR — every hotfix must be tracked and reviewable.