api-design
REST API design best practices. Use when designing APIs, choosing status codes, or creating endpoints.
Smart router that detects phase state and delegates to the appropriate wrapper (plan, execute, or verify)
$ npx -y skills add Tibsfox/gsd-skill-creator --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
/phaseContext preview
What this command does when you run it.
Smart router that detects phase state and delegates to the appropriate wrapper (plan, execute, or verify)
name: wrap:phase description: Smart router that detects phase state and delegates to the appropriate wrapper (plan, execute, or verify) argument-hint: "[phase-number]" allowed-tools: - Read - Bash - Glob - Task
<objective> Detect the current state of phase N and route to the appropriate wrapper command. If the phase has no plans, route to `/wrap:plan`. If plans exist but execution is incomplete, route to `/wrap:execute`. If execution is complete, route to `/wrap:verify`. This eliminates the need for users to remember which GSD phase lifecycle stage they are in.
The user runs `/wrap:phase N` where N is the phase number, and the router automatically determines what needs to happen next. </objective>
<process>
Extract the phase number **N** from the user's input (e.g., `/wrap:phase 5` means N = 5).
If no phase number is provided: 1. Read `.planning/STATE.md` using the Read tool 2. Extract the current phase number from the `Phase:` line under `## Current Position` 3. If no phase can be determined, ask the user: "Which phase? Provide a phase number."
---
Read `.planning/skill-creator.json` using the Read tool.
**If `integration.wrapper_commands` is `false`:** Display:
Wrapper commands are disabled in skill-creator.json. Use GSD commands directly: - /gsd:plan-phase N -- Create plans - /gsd:execute-phase N -- Execute plans - /gsd:verify-work N -- Verify completed work
Then stop -- do not continue to further steps.
**If parsing fails:** Log the error and proceed with defaults (enabled).
---
This is the core router logic. Read multiple artifacts to determine where phase N sits in the GSD lifecycle.
Read `.planning/ROADMAP.md` using the Read tool. Find the section for Phase N and extract:
Use Glob to find `.planning/phases/{N}-*/{N}-*-PLAN.md` (substituting the actual phase number for N). Count how many PLAN.md files exist.
Use Glob to find `.planning/phases/{N}-*/{N}-*-SUMMARY.md`. Count how many SUMMARY.md files exist. Each SUMMARY represents a completed plan execution.
Use Glob to find `.planning/phases/{N}-*/{N}-*-VERIFICATION.md`. Check whether a verification file exists. Its presence means the phase has been through user acceptance.
Read `.planning/STATE.md` using the Read tool. Check:
---
Apply this decision tree based on the state detected in Step 2:
if ROADMAP shows phase as "Complete": -> Inform user: "Phase N is already complete." -> Suggest: /wrap:verify N (for re-verification) elif no PLAN files found: -> Route to: /wrap:plan N -> Reason: "Phase N has no plans yet. Routing to /wrap:plan." elif SUMMARY count < PLAN count: -> Route to: /wrap:execute N -> Reason: "Phase N has M plans, K executed. Routing to /wrap:execute." elif SUMMARY count == PLAN count AND no VERIFICATION file: -> Route to: /wrap:verify N -> Reason: "Phase N execution complete. Routing to /wrap:verify." elif VERIFICATION file exists: -> Inform user: "Phase N appears fully done (plans executed and verified)." -> Suggest: /wrap:verify N (for re-verification) or move to next phase
**Graceful fallback (WRAP-06):** If state detection fails -- for example, ROADMAP.md cannot be read, Glob returns errors, or the file structure is unexpected -- fall back to asking the user which operation they want:
Could not determine phase N state. Please choose: - /wrap:plan N -- Create plans - /wrap:execute N -- Execute plans - /wrap:verify N -- Verify completed work
---
Before delegating, show the user what was detected and why:
### Phase N State Detection | Check | Result | |----------------|---------------------------| | Phase | N -- [phase name] | | PLAN files | M found | | SUMMARY files | K found | | VERIFICATION | [exists / not found] | | ROADMAP status | [Complete / In Progress / Pending] | **Decision:** Routing to `/wrap:[plan|execute|verify] N` **Reason:** [human-readable explanation of why this route was chosen]
---
Invoke the appropriate wrapper command based on the routing decision from Step 3.
Use the Task tool to delegate. Pass an `effort` parameter sourced from the current GSD profile (set via `/gsd:set-profile`):
Read profile from `.planning/skill-creator.json` (`integration.profile`) or `.claude/skill-creator.json` if the project copy is absent. The mapping is additive: when `effort` is unset, the parent runtime falls back to its default, so legacy invocations remain valid (OGA-016).
An adaptive learning and coprocessor architecture for Claude Code, built as an extension to GSD (open-gsd)
Repo: Tibsfox/gsd-skill-creator
REST API design best practices. Use when designing APIs, choosing status codes, or creating endpoints.
Reviews code for bugs, style, and best practices. Use when reviewing PRs or checking code quality.
Creates context handoff documents for session continuity. Use when ending sessions, switching tasks, or handing off work.
Thinking frameworks for decisions and problem analysis. Use when evaluating options, root causes, or prioritizing.
Environment configuration and secrets management. Use when setting up .env files, managing secrets, or configuring environments.
Safe file operation patterns. Use when performing bulk file operations or writing deployment scripts.