Skip to content
Back to skills

2496 Zerg Cleanup A7f11f8e

ASecurity

Remove ZERG artifacts and clean up resources after a feature is complete or abandoned.

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
code-qualitygobashdockerdebugginggit

Works with

  • claude code

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2496-zerg-cleanup_a7f11f8e --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2496 Zerg Cleanup A7f11f8e?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2496 Zerg Cleanup A7f11f8e
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2496-zerg-cleanup-a7f11f8e/badge)](https://www.skillsdirectory.com/skills/tools-only-2496-zerg-cleanup-a7f11f8e)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
# /zerg:cleanup

Remove ZERG artifacts and clean up resources after a feature is complete or abandoned.

## Synopsis

```
/zerg:cleanup [OPTIONS]
```

## Description

`/zerg:cleanup` removes temporary resources created during ZERG execution, including git worktrees, worker branches, Docker containers, state files, and log files. It preserves spec files, design documents, merged code, and task archives.

Before removing any state, the command archives the Claude Code Task list to `.zerg/archive/<feature>/tasks-<timestamp>.json`.

### What Gets Removed

| Resource | Path / Pattern | Removed |
|----------|----------------|---------|
| Git worktrees | `.zerg/worktrees/<feature>-worker-*` | Yes |
| State files | `.zerg/state/<feature>.json` | Yes |
| Log files | `.zerg/logs/worker-*.log` | Unless `--keep-logs` |
| Git branches | `zerg/<feature>/*` | Unless `--keep-branches` |
| Docker containers | `zerg-worker-<feature>-*` | Yes |

### What Is Preserved

- Source code and commits on the main branch
- Merged changes already in the target branch
- Spec files in `.gsd/specs/<feature>/` (requirements, design, task graph)
- Task archive in `.zerg/archive/<feature>/`

## Options

| Option | Description |
|--------|-------------|
| `-f`, `--feature TEXT` | Feature to clean up (required unless `--all` is specified) |
| `--all` | Clean up all ZERG features |
| `--keep-logs` | Preserve log files for post-mortem analysis |
| `--keep-branches` | Preserve git branches for manual inspection |
| `--dry-run` | Show the cleanup plan without executing |

## Examples

```bash
# Clean up a specific feature
/zerg:cleanup --feature user-auth

# Preview what will be cleaned
/zerg:cleanup --all --dry-run

# Clean all features
/zerg:cleanup --all

# Keep logs for debugging
/zerg:cleanup --feature user-auth --keep-logs

# Keep branches for inspection
/zerg:cleanup --feature user-auth --keep-branches
```

## Dry Run

Always preview before cleaning:

```bash
/zerg:cleanup --all --dry-run
```

The dry run output lists every resource that would be removed, grouped by category (worktrees, branches, containers, state files, log files), with item counts.

## Recovery

### Before Cleanup

If you might need to resume later:

```bash
# Check status first
/zerg:status

# Export logs
/zerg:logs --json > feature-logs.jsonl

# Backup state
cp .zerg/state/<feature>.json feature-backup.json
```

### After Accidental Cleanup

Git branches can be recovered from the reflog for up to 30 days:

```bash
# Find the deleted branch
git reflog | grep "zerg/<feature>"

# Recover the branch
git checkout -b zerg/<feature>/worker-0 <commit-hash>
```

Worktrees must be recreated by running `/zerg:rush` again.

## Safety Features

1. **Dry run support** -- Preview shows exact resources before removal.
2. **Confirmation prompt** -- Interactive confirmation before executing.
3. **Feature required** -- Must specify `--feature` or `--all` explicitly.
4. **Spec preservation** -- Design documents and requirements are never deleted.
5. **Task archival** -- Task history is archived before removal.
6. **Git reflog** -- Deleted branches remain recoverable for 30 days.

## See Also

- [[zerg-status]] -- Verify completion before cleanup
- [[zerg-logs]] -- Export logs before cleanup
- [[zerg-stop]] -- Stop workers before cleanup if still running
- [[zerg-Reference]] -- Full command index

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.