dirty-main-narrow-fix-promotion-with-stash-recovery

Promote a narrow fix from a feature/worktree into workspace-hub main when main is dirty; verify label taxonomy before issue creation and recover safely when stash reapply conflicts.

5 stars

Best use case

dirty-main-narrow-fix-promotion-with-stash-recovery is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Promote a narrow fix from a feature/worktree into workspace-hub main when main is dirty; verify label taxonomy before issue creation and recover safely when stash reapply conflicts.

Teams using dirty-main-narrow-fix-promotion-with-stash-recovery should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/dirty-main-narrow-fix-promotion-with-stash-recovery/SKILL.md --create-dirs "https://raw.githubusercontent.com/vamseeachanta/workspace-hub/main/.agents/skills/workspace-hub-learned/dirty-main-narrow-fix-promotion-with-stash-recovery/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/dirty-main-narrow-fix-promotion-with-stash-recovery/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How dirty-main-narrow-fix-promotion-with-stash-recovery Compares

Feature / Agentdirty-main-narrow-fix-promotion-with-stash-recoveryStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Promote a narrow fix from a feature/worktree into workspace-hub main when main is dirty; verify label taxonomy before issue creation and recover safely when stash reapply conflicts.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Dirty-main narrow fix promotion with stash recovery

Use when:
- a single verified fix commit must be promoted to `main`
- `/mnt/local-analysis/workspace-hub` `main` is dirty
- you also need to create GitHub issues from generated scripts without trusting assumed labels

## Core lessons
1. Do not cherry-pick onto dirty `main`.
2. Before `gh issue create`, verify exact repo labels; do not assume generic labels like `tests`, `parsing`, or `releases` exist.
3. `git stash push -u` may be the right move for a quick narrow promotion, but `stash apply` can fail after the cherry-pick/push if the restored work overlaps files changed by ongoing local work.
4. If restore fails, keep the stash; do not drop it. Prefer recovery in isolation rather than forcing restore on dirty `main`.

## Issue-creation preflight
Run before creating issues:
```bash
gh auth status
gh label list --repo <owner/repo>
gh issue list --repo <owner/repo> --state all --search '"<exact proposed title>"' --limit 10
```

Rules:
- use only labels that actually exist in the target repo
- exact-title search is cheap and catches obvious duplicates
- if a label is missing, patch the local issue-generation scripts before creation

## Narrow promotion flow from dirty main
1. Inspect dirty state:
```bash
cd /mnt/local-analysis/workspace-hub
git status --short --branch
```

2. Stash tracked + untracked state:
```bash
git stash push -u -m "pre-<commit>-promotion-YYYY-MM-DD"
```

3. Verify clean enough to proceed:
```bash
git status --short --branch
git stash list | head
```

4. Update `main` and verify fix absent:
```bash
git fetch origin --prune
git pull --ff-only origin main
if git merge-base --is-ancestor <commit> HEAD; then echo already-present; else echo absent; fi
```

5. Cherry-pick and validate:
```bash
git cherry-pick <commit>
bash tests/hooks/test-require-plan-approval.sh
git push origin main
```

6. Restore the stash conservatively:
```bash
git stash apply stash^{/pre-<commit>-promotion-YYYY-MM-DD}
```
Use `apply`, not `pop`, so the stash survives failed or partial restore.

## If stash apply fails
Symptoms:
- `Your local changes to the following files would be overwritten by merge`
- promotion already succeeded and pushed

Response:
1. stop immediately
2. confirm the promoted fix is on `main` and pushed
3. confirm the stash still exists with `git stash list`
4. do **not** drop the stash
5. do **not** continue unrelated work from this dirty `main`
6. recover in isolation:
   - preferred: create a recovery branch/worktree from the stash and inspect/merge deliberately
   - avoid repeatedly stacking more stash/apply operations on dirty `main`

## Why this matters
This pattern preserves the narrow promotion audit trail while protecting the original dirty local state. It also avoids GH issue creation failures caused by repo-taxonomy drift between assumed labels and real labels.

## Verification checklist
- `gh auth status` healthy
- exact labels verified in target repo
- duplicate-title search returns no exact matches
- fix commit not already on `main`
- targeted regression test passes after cherry-pick
- push succeeds
- if restore fails, stash still exists and is preserved for isolated recovery

Related Skills

domain-knowledge-sweep

5
from vamseeachanta/workspace-hub

Systematic multi-source research of an engineering domain. Spawns parent issue → 6 research subissues (Standards, Academic, Industry, LinkedIn-marketing, Code-audit, Synthesis) → gap implementation subissues. Replaces LinkedIn-only extraction with defensible comprehensive sourcing.

nested-git-repo-stash-safety

5
from vamseeachanta/workspace-hub

How to safely stash changes in a parent repo containing dirty nested git repositories

multi-repo-stale-lock-recovery

5
from vamseeachanta/workspace-hub

Diagnose and recover from stale git lock files in multi-repo workspaces, especially with submodules

multi-repo-pull-with-untracked-conflict-recovery

5
from vamseeachanta/workspace-hub

Diagnose and resolve multi-repo pull failures caused by untracked files conflicting with remote changes

multi-repo-git-recovery

5
from vamseeachanta/workspace-hub

Diagnose and recover from stale lock files, diverged branches, and untracked file conflicts across multiple repos in a workspace ecosystem

git-stale-lock-recovery

5
from vamseeachanta/workspace-hub

Diagnose and recover from git stale lock files and corrupted rebase states in multi-repo workflows

git-large-file-staging-conflict-recovery

5
from vamseeachanta/workspace-hub

Recover from pre-commit hook blocks on oversized files and corrupted rebase states during bulk repo syncs

freetaxusa-form-entry-recovery

5
from vamseeachanta/workspace-hub

Handle session timeouts and modal dialogs when entering tax forms in FreeTaxUSA

diagnose-dirty-ntfs-mount-errors

5
from vamseeachanta/workspace-hub

Troubleshoot NTFS mount failures by identifying dirty volume flags and driver type

diagnose-and-mount-dirty-ntfs-drives

5
from vamseeachanta/workspace-hub

Troubleshoot and mount NTFS external drives blocked by dirty filesystem flags

clean-worktree-integration-from-dirty-main

5
from vamseeachanta/workspace-hub

Land validated issue work from isolated worktrees when the main checkout is dirty by creating a fresh integration worktree, cherry-picking only implementation commits, re-running combined validation, and preparing push/closeout artifacts.

session-start-dirty-state-triage-with-background-agents

5
from vamseeachanta/workspace-hub

Distinguish real implementation dirt from generated session-state churn when resuming a repo with active overnight/background agents.