Skip to main content
Agent skill

Shutdown Dev

Cleanly shut down a dev teammate — instruct them to write a context summary to plan/agent-context/{name}.md first, receive their approval, verify process exit. Use for scale-down, rotation, sprint wrap-up.

Get started

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Shutdown Dev when an AI agent needs a reusable SKILL.md workflow for this job: Cleanly shut down a dev teammate — instruct them to write a context summary to plan/agent-context/{name}.md first, receive their approval, verify process exit. Use for scale-down, rotation, sprint wrap-up.

When not to use it

Skip Shutdown Dev when the task is outside the coding category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
Claude Code folder setup
mkdir -p ~/.claude/skills/shutdown-dev
# Save SKILL.md to ~/.claude/skills/shutdown-dev/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/shutdown-dev/SKILL.md. For a shared project, commit the folder at .claude/skills/shutdown-dev/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Shutdown Dev skill for this task: Team scale-down (e.g. going from 8 → 6 devs after OOM pressure or sprint close). Confirm any required inputs or files before making changes.

What supports this recommendation?

82/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
92/100
Practical detail
92/100
Source evidence
58/100
Source signals
70/100
Model compatibility evidence
  • claudeinferred

    The skill text mentions Claude or a closely associated term. This is keyword-derived compatibility; no hands-on model test is recorded.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# Shutdown Dev

Gracefully terminate a dev teammate's session while preserving their working context for future resumption.

## When to use

- Team scale-down (e.g. going from 8 → 6 devs after OOM pressure or sprint close) - Dev assigned to an orphaned branch after their PR was closed - Sprint retrospective and wrap-up — shutting down devs between sprints - Memory pressure requiring you to shed agent processes

## Pre-shutdown checklist

1. **Is the dev in the middle of something?** Check their task status: ```bash # via TaskList, filter for owner == <dev-name> ``` If they're mid-implementation on a non-trivial task, prefer rotating them OFF that task first rather than losing the work.

2. **Is the user currently talking to this dev?** If yes, confirm with the user before shutting down.

3. **Do they have uncommitted work in their worktree?** Check via their file-locks entries and any in-flight PRs. Warn them to commit before approving shutdown.

## Step 1: Send the shutdown_request

``` SendMessage to: <dev-name> Type: shutdown_request

{"type": "shutdown_request", "reason": "<reason — e.g. 'Scaling team from 8 to 6 after OOM recovery; your current PR is merged/closed and you have no active task'>. Before approving shutdown: (1) write your working context to plan/agent-context/<dev-name>.md — include active branches, any in-progress thoughts, and anything a successor agent would need to resume. Keep it concise (~100 lines). (2) Commit any uncommitted WIP in your worktrees, or note explicitly that nothing is WIP. (3) Reply with shutdown_response approve=true. Your worktrees and branches stay — another dev can resume them later."} ```

**Critical constraints in the message:** - MUST instruct them to write `plan/agent-context/<name>.md` FIRST - MUST tell them to commit uncommitted WIP - MUST NOT ask them to narrate their context in the chat reply (that bloats the tech lead's context) - Reply should be a one-line `shutdown_response` approve=true

## Step 2: Wait for response

The dev will either: - Reply with `{"type":"shutdown_response","approve":true,"request_id":"..."}` → proceed to step 3 - Reply asking questions (rare) → answer briefly, re-send shutdown_request - Not respond (stuck process) → see step 5

## Step 3: Verify the context file was written

```bash ls -la plan/agent-context/<dev-name>.md head -20 plan/agent-context/<dev-name>.md ```

The file should exist, be recent, and have substantive content (not empty).

If the dev skipped this step, re-send the shutdown_request with an explicit "blocked until context file exists" note.

## Step 4: Verify the worktree is in a known state

```bash wt=/workspace/.claude/worktrees/<branch-name> git -C "$wt" diff --stat # uncommitted changes git -C "$wt" log --oneline main..HEAD # unmerged commits ```

If there are uncommitted changes: write them to the agent-context file as "Suspended Work" with a resume recipe, then commit or drop per the dev's note.

If there are unmerged commits: note the branch name in the context file so a successor can pick up.

## Step 5: If the dev is unresponsive

The dev's claude process may be stuck or already dead. Verify:

```bash ps -ef | grep claude | grep -v grep ```

Options: 1. Wait another 60s — they may be mid-tool-call 2. Send a `PAUSE` to interrupt the current work, then retry the shutdown_request 3. If clearly dead: manually write their agent-context file based on known state (branch name, task ID, last-known progress from TaskList), then kill the process

## Step 6: Commit the context file

If the dev committed it themselves, you're done. If not:

```bash cd /workspace git add plan/agent-context/<dev-name>.md git commit -m "docs(agent-context): preserve <dev-name> state before shutdown

✓

<dev-name> shut down during <reason>. Context preserved for resumption.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>" ```

## Step 7: Update team state

- Remove the dev from any active dispatch messaging - Update `plan/method/agent-sessions.md` if it tracks live sessions - Update `plan/method/file-locks.md` to drop any claims held by the dev

## Step 8: Confirm termination

After the dev's process exits (approved shutdown), verify no orphan vitest or subprocess runners remain:

```bash ps -ef | grep -E '(vitest|claude)' | grep -v grep ```

If leftover processes trace back to the shut-down dev, kill them.

## Output

``` Shutdown complete: <dev-name> Context saved: plan/agent-context/<dev-name>.md (~NN lines) Worktree: <branch> preserved, <uncommitted|clean>, <unmerged|merged> Team size: N → N-1 ```

## Notes

- **The agent-context file is the handoff channel** — without it, a successor agent has to reconstruct everything from issue files and git history. - **Never delete worktrees on shutdown** — they may contain recoverable state a successor needs. Cleanup happens at sprint close, not at shutdown. - **Don't shut down devs mid-PR-review** — if their PR is open and awaiting CI, wait for CI to finish (merge or close) before shutting down. Otherwise their context file has to describe a PR state that may change. - **Scale-down batches:** when shutting down multiple devs, send all the shutdown_requests in parallel (one SendMessage each in a single message) and wait for all approvals before verifying.

Intended uses

  • Team scale-down (e.g. going from 8 → 6 devs after OOM pressure or sprint close)
  • Dev assigned to an orphaned branch after their PR was closed
  • Sprint retrospective and wrap-up — shutting down devs between sprints
  • Memory pressure requiring you to shed agent processes

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.