home / skills / shotaiuchi / dotclaude / sh2-run

sh2-run skill

/dotclaude/skills/sh2-run

This skill helps you automatically select and run the next scheduled task while respecting dependencies and priorities.

npx playbooks add skill shotaiuchi/dotclaude --skill sh2-run

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
2.9 KB
---
name: sh2-run
description: スケジュールから次のタスクを実行
argument-hint: "[--dry-run] [--until <phase>] [--all] [--no-branch]"
---

**Always respond in Japanese.**

# /sh2-run

Select and execute the next task from schedule.json, respecting dependency order.

## Options

| Option | Description |
|--------|-------------|
| `--dry-run` | Display task info only, do not execute |
| `--until <phase>` | Auto-execute until specified phase (skip selection) |
| `--all` | Auto-execute all remaining tasks (max 50, safety limit) |
| `--no-branch` | Skip branch creation in wf1-kickoff, use current branch |

## Processing

Parse $ARGUMENTS and execute the following.

### 1. Load Schedule

Read `.wf/schedule.json`. Error if missing (suggest `/sh1-create create`). Exit if `.status == "completed"`.

### 2. Get Next Task

From `.works`, find the first pending work (sorted by `.priority`) whose `.dependencies` are all completed. If none found, display blocked tasks and exit.

### 3. Display Task Info

Show: work ID, source type/ID, title, dependencies.

### 4. Dry Run

If `--dry-run`: show progress (completed/total, pending count) and exit.

### 5. Execution Range Selection

If neither `--until` nor `--all` specified, use AskUserQuestion:

```
AskUserQuestion(
  questions: [{
    question: "Where would you like to stop?",
    header: "Execute",
    options: [
      { label: "wf1-kickoff only", description: "Start work, then pause for review" },
      { label: "Until wf3-plan", description: "Complete design phase" },
      { label: "Until wf4-review", description: "Complete review phase" },
      { label: "Until wf6-verify (Recommended)", description: "Complete entire task" },
      { label: "Complete all tasks", description: "Execute all remaining tasks in schedule" }
    ],
    multiSelect: false
  }]
)
```

Selection mapping: 1→wf1-kickoff, 2→wf3-plan, 3→wf4-review, 4→wf6-verify, 5→execute_all.

### 6. Execute Workflow

1. Update schedule: set work status to `"running"`, record `started_at`, update `.progress`
2. Execute `/wf1-kickoff {work_id}` via Skill tool (pass `--no-branch` if specified)
3. If target is beyond wf1-kickoff, loop `/wf0-nextstep {work_id}` until `current == target_phase` or `next == "complete"`

### 7. Mark Complete and Show Remaining

If PR created (`.works[work_id].pr.url` exists in state.json):
- Update schedule: status→`"completed"`, record `completed_at`, update `.progress`

Show remaining task count. If zero, set schedule `.status = "completed"`.

For `--all` / selection 5: loop steps 2-7 for each available task.

## Relationship with wf0-nextstep

| Command | Scope |
|---------|-------|
| `wf0-nextstep` | Phase transition within a single work (wf1→wf2→...→wf6) |
| `sh2-run` | Task selection across multiple works in schedule.json |

## Notes

- Schedule must exist (create with `/sh1-create create`)
- Tasks execute in priority order respecting dependencies
- `--all` has a 50-task safety limit per invocation

Overview

This skill selects the next pending task from .wf/schedule.json and runs its workflow steps in dependency- and priority-aware order. It supports dry-run inspection, limited phased execution, and batched execution of multiple tasks. It updates the schedule state (running/completed/progress) and respects a safety limit when auto-running many tasks.

How this skill works

The skill loads .wf/schedule.json and finds the first pending work whose dependencies are complete, erroring if the schedule is missing or already completed. It displays task metadata, optionally performs a dry run, then either prompts for an execution stop point or uses --until/--all to drive automated execution. Execution runs wf1-kickoff and then iteratively calls wf0-nextstep until the selected phase or completion; schedule.json and state.json are updated with start, progress, and completion info.

When to use it

  • Run the next task in a multi-work schedule respecting dependencies and priorities
  • Check upcoming work and progress without executing using --dry-run
  • Automatically finish a task up to a specific workflow phase with --until
  • Process all remaining tasks (up to safety limit) with --all
  • Integrate into CI/scripts that need to advance schedule-driven work items

Best practices

  • Ensure .wf/schedule.json exists (create it with the schedule creation command) before running
  • Use --dry-run to verify the next task and its dependencies before executing
  • Prefer --until wf6-verify to complete an entire work; use wf1-kickoff for review checkpoints
  • Use --no-branch when you must run kickoff without creating branches
  • Limit automated runs: --all enforces a 50-task safety cap to avoid accidental mass changes

Example use cases

  • Advance a single high-priority work that is now unblocked by completed dependencies
  • Run a full task from kickoff through verify after final design approval (--until wf6-verify)
  • Safely preview the next scheduled job and decide whether to run with --dry-run
  • Batch-process remaining tasks overnight using --all (subject to 50-task limit)
  • Trigger workflows inside automation scripts, passing --no-branch when branch creation is not desired

FAQ

What if .wf/schedule.json is missing?

The skill errors and suggests creating the schedule first; create the schedule before running.

How does --until map to workflow phases?

Selection maps to specific phases: wf1-kickoff, wf3-plan, wf4-review, wf6-verify; selecting the recommended wf6-verify completes the work.