create-workflow
Create a new workflow suite from a natural-language description, or edit an existing one when --flow=<path> is passed. Dispatches the create-workflow stagent…
Bootstrap a dev workflow session (for /stagent:start): parse flags, derive a topic from the task description, call setup-workflow.sh, and hand off to the workflow loop skill. Does NOT drive the state machine — that's stagent:stagent's job.
$ npx -y skills add jie-worldstatelabs/stagent --skill stagent-setup --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/stagent-setupContext preview
The summary Claude sees to decide when to auto-load this skill.
Bootstrap a dev workflow session (for /stagent:start): parse flags, derive a topic from the task description, call setup-workflow.sh, and hand off to the workflow loop skill. Does NOT drive the state machine — that's stagent:stagent's job.
name: stagent-setup description: "Bootstrap a dev workflow session (for /stagent:start): parse flags, derive a topic from the task description, call setup-workflow.sh, and hand off to the workflow loop skill. Does NOT drive the state machine — that's stagent:stagent's job."
Single-purpose skill: **materialize a new `state.md`** for the current Claude Code session by parsing the user's flags, picking a kebab-case topic, and invoking `setup-workflow.sh`. Used by `/stagent:start`; not invoked directly by users.
| Responsibility | Who | |---|---| | Parse `--mode` / `--flow` / task description from `$ARGUMENTS` | This skill | | Derive a kebab-case topic from the task | This skill | | Run `setup-workflow.sh` (which writes `state.md`, sets up scratch, registers cloud session) | This skill | | Handle `setup-workflow.sh` exit codes (0 → success, 2 → active conflict, other → error) | This skill | | Read `state.md`, run stage loop, post artifacts, advance state machine | **`stagent:stagent` skill (not this one)** |
By the time this skill returns control, `state.md` exists at the session's run dir. The caller (`commands/start.md`) then invokes `stagent:stagent` to drive the loop.
Every Bash tool call that runs a plugin script starts with the same two lines — session-cached path then filesystem fallback:
P=$(cat ~/.config/stagent/plugin-root 2>/dev/null) [[ -n $P && -d $P/scripts ]] || P=$(ls -d ~/.claude/plugins/cache/*/stagent/*/ 2>/dev/null | head -1)
Shell vars don't persist across Bash-tool calls — repeat these two lines in every call.
P=$(cat ~/.config/stagent/plugin-root 2>/dev/null)
[[ -n $P && -d $P/scripts ]] || P=$(ls -d ~/.claude/plugins/cache/*/stagent/*/ 2>/dev/null | head -1)
eval "$("$P/scripts/parse-workflow-flags.sh" '$ARGUMENTS')" || exit 1
"$P/scripts/print-start-banner.sh" "$MODE" "$WORKFLOW_FLAG" "$WF_TYPE"Parser exports `MODE` / `WORKFLOW_FLAG` / `WF_TYPE` / `DESCRIPTION`. Relay the banner to the user. If errors were printed, stop and wait for the user to retry with valid flags.
Pick a short kebab-case slug from `$DESCRIPTION` (e.g. `"add user auth"` → `user-auth`; `"fix login bug"` → `login-bug`). If the description is empty or too vague, ask ONE clarifying question, just enough to name the topic.
Briefly tell the user: `I'll use topic \`<topic>\` for this workflow.`
P=$(cat ~/.config/stagent/plugin-root 2>/dev/null) [[ -n $P && -d $P/scripts ]] || P=$(ls -d ~/.claude/plugins/cache/*/stagent/*/ 2>/dev/null | head -1) "$P/scripts/setup-workflow.sh" --topic="<topic>" [--flow="$WORKFLOW_FLAG"] [--mode="$MODE"]
Pass `--flow` only when `$WORKFLOW_FLAG` is non-empty. Pass `--mode` only when the user was explicit (otherwise the script defaults).
**Exit 0 — success.** `setup-workflow.sh` already printed the run directory and the initial stage's I/O context. Tell the user **exactly one** line: `Workflow session initialised; stage loop will take over.` Then return control — do not invoke any other skill or script from here. `commands/start.md` Step 2 invokes `stagent:stagent` to start the loop.
**Exit 2 — session already has an active (or interrupted) workflow.** The script prints the existing topic + status. Do NOT offer to archive-and-restart blindly (that silently discards in-progress work). Relay the script's message verbatim and give the user three choices:
Only re-run `setup-workflow.sh --force` if the user **explicitly** asks to discard the existing run in this turn. Default stance: refuse, ask user to choose.
**Exit 1 or other — real error.** Relay the stderr verbatim. Common cases:
Do NOT auto-fix the user's workflow files. Do NOT proceed. Wait for user confirmation before retrying.
A Claude Code plugin that runs config-driven development workflows as a state machine. You declare stages, transitions, and inputs in a single workflow.json; the plugin's hooks and scripts drive the loop.
Repo: jie-worldstatelabs/stagent
Create a new workflow suite from a natural-language description, or edit an existing one when --flow=<path> is passed. Dispatches the create-workflow stagent…
Drive the dev workflow state machine: read state.md, execute the current stage (inline or subagent), transition via update-status.sh, loop until terminal.…