home / skills / shotaiuchi / dotclaude / wf0-restore
This skill restores an existing workspace to resume work across devices by reloading state, branches, and optional worktrees.
npx playbooks add skill shotaiuchi/dotclaude --skill wf0-restoreReview the files below or copy the command above to add this skill to your agents.
---
name: wf0-restore
description: 既存のワークスペースを復元
argument-hint: "[work-id]"
---
**Always respond in Japanese.**
# /wf0-restore
Restore an existing workspace for resuming work on a different PC or recreating a worktree.
## Usage
```
/wf0-restore [work-id]
```
## Arguments
- `work-id`: Optional. Uses `active_work` from state.json, or presents candidates via AskUserQuestion.
## Processing
### 1. Check Prerequisites
Require `jq` and `git`.
### 2. Resolve work-id
Argument → `active_work` → AskUserQuestion with available work-ids (show branch and current phase for each).
### 3. Fetch Remote
`git fetch --all --prune`
### 4. Restore Branch
Get branch/base from state.json. Check local branch → remote branch → error if neither exists. Checkout accordingly.
### 5. Restore Worktree (Optional)
If `config.worktree.enabled`: create worktree if not exists, update `.wf/local.json` with path.
### 6. Update active_work
Set `active_work` in state.json.
### 7. Display Status
Show: Work ID, Branch, Base, Current phase, Next phase, Docs path, next step command.
## Notes
- Error if state.json missing or work-id not found
- Worktree root directory created automatically
This skill restores an existing workspace so you can resume work on another machine or recreate a worktree. It automates validation, branch checkout, optional worktree creation, and state updates so the workspace is ready to continue where you left off. It reports a clear next-step command and workspace metadata after completion.
The skill requires jq and git, then resolves the target work-id from the argument, the saved active_work, or an interactive selection. It fetches remotes, determines whether to checkout a local or remote branch, and fails if neither exists. If worktree support is enabled, it creates the worktree and writes the local path into .wf/local.json. Finally it updates active_work in state.json and prints summarized status and the recommended next command.
What happens if state.json is missing?
The skill fails early with an error indicating state.json is required and halts to avoid guessing workspace metadata.
How does the skill choose which branch to checkout?
It prefers a matching local branch, falls back to the corresponding remote branch, and errors if neither exists.
Will the skill create the worktree directory for me?
Yes — if config.worktree.enabled is true the skill creates the worktree root and updates .wf/local.json with the path; otherwise it skips worktree steps.