# Minion Apply

> Apply generated patches safely. Preview diffs, dry-run to check, then apply. Always review patches before applying - minions make mistakes!

- Skill: `majiayu000/minion-apply` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds add majiayu000/minion-apply`
- Raw SKILL.md: https://api.skillmd.com/api/skills/majiayu000/minion-apply/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: majiayu000 (https://skillmd.com/u/majiayu000)
- Updated: 2026-09-09
- Page: https://skillmd.com/skills/majiayu000/minion-apply

---


# Minion Apply

Apply patches generated by minions. Always preview and dry-run before applying.

## Workflow

1. **Preview** - See what the patch contains
2. **Dry-run** - Test without making changes
3. **Apply** - Make the changes
4. **Verify** - Run tests

## Usage

### Step 1: List available patches

```bash
ls -la sessions/*.patch
```

### Step 2: Preview a patch

```bash
cat sessions/20250112-patch.patch
```

Or for colored diff:
```bash
cat sessions/20250112-patch.patch | diff-so-fancy 2>/dev/null || cat sessions/20250112-patch.patch
```

### Step 3: Dry-run (test without applying)

```bash
patch -p1 --dry-run < sessions/20250112-patch.patch
```

If successful, shows what would change. If errors, shows conflicts.

### Step 4: Apply the patch

```bash
patch -p1 < sessions/20250112-patch.patch
```

### Step 5: Verify changes

```bash
# Check git diff
git diff

# Run tests
source .venv/bin/activate && pytest
```

## Apply multiple patches

```bash
# Apply all patches in order
for p in sessions/*.patch; do
  echo "Applying $p..."
  patch -p1 < "$p"
done
```

## Handling conflicts

If dry-run shows conflicts:

```
Hunk #1 FAILED at 42.
```

Options:
1. **Regenerate patch** - Run minion-patch again with more context
2. **Manual edit** - Edit the .patch file to fix offsets
3. **Force with fuzz** - `patch -p1 --fuzz=3 < file.patch` (risky)

## Reverting a patch

```bash
patch -p1 -R < sessions/20250112-patch.patch
```

## Clean up after applying

```bash
# Remove applied patches
rm sessions/*.patch

# Or archive them
mkdir -p sessions/applied
mv sessions/*.patch sessions/applied/
```

## Safety tips

- **Always dry-run first** - Catches most issues
- **Review every patch** - Minions make mistakes
- **Commit before applying** - Easy to revert
- **Run tests after** - Verify nothing broke
- **One patch at a time** - Easier to debug

