plugins/handsonai/skills/deconstruct/SKILL.md
This skill should be used when the user wants to deconstruct a workflow, break down a business process, capture requirements for an AI workflow, or define a goal for an agent system. Step 2 is the PRD for the workflow — it captures what the workflow must do, the rules it must follow, and the edge cases it must handle, in clear requirements language suitable for the Design step or any AI model to consume. Supports two paths: step-decomposed (you know how the work gets done) and goal-driven (you know what "done" looks like and want an agent system to determine the path). Produces a structured Workflow Requirements document. This is Step 2 of the AI Workflow Framework.
npx skillsauth add jamesgray-ai/handsonai-plugins deconstructInstall 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.
Step 2 is the PRD for the workflow. It captures what the workflow must do and the rules it must follow — not how AI building blocks will deliver it (that's Step 3, Design).
The output is a Workflow Requirements document written in clear, concise requirements language. It must be self-contained enough that a reader who never saw this conversation — including the Design skill or any agent model — can act on it without re-interviewing the user.
Step 2 has two paths, mapped directly to the two ways students think about a workflow:
| Path | When to use | Mental model | |------|-------------|--------------| | Step-decomposed | You can describe how the work gets done | "I know the steps" | | Goal-driven | You know what "done" looks like, but the work takes different steps depending on what comes in — so you give an agent system a goal and let it figure out the steps at runtime | "I know the goal" |
Both paths produce a Workflow Requirements document with the same shared shell — only the middle "what does the workflow do" block differs.
What "goal" means here. An agent goal is a deliverable with a completion state — something you can look at after a single run and verify is done. It is not a business objective or an impact metric: "higher revenue" is a business objective (record it in Metadata → Business Objective); "a ranked list of 20 qualified prospects matching our ICP, with contact info" is an agent goal. The goal bundles the deliverable plus the rules and acceptance criteria for it — what major agent frameworks call the expected output and success criteria. (If you know the product-management "outcomes over outputs" framing: the agent's goal is closer to an output — the business outcome belongs in Business Objective.) The defining trait of this path is who owns the control flow: the agent decides the path to the goal at runtime, while you own the definition of done. Note the inverse doesn't hold — a step-decomposed workflow can still use an agent for an individual step; what makes a workflow goal-driven is that the agent decides the overall sequence, not merely that agents are involved.
Which path? (quick heuristic — share this with the user when they're unsure). The test: imagine two different inputs — would the work take noticeably different steps?
Worked example: "Generate my weekly status report from the same three sources" → step-decomposed (same recipe every run). "Triage whatever lands in my inbox and handle each appropriately" → goal-driven (a refund request, a partnership pitch, and spam each take a completely different sequence of steps). Getting this right matters: the choice selects the document template the Design step parses, so a wrong pick creates rework downstream.
Scenario discovery — Determine how the user is arriving and which path to take.
From Analyze output: If the user references an opportunity report, file path (e.g., outputs/ai-opportunity-report.md), or a specific workflow candidate from an Analyze session, read the Workflow Candidate Summary from the file. Present the available candidates and ask which one to deconstruct. Pre-populate scenario metadata (name, description, trigger, deliverable, autonomy, involvement) from the candidate fields. If the candidate includes a Lens field, carry it forward along with any Business Objective, Stakeholders, and Success Metrics fields. Confirm the pre-populated details with the user. Then choose the path: if the candidate's autonomy = Autonomous, suggest goal-driven but still confirm. Otherwise present the choice below.
Cold entry (no Analyze output): Ask one question:
"Do you know the steps, or just the goal? (Quick test: imagine two different inputs — would the work take the same steps, or different steps?)
- Step-decomposed — The work runs the same way each time and you can describe how it gets done. I'll interview you to refine the steps and surface decision rules and edge cases.
- Goal-driven — You can't list the steps, but you can describe the deliverable — what "done" looks like — and want an agent system to figure out the steps. A goal here is a concrete deliverable, not a business result: "a ranked list of 20 qualified prospects" is a goal; "higher revenue" is why you want it. I'll capture the goal, inputs, acceptance criteria, and rules."
Problem-first handling (no separate path): If the user says they don't have a process or a goal — just a problem ("People drop off during onboarding and I don't have a way to follow up") — propose a candidate workflow based on what they describe, then route into one of the two paths:
"Here's a candidate workflow that would solve this: [outline]. Do you want to refine these steps with me (step-decomposed), or just describe the goal and let an agent figure out the steps (goal-driven)?"
After the path is chosen, gather scenario details:
Scope check — one trigger, one deliverable — A workflow has exactly one trigger (what kicks it off) and one deliverable (the tangible output). Test for multiple workflows by checking:
If multiple workflows are detected: map out each one (working name, trigger, deliverable), present the breakdown, confirm boundaries with the user, and ask which to deconstruct first. Proceed with only the chosen workflow.
Name the workflow — Present 2-3 name options. Naming conventions: a 2-4 word noun phrase in Title Case, self-explanatory without context (e.g., "Lead Qualification", "Newsletter Distribution", "Student Onboarding"). Prefer [Subject] [Action] patterns — "Invoice Generation", "Inbox Triage" — over verb phrases or vague labels. Confirm name, description, goal, and trigger.
Derive the workflow ID. Convert the confirmed name to kebab-case (lowercase, hyphens, no punctuation — "Lead Qualification" → lead-qualification) and confirm it with the user: "I'll use lead-qualification as the workflow ID — it names the folder and files for everything we produce." This ID is the single source of truth for all artifact paths; every downstream skill uses it verbatim.
Deep dive (step-decomposed only) — Before probing the first step, briefly frame what "context" means: "As we go through each step, I'll ask about the context it needs. Context is any data or information the step requires to do its job — that includes databases and spreadsheets, but also documents, transcripts, emails, style guides, SOPs, or even knowledge that currently lives in someone's head. If the step needs it, it's context."
Work through each step using the 6-question framework. Ask one question at a time, adapt to the user's answers, and skip dimensions already well-covered — this is a scaffold for you, never a checklist to read aloud at the user. These six dimensions shape what to ask, not how the spec is structured. Your job is to gather enough signal across all six to write the per-step requirements block (Goal / Inputs / Outputs / Rules & Edge Cases / Context Needed) in Step 10.
When probing context needs, push beyond vague answers — identify the specific artifact. For any step where AI is already being used, ask specifically for existing prompt instructions, project instructions, or system prompts — these contain workflow logic that must be included in the Baseline Prompt.
Propose and react (step-decomposed only) — After the first step of the deep dive, switch to propose-and-react: propose a hypothesis across all dimensions (including context readiness and role transitions for organizational workflows) and ask "What's right, what's wrong, what am I missing?" instead of asking each question individually. Include a context readiness hypothesis: "I think this context lives in [location] and is in [format] which AI can interpret. Is that right?"
Map sequence (step-decomposed only) — After all steps, identify sequential vs. parallel steps and the critical path.
Optimize for AI (step-decomposed only) — Now that the full process is mapped, step back and challenge it. The user described their current process — but an AI-powered version may not need every step. Present optimization recommendations for the user to react to. Look for:
Present as a propose-and-react summary:
"Now that we've mapped the full process, here's how I'd optimize it for AI:
- Eliminate: [step(s)] — [reason, e.g., 'direct access to your CRM data replaces the manual export']
- Collapse: [step(s)] into one — [reason, e.g., 'AI drafts and formats in a single pass']
- Parallelize: [step(s)] — [reason, e.g., 'no data dependency between these']
- Simplify: [handoff/gate] — [reason, e.g., 'AI evaluation replaces manual QA, human reviews final output only']
- Add: [new step] — [reason, e.g., 'need an explicit context-loading step for data the human carried in their head']
These are recommendations — you may have reasons to keep steps as-is (compliance, audit trail, stakeholder expectations). What looks right, and what should stay?"
Update the refined steps based on the user's confirmed optimizations. Renumber if steps were added, removed, or merged. If the user rejects all optimizations, that's fine — proceed with the original steps.
Validate the workflow (step-decomposed only) — Before consolidating context, walk through the refined workflow end-to-end and present a validation summary. This is the quality gate that catches gaps before the workflow moves to Design. Check for:
Present as a validation summary:
"Let me validate the workflow before we finalize it. Walking through the end-to-end flow, here's what I found:
- [Finding type]: [specific gap, e.g., 'Step 3 produces a draft but Step 4 expects a formatted document — is there an implicit formatting step?']
- [Finding type]: [specific gap]
- No issues found in: [dimensions that checked out]
Which of these need to be addressed?"
Update refined steps based on the user's responses. If no issues are found, say so and proceed.
Consolidate context — Present a rolled-up "context inventory" of every piece of context the workflow needs — documents, data, rules, examples, and any other knowledge from the user's domain that the model doesn't have.
For step-decomposed workflows: assemble from per-step context needs gathered in Step 4. For goal-driven workflows: assemble from the Inputs + Context Sources gathered in Step 4-GD.
Collect Acceptance Criteria and Example Scenarios (both paths) — Before generating the Workflow Requirements, ask the user about acceptance criteria and example scenarios. These were previously collected during Design's Step 8b; capturing them here makes Step 2 a complete PRD and removes redundant questioning downstream.
Ask, one at a time:
For goal-driven workflows, Step 4-GD does not pre-collect full acceptance criteria — this step is the single place acceptance is captured, so ask the questions that remain unanswered directly. Two harvests from Step 4-GD feed this step: for question 4, harvest the scenarios from the variation envelope (the typical and edge cases the user already described); for questions 1–3, seed from the rejection-test answers (the plausible-but-wrong outputs the user said they'd send back). Confirm and fill gaps rather than re-eliciting from scratch.
Generate Workflow Requirements — Produce the structured Workflow Requirements document and write it to the output file. See the Output section below for the template, writing style, and machine-readability rules.
Self-check before finishing (so Design can parse it). After writing, verify the file against the machine-readability rules and fix any miss before handing off:
outputs/[workflow-name]/requirements.md (e.g., "Inbound Lead Triage" → outputs/inbound-lead-triage/requirements.md), and workflow.yaml exists alongside it with current_step: 2 and the requirements path registered.1,2,3…; context C1,C2…; scenarios E1,E2…).When the user selects goal-driven, run this interview instead of the step-decomposed deep dive (Steps 4–8). The goal-driven path handles context discovery internally (question 8, Context & Data Sources), so it skips straight to Step 9 (Consolidate Context) → Step 10 (Acceptance Criteria) → Step 11 (Generate) after the interview. Same interview principles apply: one question at a time, propose-and-react after the first few answers, push beyond vague answers. If scenario discovery (Step 1) already captured the situation, trigger, or consumer, build on those answers — confirm and deepen rather than re-asking from scratch.
Open with a frame so the user knows what this path asks of them (parallel to the context frame the step-decomposed path opens with):
"This path is for when you know what you want but not the exact steps — you don't need to map anything out. You'll give the agent system a goal — a concrete deliverable it produces each run — plus the rules it has to follow, and I'll handle the structure. Let's start with the situation."
Scenario (ground before sharpening): "Tell me about the situation — what's going on, what kicks this off, and what are you trying to get done?" Plain language; no precision demanded yet. This grounds the trigger, the consumer, and the business context before the goal is sharpened. Note any business objective the user states ("we need more pipeline") — it goes in Metadata → Business Objective, not in the goal.
Goal (natural, then reflect back): "Now the result: when a run works well, what do you walk away with? Talk like you're describing it to a colleague — don't worry about being precise." Then reflect back a structured restatement that covers all three of format, structure, and scope — plus who consumes it — and names the completion state: "So the goal is roughly [restatement], and a run is done when [completion state]. Did I get that right, or what's off?" The reflect-back is where the rigor lives; don't drop any of format/structure/scope. If the user struggles, offer a vague-vs-sharp calibration example (e.g., "'Help me with prospecting' is a start — what I'm after is more like 'a ranked list of 20 qualified prospects matching our ICP, with contact info and a one-line fit rationale, every Monday'").
Goal pressure-test (challenge before accepting): After the reflect-back, test the goal — don't just record it. Apply whichever of these three tests the answer hasn't already passed, state which test failed and why when pushing back, and cap the challenge at 2–3 probes (interview, not interrogation):
If the user's first answer in question 2 is purely metric-shaped (no deliverable at all), skip the reflect-back and go straight to the level test. If the probe cap is reached and the goal is still untestable, switch from asking to proposing: draft a sharp candidate goal yourself from everything heard so far and ask the user to confirm or correct it — never proceed to question 4 with a goal that fails the done/not-done test.
Variation envelope: "This works as goal-driven because the work takes different steps depending on what comes in. What's the range it needs to handle? Give me the typical case, and a couple of the awkward or harder ones." These answers become the Example Scenarios in Step 10 — capture them now and harvest them there; don't re-elicit scenarios later. Misroute check: if the answer reveals the work actually takes the same steps every time (no meaningful variation), say so and offer to switch: "This sounds like it runs the same way each run — the step-decomposed path would capture it better. Want to switch?" Carry everything gathered so far into the step-decomposed deep dive rather than restarting.
Inputs: "What kicks it off, and what does the agent system get to work with — data, documents, access?" (Confirm against what the scenario already established rather than re-asking.)
Rules & Constraints: "What boundaries or guardrails apply? Things the agent must always do, must never do, or limits on scope, sources, tone, length."
Fallback behavior: "When it hits a case it can't confidently handle — missing info, something ambiguous — what should it do? Stop and ask you, make its best attempt and flag it, or skip that item?" This is the agent's behavior on unplanned exceptions — distinct from the planned pauses captured under Human gates. Record it under Rules & Constraints in the output. If the answer is "stop and ask," also capture it as a Human Gate (question 9) so the pause appears where Design looks for review points.
Context & Data Sources: "What external systems, data sources, documents, or reference materials should the agent system have access to?" Apply the same context readiness probing as the step-decomposed path (sample — ask the one or two probes that matter, don't run all three mechanically):
Human gates: "Where should the agent system pause for human review? Or run end-to-end with final review only?"
Scope check: Same one-trigger-one-deliverable test as Step 2 — confirm the goal hasn't expanded into multiple workflows.
Do NOT ask about capability domains, agent count, model class, tools, or orchestration approach. Those are Design decisions. Goal-driven Deconstruct stays in "what" territory: goal, inputs, acceptance criteria, rules, context, human gates.
Step 8-GD — Validate before consolidating (goal-driven quality gate). Step-decomposed has a Step 8 validation gate; goal-driven needs the equivalent so a vague goal or missing guardrails doesn't sail through to Design. Walk the definition end-to-end and present a short validation summary covering:
Present as: "Before I finalize, here's a quick check of your goal-driven definition: [findings]. Which of these should we tighten?" Update based on the user's answers. If all clear, say so and proceed.
After completing the interview and Step 8-GD, proceed directly to Step 9 (Consolidate Context) → Step 10 (Acceptance Criteria) → Step 11 (Generate Workflow Requirements) using the goal-driven output format.
Write the Workflow Requirements to outputs/[workflow-name]/requirements.md where [workflow-name] is the kebab-case workflow ID confirmed in Step 3 (e.g., outputs/lead-qualification/requirements.md). Create the folder if it doesn't exist.
Deconstruct creates the workflow's manifest — a small workflow.yaml in the workflow folder that tracks state and artifact paths so any framework skill (or a fresh session) can pick up where things left off:
workflow: lead-qualification # kebab-case ID — names the folder and all artifacts
display_name: Lead Qualification
definition_type: Step-Decomposed # or Goal-Driven (legacy files may say Outcome-Driven — treat as Goal-Driven)
current_step: 2 # last completed framework step (1-7)
last_updated: YYYY-MM-DD
artifacts:
requirements: outputs/lead-qualification/requirements.md
# downstream skills append:
# design_spec, platform_artifacts (list), test_results,
# run_guide, run_log, improvement_plan
# run also sets a top-level key: next_review: YYYY-MM-DD
Conventions every framework skill follows (stated here once; downstream skills apply them):
current_step, last_updated, and add your artifact path under artifacts.requirements-2026-06-10.md) before writing.outputs/[name]-requirements.md do, use those paths, and offer to migrate them into a folder + manifest before proceeding.The output reads like a PRD, not an interview transcript. Enforce:
~ for "approximately" — two tildes in one paragraph render as ~~strikethrough~~. Write "approximately"/"about" (e.g., "about 1–2 pages", "150–250 words"), or keep ~ only inside code spans/backticks.So Design (and any agent model) can parse the document without re-asking:
Step-Decomposed or Goal-DrivenIndividual or OrganizationalExists or Needs CreationYes, Partial, or No1, 2, 3, …; ID context items C1, C2, C3, …; ID example scenarios E1, E2, E3, …. Downstream artifacts reference these IDs.# [Workflow Name] — Workflow Requirements
## Goal
[One paragraph: what a successful run produces, when it runs, who consumes the output.]
## Metadata
| Field | Value |
|---|---|
| Workflow Name | [name] |
| Description | [short description] |
| Trigger | [what kicks the workflow off] |
| Owner | [person or role] |
| Lens | Individual / Organizational |
| Definition Type | Step-Decomposed / Goal-Driven |
| Business Objective | [why this workflow matters — optional but recommended] |
For organizational lens, also include:
| Stakeholders | [roles/teams involved] |
| Success Metrics | [KPIs for measuring improvement] |
---
[INSERT THE STEP-DECOMPOSED BLOCK OR THE GOAL-DRIVEN BLOCK HERE — see below]
---
## Context Inventory
| ID | Artifact | Used By | Status | AI Accessible | Location / Source | Key Contents |
|---|---|---|---|---|---|---|
| C1 | [name] | [Step IDs or "All"] | Exists / Needs Creation | Yes / Partial / No | [path, URL, system name, or "Create as [path]"] | [what's in it] |
Notes:
- For items with `Status: Needs Creation`, the Location column captures where the artifact should be persisted — AI must be able to reach it.
- For organizational workflows, include existing process documentation here: SOPs, training guides, compliance requirements, SLAs.
## Acceptance Criteria
### What good output looks like
[Concrete description in plain language — what would make the user say "this is exactly right"?]
### Dimensions that matter
- [Dimension] — [what to evaluate]
- [Dimension] — [what to evaluate]
### Minimum bar
[What's acceptable vs. what needs more work — in plain terms, not a numeric threshold.]
## Example Scenarios
| ID | Scenario | Input | What to look for in the output | Golden Example |
|---|---|---|---|---|
| E1 | [short name] | [description] | [what makes this output "good"] | [Context Inventory ID, short inline excerpt, or "—"] |
| E2 | … | … | … | … |
Golden Examples are optional but high-value — Test (Step 5) compares actual output against them instead of relying on gut-feel scoring alone. Use "—" when none exists.
## Human Gates
| Where | What requires human input |
|---|---|
| [step ID or phase] | [decision, approval, review] |
If no human gates are required, write: "No human gates — the workflow runs end-to-end with final review only."
## Optimization Notes (optional, step-decomposed only)
[Brief record of what changed from the original process and why — only if optimizations were applied in Step 7. Include declined optimizations and the reasoning, since this preserves context for Design.]
Insert between the Metadata table and the Context Inventory:
## Steps Overview
1. [Step name] — [one-line summary]
2. [Step name] — [one-line summary]
3. …
## Step Details
### Step 1 — [Step Name]
- **Goal:** [what this step achieves, one sentence]
- **Inputs:** [data/context coming in — name the artifact or reference a Context Inventory ID]
- **Outputs:** [what passes to the next step]
- **Rules & Edge Cases:**
- [decision criterion or branch]
- [what to do when an input is missing, malformed, or empty]
- [quality threshold or exception path]
- **Context Needed:** [list of Context Inventory IDs the step depends on, e.g., C1, C3]
- **Role:** [who performs this step — organizational lens only]
### Step 2 — [Step Name]
… (same fields)
## Sequence
- **Sequential steps:** [list]
- **Parallel steps:** [list with grouping, e.g., "Steps 2 and 3 run in parallel"]
- **Critical path:** [longest dependency chain]
- **Role swimlane** (organizational lens only): [brief view of which role owns each step]
Insert between the Metadata table and the Context Inventory (omit Steps Overview, Step Details, and Sequence — there is no fixed step sequence for goal-driven workflows):
## Inputs
- [What the agent system receives to start — data, materials, references, access]
- [One bullet per discrete input]
## Rules & Constraints
- **Must do:** [list]
- **Must never do:** [list]
- **Scope boundaries:** [what's in scope, what's out]
- **Tone / format / length:** [if applicable]
- **Source restrictions:** [if applicable]
- **Fallback behavior:** [what the agent does when it can't confidently complete a case — stop and ask, best-effort and flag, or skip]
The Goal, Metadata, Context Inventory, Acceptance Criteria, Example Scenarios, and Human Gates sections from the shared shell still apply — goal-driven uses the same shell, just a different middle. The Example Scenarios should reflect the variation envelope captured in Step 4-GD: the typical case plus the awkward/edge cases the agent must handle.
outputs/[name]/requirements.md. Ready for the design skill (Step 3)."documentation
Write Standard Operating Procedure documentation for workflows and save as markdown files. Selects full or lightweight SOP template based on autonomy level (deterministic vs. guided/autonomous), then adapts for workflow type (Manual, Augmented, Automated). Use when the user asks to write an SOP, document a workflow, create procedure documentation, or capture how a workflow is executed. Triggers on "write an SOP", "document this workflow", "create operating instructions", "how is this workflow executed".
development
Guide structured testing of AI workflow artifacts, evaluate output quality, identify which building blocks need adjustment, and determine readiness for deployment. Use when the user has built workflow artifacts and needs to test them. This is Step 5 (Test) of the AI Workflow Framework.
development
This skill should be used when the user has built and tested workflow artifacts and wants a Run Guide for deploying and operating their AI workflow. It generates a plain-language guide with setup steps, deployment patterns, and sharing instructions — tailored to the user's platform and build path. This is Step 6 (Run) of the AI Workflow Framework.
development
Evaluate a running AI workflow for quality, relevance, and evolution opportunities. Use when the user wants to review how a deployed workflow is performing, check if it needs tuning, or assess whether it should graduate to a more capable orchestration mechanism. This is Step 7 (Improve) of the AI Workflow Framework.