lewibs/dark-factory/phase-enum-sub-agent

Claude Code and agent skill by lewibs/dark-factory

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

How to implement a single worker sub-agent that accepts a phase enum to handle multiple distinct jobs, avoiding proliferation of narrow one-job sub-agents.

Install

npx vskill@latest install lewibs/dark-factory/phase-enum-sub-agent

SKILL.md

The same SKILL.md was published earlier as lewibs/dark-factory/phase-enum-sub-agent.

When to use

When an orchestrator needs to dispatch work across several sequential phases (e.g., draft, diagram, flows) and each phase does a different type of work (research+write, run-script, edit-section), instead of creating a separate agent file per phase, create one worker agent that branches on a phase input field.

Use this when:

  • There are 2–5 phases, each with a distinct action but sharing a common artifact (e.g., a plan file path).
  • The phases are always executed by the same orchestrator in the same order.
  • You want one AGENT_CHECKLISTS entry and one agent .md file to maintain.

Do NOT use this if phases require fundamentally different tools lists (e.g., one phase needs network access that others must not have) — in that case, separate agents with separate tools: declarations are safer.

Steps

  1. Define a Phase enum in the plan's Global Types section:

`` Phase = "phase_a" | "phase_b" | "phase_c" ``

  1. Define a single WorkerInput type with `phase` as required:

`` WorkerInput { phase: Phase (required) artifactPath: string | null (null on first call of phase_a) feedback: string (user feedback or "none") <phase-specific fields>: string | null (null when not applicable) } ``

  1. In the worker agent `.md`, branch explicitly on `phase` at the top level:

``` ## Phase: phase_a When phase == "phase_a": ...

## Phase: phase_b When phase == "phase_b": ...

## Phase: phase_c When phase == "phase_c": ... `` Do not use if/else chains inside a single section — one ##` heading per phase keeps the agent prompt scannable.

  1. Each phase section must stand alone — it should not reference state from a previous phase invocation. The orchestrator passes all needed context through WorkerInput each time.
  1. Define a unified WorkerOutput that covers all phases:

`` WorkerOutput { artifactPath: string (always present — path to written/updated artifact) url: string | null (only for phases that produce a URL; null otherwise) summary: string (always present — short description of what was done) } ` Use null` for fields that don't apply to a given phase rather than omitting them — this keeps the orchestrator's parsing logic simple.

  1. Pass phase-specific fields as null when not applicable. For example, if only phase_c uses flowName, pass flowName: null for phase_a and phase_b invocations. Document this in the input type definition.
  1. Register one checklist entry in `pre-tool-use-hook.sh` that covers the superset of steps across all phases:

``bash AGENT_CHECKLISTS["<worker-name>"]="Research phase context|Update artifact file|Run script (<phase_b> only)|Return structured output" ``

Notes

  • The worker must always write the artifact file — never return content for the caller to save. The worker owns the file. The orchestrator only reads it after the worker has written it. This avoids a class of bugs where the caller forgets to write or writes to the wrong path.
  • `feedback: "none"` is a valid sentinel — the worker should check if feedback != "none": apply changes rather than checking for null. This avoids null-handling branches in the worker prompt.
  • Keep phase sections short. If a phase section grows beyond ~15 lines of pseudocode, consider whether it belongs in a nested sub-agent (e.g., investigation-agent) rather than inline in the worker.
  • The canonical reference implementation is agents/featurework/planning/agents/sub-planning-agent.md with phases draft_plan, mermaid, and flows.

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/lewibs/dark-factory/phase-enum-sub-agent/badge)](https://verified-skill.com/skills/lewibs/dark-factory/phase-enum-sub-agent)

Something wrong with this skill or its page? Tell us.