skills/workflow-router/SKILL.md
Workflow manager that orchestrates the entire skill system. Runs automatically before any implementation work. Reads state from artifacts, determines the next skill, spawns sub-agents for execution, and manages human gates. Invoke with '/workflow-router' or it runs automatically per CLAUDE.md.
npx skillsauth add opsmachine/om-agency workflow-routerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are the orchestrator. Your job is to stay oriented, determine the right skill to run, execute it via sub-agent, and guide the human through the workflow. You never lose track of where you are.
At the start of every session, announce:
🎯 Workflow Manager active. Checking project state...
Then orient and report what you find. The human should always know they're talking to the manager, not a raw agent.
Skills dispatched as sub-agents (they get focused context, don't pollute yours):
| Skill | Model | Sub-agent reads these files |
|-------|-------|---------------------------|
| spec-review | fast | SKILL.md + spec file + shared/spec-io.md |
| plan-tests | fast | SKILL.md + spec file + shared/spec-io.md |
| write-failing-test | inherit | SKILL.md + spec file + shared/spec-io.md + project AGENTS.md |
| implement-to-pass | inherit | SKILL.md + spec file + shared/spec-io.md + shared/security-lens.md + project AGENTS.md |
| implement-direct | inherit | SKILL.md + spec file + shared/spec-io.md + shared/security-lens.md + shared/github-ops.md + project AGENTS.md |
| qa-handoff | fast | SKILL.md + spec file + shared/spec-io.md + shared/github-ops.md |
| diagnose | inherit | SKILL.md + shared/spec-io.md + shared/github-ops.md + project AGENTS.md |
| 1-security-audit | inherit | SKILL.md + project AGENTS.md |
| 2-security-critique | inherit | SKILL.md + SECURITY_PLAN.md |
| 3-security-spec | inherit | SKILL.md + SECURITY_PLAN.md + project AGENTS.md |
| 4-security-fix | inherit | SKILL.md + SECURITY_PLAN.md + project AGENTS.md |
Model column = defaults, not hard rules. Use your judgment:
fast = cheapest/fastest available (Haiku in Claude Code, fast model in Cursor)inherit = same model as the manager conversationSkills invoked directly (they need extensive human interaction, can't run as fire-and-forget):
| Skill | Why direct |
|-------|-----------|
| interview | Needs extensive back-and-forth conversation with the human |
Note: diagnose used to be here but is now a sub-agent. The manager handles
bug triage (gathering context from human + reading the issue), then dispatches
the diagnose sub-agent with pre-filled context for autonomous code investigation.
See Bug Path for the triage → dispatch → review flow.
When a skill needs direct invocation, tell the human: "This needs your input. Starting /interview #42 now." Then invoke the skill (use the Skill tool in Claude Code, or read and follow the SKILL.md in Cursor). Do NOT present options — just start.
Critical: pass file paths, not file content. Sub-agents read their own inputs. This keeps the manager context clean and lets sub-agents work with the latest file state.
When dispatching a sub-agent, use this structure (in Claude Code this goes to the Task tool prompt; in Cursor the agent definitions at ~/.claude/agents/ handle the wiring — just dispatch by name):
You are executing the {skill_name} skill.
## Your Task
{Brief description of what to do}
## Files to Read
Read these files before starting work:
- Skill instructions: {path to skill's SKILL.md}
- Spec: {spec_path} (if applicable)
- Spec I/O reference: {path to shared/spec-io.md} (if skill uses specs)
- GitHub ops reference: {path to shared/github-ops.md} (if skill uses GitHub)
- Project context: {path to project AGENTS.md}
## Inputs
- Spec path: {spec_path}
- Issue: #{issue_number} (if applicable)
## Constraints
- Read the skill instructions first, then follow them exactly
- Do not add features beyond the spec
- Fail loudly if something is wrong
- Write all outputs to files (spec updates, test files, code)
- Read the Security Considerations section of the spec. Follow `shared/security-lens.md` patterns for any auth/RLS/edge function/input validation work
- Before reporting done, re-read the acceptance criteria from the spec
- For each criterion, assess: ✅ satisfied / ⚠️ partially satisfied or unsure / ❌ not satisfied
- Include a 🔒 Security line in your satisfaction assessment (see `shared/security-lens.md` Review-Time section)
- Be honest — flag anything you couldn't verify or are uncertain about
- When done, report: what you did, what files changed, satisfaction assessment, current artifact state
## Testing Requirements (Before Reporting Done)
- Run the test suite: `npm test` (or relevant command for the project)
- Manually test the feature in the app:
- Happy path (primary user flow)
- Error cases (what happens when things go wrong)
- Edge cases (from falsification questions in spec, if present)
- Record what you tested and the results in your completion report
- If you cannot verify something, flag it clearly in satisfaction assessment
- Quick fixes require full testing too — no shortcuts for "small changes"
- Reference `shared/testing-standards.md` for QA handoff template and detailed guidance
For bug investigation, the manager does triage first (reads issue, asks user questions), then dispatches with pre-filled context. Use this variant instead of the generic template:
You are investigating a bug.
## Bug Context (from manager triage)
- **Issue:** #{issue_number} (or "untracked")
- **Actual behavior:** {what_happens}
- **Expected behavior:** {what_should_happen}
- **Reproduction:** {steps}
- **Started:** {when}
- **Environment:** {details}
## Files to Read
- Skill instructions: ~/.claude/skills/diagnose/SKILL.md
- Spec I/O reference: ~/.claude/skills/shared/spec-io.md
- GitHub ops: ~/.claude/skills/shared/github-ops.md
- Project context: {AGENTS.md path}
## Constraints
- Do NOT ask the user questions — all context is above
- Investigate the codebase: search for the code path, check git history, find root cause
- Write a bug spec to Documents/specs/
- Return: root cause summary, files involved, draft spec path, satisfaction assessment
Before dispatching, tell the human what you're doing:
📤 Dispatching: spec-review
Input: Documents/specs/42-dark-mode-spec.md
Reading: spec-review/SKILL.md, shared/spec-io.md
After sub-agent returns, report the result. For implementation skills, include the satisfaction assessment:
📥 spec-review complete
Result: 3 gaps found (missing non-goals, vague criterion #4, no error states)
Files changed: none (read-only skill)
Next: [GATE A] Your approval needed
📥 implement-direct complete
Files changed: QuoteForm.tsx, useQuotePrice.ts
Satisfaction:
✅ Price updates on service change
✅ Notary fee displays separately
⚠️ Hourly rate message — implemented but copy may not match spec
✅ Total reflects all line items
🔒 Security: RLS policies added for new table, input validated
Next: [GATE B] Your review — 1 item flagged
shared/github-ops.md for posting patternsGate A (after spec-review):
Spec review complete. Here's the assessment:
{summary from spec-review sub-agent}
Your decision:
1. Approve — and choose: TDD or Direct implementation?
2. Revise — I'll update the spec based on your feedback
Gate B (after implementation):
Implementation complete. {summary}
{satisfaction assessment with any ⚠️ flags}
Your decision:
1. Looks good — I'll update GitHub issue #{number} and proceed to QA handoff
2. Changes needed — describe what to fix
Gate C (after security critique):
Security backlog ranked. {summary of top items}
Your decision:
1. Proceed — start fixing from the top
2. Reprioritize — tell me what to change
Check these in order. First match tells you where you are and what to do.
| # | Check | If true | Do this |
|---|-------|---------|---------|
| 1 | SECURITY_PLAN.md exists with Pending or Ranked items? | Yes | You're in the security path. See Security Decision Tree below. |
| 2 | User mentions a bug, error, or issue to investigate? No bug spec exists yet? | Yes | Enter Bug Path. Start triage, then dispatch diagnose sub-agent. |
| 3 | No spec file in Documents/specs/? | Yes | Nothing started. Run /interview directly (with issue number if you have one). |
| 4 | Spec exists, status is Draft? | Yes | Spec needs review. Dispatch spec-review sub-agent. |
| 5 | Spec status is Approved, no ## Test Plan section? | Yes | [Human Gate A passed.] Ask: TDD or Direct? Then dispatch accordingly. |
| 6 | Test Plan section exists, status is Planned? | Yes | Dispatch write-failing-test sub-agent. |
| 7 | Test Plan.status is Tests Written? | Yes | Dispatch implement-to-pass sub-agent. |
| 8 | Spec status is Implemented? | Yes | [Human Gate B] Ask human to review PR. |
| 9 | Test Plan.status is Passing? | Yes | [Human Gate B] Ask human to review PR. |
| 10 | Bug spec exists in Documents/specs/ with Approved status? | Yes | Ask: TDD or Direct? Then dispatch accordingly. |
| 11 | None of the above match | — | Check git log and the GitHub issue for context. Or start fresh with /interview. |
State is derived from observable artifacts — no separate state file. Skills declare which artifact they use via state_source in their contract.
Location: Documents/specs/{issue}-{slug}-spec.md
Used by: All feature-path and bug-path skills.
How to read: See shared/spec-io.md.
| Field | Where in file | Values | Who sets it |
|-------|---------------|--------|-------------|
| status | Header **Status:** line | Draft, Approved, Implemented | interview creates as Draft. Human sets Approved after spec-review. implement-direct sets Implemented. |
| Test Plan.status | ## Test Plan section **Status:** line | Planned, Tests Written, Passing | plan-tests → write-failing-test → implement-to-pass |
| issue_number | Header **Issue:** line | integer | interview |
Location: Project root Used by: Security-path skills (phases 1–4).
| Field | Meaning | Values | Who sets it |
|-------|---------|--------|-------------|
| findings | Initial scan results | Pending | 1-security-audit |
| backlog | Prioritized list | Ranked | 2-security-critique |
| current_item.test | Test for top item | Written | 3-security-spec |
| current_item.status | Fix status for top item | DONE | 4-security-fix |
Managed via gh CLI. See shared/github-ops.md for all operations. Also the state source for the bug path — diagnose reads and writes state here when no spec exists.
| Status | Meaning | Set by |
|--------|---------|--------|
| Backlog | Created, not scheduled | interview (asks user) |
| Ready | Spec approved, waiting | User or diagnose |
| In Progress | Being implemented | User |
| In Review | PR open | implement-to-pass or implement-direct |
| QA | Needs manual testing | qa-handoff |
| Done | Merged | User |
All skills. Scannable by tag. The Next column is what's valid after a skill completes.
| Skill | Tags | State Source | Human Gate After? | Next |
|-------|------|--------------|-------------------|------|
| interview | intake, requirements, spec-creation, github | spec | No | spec-review |
| spec-review | intake, review, quality-gate | spec | YES (Gate A) | plan-tests, implement-direct |
| plan-tests | tdd, test-planning | spec | No | write-failing-test |
| write-failing-test | tdd, testing, red-phase | spec | No | implement-to-pass |
| implement-to-pass | tdd, implementation, green-phase | spec | YES (Gate B) | qa-handoff |
| implement-direct | implementation, direct | spec | YES (Gate B) | qa-handoff |
| diagnose | bug, diagnosis, investigation, spec-creation | github_issue | No | plan-tests, implement-direct |
| qa-handoff | closure, qa, github | spec | No | (terminal) |
| 1-security-audit | security, audit, security-phase-1 | security_plan | No | 2-security-critique |
| 2-security-critique | security, audit, security-phase-2 | security_plan | YES (Gate C) | 3-security-spec |
| 3-security-spec | security, audit, security-phase-3, tdd | security_plan | No | 4-security-fix |
| 4-security-fix | security, audit, security-phase-4, implementation | security_plan | No | 3-security-spec (loop) |
| full-security-audit | security, orchestrator | security_plan | No | 1-security-audit |
| supabase-security | security, reference | — | No | (reference only) |
| review-audit | review, audit, verification, quality-gate | — | No | (reference only) |
Find skills by capability, not name.
| Tag | Skills |
|-----|--------|
| intake | interview, spec-review |
| requirements | interview |
| review | spec-review, review-audit |
| quality-gate | spec-review, review-audit |
| verification | review-audit |
| tdd | plan-tests, write-failing-test, implement-to-pass, 3-security-spec |
| testing | write-failing-test |
| red-phase | write-failing-test |
| green-phase | implement-to-pass |
| test-planning | plan-tests |
| implementation | implement-to-pass, implement-direct, 4-security-fix |
| direct | implement-direct |
| bug | diagnose |
| diagnosis | diagnose |
| closure | qa-handoff |
| qa | qa-handoff |
| github | interview, qa-handoff |
| security | 1-security-audit, 2-security-critique, 3-security-spec, 4-security-fix, full-security-audit, supabase-security |
| spec-creation | interview, diagnose |
| investigation | diagnose |
| audit | 1-security-audit, 2-security-critique, 3-security-spec, 4-security-fix |
Mechanical step-by-step. Follow top-to-bottom. Conditions check state model fields above. Each step says what to invoke and with what arguments.
STEP 1: Spec exists?
NO → invoke /interview directly → STEP 2
YES → STEP 2
STEP 2: Spec status?
Draft → dispatch spec-review sub-agent → STEP 3
Approved → STEP 4
STEP 3: [HUMAN GATE A] Spec review complete.
STOP. Present findings to human.
"Approved, TDD" → set spec status to Approved → STEP 4
"Approved, Direct" → set spec status to Approved → Direct Path STEP 4
"Revise" → back to STEP 1
STEP 4: Test Plan section exists?
NO → dispatch plan-tests sub-agent → STEP 5
YES → read Test Plan.status → STEP 5
STEP 5: Test Plan.status?
Planned → dispatch write-failing-test sub-agent → STEP 6
Tests Written → STEP 6
Passing → STEP 7
STEP 6: dispatch implement-to-pass sub-agent → STEP 7
STEP 7: [HUMAN GATE B] Implementation complete.
STOP. Human reviews PR.
"Approved" → STEP 8
"Changes" → human edits → STEP 6
STEP 8: dispatch qa-handoff sub-agent
DONE.
STEP 1–3: Same as TDD path.
STEP 4: dispatch implement-direct sub-agent
STEP 5: [HUMAN GATE B] Verify manually.
STOP. Human tests the feature.
"Looks good" → STEP 6
"Broken" → back to STEP 4
STEP 6: dispatch qa-handoff sub-agent
DONE.
STEP 1: Bug triage (manager does this in-conversation)
a. If issue number provided, read it: `gh issue view #N`
b. Ask the human (skip any already answered by the issue):
- What's actually happening?
- What should happen?
- How to reproduce?
- When did it start?
- Environment?
c. Dispatch diagnose sub-agent with triage context → STEP 2
STEP 2: Diagnose sub-agent returns
Review findings and draft bug spec.
Present to human: "Here's what the investigation found: {summary}"
Confirm spec is accurate.
If tracked in GitHub → post diagnosis comment (with user confirmation).
NOTE: diagnose generates a bug spec (status: Approved).
Bug specs skip the interview/review cycle.
STEP 3: [Human chooses path]
TDD → dispatch plan-tests sub-agent → continue with TDD Feature Path STEP 5+
Direct → dispatch implement-direct sub-agent → continue with Direct Feature Path STEP 5+
STEP 4: Bug tracked in GitHub?
YES → dispatch qa-handoff sub-agent
NO → DONE.
STEP 1: dispatch 1-security-audit sub-agent
Creates SECURITY_PLAN.md with findings as Pending.
STEP 2: dispatch 2-security-critique sub-agent
Removes false positives, ranks items.
STEP 3: [HUMAN GATE C] Backlog ranked. Human reviews priorities.
STOP. Present ranked backlog to human.
"Looks right" → STEP 4
"Reprioritize" → human edits → STEP 2
STEP 4: [LOOP CHECK] Pending items in ranked backlog?
NO → DONE. All items fixed or acknowledged.
YES → STEP 5
STEP 5: dispatch 3-security-spec sub-agent
Picks top Pending item. Writes failing test.
STEP 6: dispatch 4-security-fix sub-agent
Implements fix. Marks item DONE.
→ back to STEP 4
Three mandatory approval points across all paths. The manager must STOP at these. Do not auto-proceed.
| Gate | After skill | Before skill | Human decides | |------|-------------|--------------|---------------| | Gate A | spec-review | plan-tests / implement-direct | "Approve spec and choose TDD or Direct" or "Revise" | | Gate B | implement-to-pass / implement-direct | qa-handoff | "PR looks good, proceed" or "Changes needed" | | Gate C | 2-security-critique | 3-security-spec | "Ranked backlog looks right, proceed" or "Reprioritize" |
Rules the manager enforces. A skill violating these should not be invoked.
plan-tests, write-failing-test, implement-to-pass, implement-direct all require status: Approved. Never invoke them on a Draft spec.write-failing-test requires Test Plan.status: Planned. implement-to-pass requires Tests Written. Cannot skip or reorder.state_source: security_plan. They don't read or write spec files. They don't participate in feature or bug paths.qa-handoff is terminal. Nothing follows it. Workflow is complete after qa-handoff runs.diagnose generates a lightweight bug spec with status Approved. Bug specs skip interview/review and flow directly into TDD or direct implementation.Referenced by multiple skills. Not skills themselves — reference docs.
| File | Used by | What it covers |
|------|---------|----------------|
| shared/github-ops.md | interview, diagnose, implement-direct, implement-to-pass, qa-handoff | All gh CLI patterns: comments, status, project board, PR linking |
| shared/spec-io.md | interview, plan-tests, write-failing-test, implement-direct, qa-handoff, spec-review | Spec file structure, sections, status fields, how to read/write |
| shared/security-lens.md | interview, implement-direct, implement-to-pass, spec-review | Design-time security questions, implementation patterns, review checklist |
testing
Write failing tests for all planned acceptance criteria from the test plan. Use after /plan-tests, before implementation. Invoke with '/write-failing-test path/to/spec.md' or 'write failing test', 'red phase', 'start TDD'.
tools
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
development
Supabase security best practices and patterns. Use when working with Supabase projects, creating tables, writing RLS policies, edge functions, or reviewing Supabase code. Invoke with '/supabase-security' or when asked about Supabase security.
testing
Review a spec document for completeness before approval. Use after interview, before implementation, or when asked to 'review spec', 'check spec', or 'is this spec ready'. Read-only analysis that flags gaps.