# Devxkit Safe Stash

Preserve tracked and untracked work before running `devxkit agent slice start` to avoid 'Working tree is not clean' errors.

**Canonical URL:** https://skillshunter.net/skills/discovered-6e80fadc5dd3dc1316c635020faf2173db33c5178e813af1

**JSON URL:** https://skillshunter.net/api/public/v1/skills/discovered-6e80fadc5dd3dc1316c635020faf2173db33c5178e813af1

**Markdown URL:** https://skillshunter.net/skills/discovered-6e80fadc5dd3dc1316c635020faf2173db33c5178e813af1.md

**Instructions download URL:** https://skillshunter.net/skills/discovered-6e80fadc5dd3dc1316c635020faf2173db33c5178e813af1/download

**Category:** Software & Development

**Source URL:** https://github.com/jesuserro/devxkit/blob/0380bd30488627f7232a08c38ebc0c7dd9a66dc3/src/devxkit/assets/skills/devxkit/devxkit-safe-stash/SKILL.md

**Source commit:** 0380bd30488627f7232a08c38ebc0c7dd9a66dc3

**Listing approved at:** 2026-11-29

**Created at:** 2026-11-28T18:48:50.000000Z

**Updated at:** 2026-11-29T10:53:27.000000Z

## Catalog information

The following descriptions are catalog information. Listing approval does not mean the skill has been tested or is safe for every environment.

### Editor's note

Before using `devxkit agent slice start`, ensure the working tree is clean or use `--stash` to save untracked files. Verify the stash with `git stash list` before proceeding.

### When to use it

- Preserving untracked files before starting a Devxkit agent slice
- Resolving 'Working tree is not clean' errors when using `devxkit agent slice start`
- Managing WIP (work in progress) files during branch checkout

## Skill instructions

---
name: devxkit-safe-stash
description: Preserve tracked and untracked work before devxkit agent slice start.
scope: global
devxkit_commands:
  - devxkit agent slice start
---

# devxkit safe stash

Legacy prepared-slice compatibility only. Ordinary work uses an isolated
worktree and preserves the human checkout; do not stash another task.

## When to use

- `devxkit agent slice start <issue>` fails with **Working tree is not clean**
- You have WIP (including **untracked** files) that must survive branch checkout
- Before starting any issue-backed slice on the configured base (default `main`)

## Preconditions

- You understand stash pop may cause conflicts if the same files changed on the new branch
- Prefer stash over discarding work; never use destructive clean without explicit user approval

## Commands

```bash
git status --short

git stash push -u -m "wip before devxkit slice <issue>"
devxkit agent slice start <issue>

# Or let devxkit stash automatically:
devxkit agent slice start <issue> --stash

git stash list --date=local | head
git stash pop
git status --short
```

Manual sequence if `--stash` is not used:

```bash
git stash push -u -m "wip before devxkit slice <issue>"
devxkit agent slice start <issue>
git stash pop
```

## Validation

- `git status --short` is empty (or only expected slice artifacts) **before** `slice start`
- After `stash pop`, review status; resolve conflicts before `devxkit agent validate`
- Stash entry visible in `git stash list` until popped

## Common failures

- **Untracked files block slice start** → always use `-u` / `--stash`
- **Stash pop conflicts** → resolve manually; do not force-merge or `git clean`
- **`--stash` but still dirty** → doctor message lists remaining paths; stash again or commit WIP elsewhere
- **Lost work fear** → verify stash with `git stash list` before continuing

## Stop conditions

- Do **not** run `git clean -fdx` or other destructive cleanup unless the user explicitly authorizes it
- Do **not** proceed with slice start while tree is dirty
- Stop and report if stash pop produces conflicts you cannot resolve safely

## Related skills

- `devxkit-agent-flow`

