generate-flow-diagram
Create or refine Markdown plus Mermaid flow diagrams for AI-agent workflows. Use when the user asks for a process flow, workflow diagram, Mermaid flowchart, agent operating procedure, human-in-the-loop gate map, or refinement of an existing flow or process description.
What this skill does
# Generate Flow Diagram Generate Flow Diagram turns workflow descriptions into auditable Markdown documents with Mermaid flowcharts. The orchestrator is a routing layer: it keeps normalized inputs, approvals, verdicts, and the final passing candidate in context while subagents handle analysis, building, and review. Bundled references are the offline execution contract. External links are optional just-in-time sources for current Mermaid syntax or design rationale. ## Inputs | Input | Required | Example | | ----- | -------- | ------- | | `PROCESS_SPEC` | Yes for new diagrams; optional for refinements | `Create a deployment-review flow: the deployment reviewer decides whether a release candidate is safe; inputs are PRs, CI, changelogs, and rollback plans; outputs are readiness comments; allowed actions are reading artifacts, summarizing risks, and posting comments; boundaries are no deploy or CI bypass; sensitive actions are deploy and rollback; HUMAN_CONFIRMATION_REQUIREMENTS is approval before recommending deploy; evidence comes from CI, runbooks, and incident history; completion states are ready, blocked, needs validation, or escalated.` | | `EXISTING_FLOW_OR_DIAGRAM` | Yes for refinements | Existing Mermaid block, file, or process description | | `REFINEMENT_REQUEST` | No | `Improve the current diagram without changing scope` | | `APPROVED_REFINEMENT_GAPS` | No | `G1 and G3 only` or `none` | | `DIAGRAM_SCOPE` | No | `orchestrator`, `subagent`, or `whole` (default) | | `SCOPE_SUBAGENT_NAME` | Conditional | Required when `DIAGRAM_SCOPE=subagent` | | `PACKAGE_PATH` | Yes for `RUN_MODE=decompose` | `skills/example-skill` | | `SUBAGENT_REGISTRY` | Yes for `RUN_MODE=decompose` | Name plus path per subagent | | `ROOT_DIAGRAM_PATH` | No | Optional root diagram path for `RUN_MODE=decompose`; defaults to `<PACKAGE_PATH>/flow-diagram.md` | | `SCOPE_LIMITS` | No | Explicit user-approved mutation expansion for `RUN_MODE=decompose`, such as `also update docs/foo.md` | `DIAGRAM_SCOPE` defaults to `whole` and reproduces current whole-diagram behavior; `orchestrator` and `subagent` constrain a generated diagram to one scope and activate the scope checks. `RUN_MODE=decompose` is a package-level operation over `PACKAGE_PATH` and `SUBAGENT_REGISTRY`. Load `./references/input-contract.md` for the scope and decompose-mode field details. ## Default Mutation Limits `RUN_MODE=decompose` is the only mutating mode. During intake, derive a single `MUTATION_LIMITS` contract and pass it to every dispatched subagent. Unless the user explicitly expands scope with `SCOPE_LIMITS`, use these defaults: - Write only inside the resolved `PACKAGE_PATH` skill package after every diagram candidate passes `REVIEW: PASS`. - Allowed write targets are the planner-resolved root diagram, localized `subagents/<subagent-name>-flow-diagram.md` files, and the load-instruction lines in the package `SKILL.md` and EARNED subagent files. - Preserve package directory name, frontmatter names, runtime targets, and user-facing purpose unless the user explicitly approves changing them. - Out of scope: sibling packages, `.agents/skills/`, `.claude/skills/`, `skills-lock.json`, repository-level docs, private configuration, `.git`, and `.handoffs/` files this run did not create. - During repair cycles, intersect `MUTATION_LIMITS` with the failed review findings: change only files tied to the specific `REVIEW_FEEDBACK`, original plan, and approved scope. All other modes are read-only and emit content only. Runtime mapping: Claude Code uses Write and Edit tools only inside `MUTATION_LIMITS`; OpenCode uses `edit` permission scoped to the same target package. Every run produces `PROCESS_INPUTS` before `RUN_MODE` routing. For new diagrams, normalize `PROCESS_SPEC`. For refinements, derive `PROCESS_INPUTS` from `EXISTING_FLOW_OR_DIAGRAM`, `REFINEMENT_REQUEST`, any supplied `PROCESS_SPEC`, and explicit assumptions. For `RUN_MODE=decompose`, derive `PROCESS_INPUTS` from the package-level inputs and mutation boundary: `PACKAGE_PATH`, `SUBAGENT_REGISTRY`, the resolved `ROOT_DIAGRAM_PATH`, `MUTATION_LIMITS`, allowed write targets, and explicit assumptions. Load `./references/input-contract.md` only when field-level checks, missing-field handling, or a clarification question are needed. Ask one concise question only when a missing value would change the diagram contract; otherwise mark safe assumptions explicitly. ## Progressive Loading Map | Need | Load | | ---- | ---- | | Missing-field checks, scoped input contract, mutation limits, or clarification policy | `./references/input-contract.md` | | Refinement gap inventory and confirmation gate | Dispatch `./subagents/refinement-analyst.md`; load `./references/output-templates.md` only to format the user-facing confirmation request | | Package decomposition plan (bloat map, earned decision, coverage audit) | Dispatch `./subagents/decomposition-planner.md`; it loads `./references/input-contract.md` for path-boundary checks and `./references/flow-design-playbook.md` for classification | | Candidate diagram creation or repair | Dispatch `./subagents/diagram-builder.md`; it loads `./references/flow-design-playbook.md`, `./references/mermaid-style-guide.md`, and `./references/output-templates.md` only as needed, including the scoped templates for `orchestrator` and `subagent` scopes | | Quality gate and fix loop | Dispatch `./subagents/diagram-quality-reviewer.md`; it loads `./references/quality-gate-checklist.md`, including the scope checks for scoped or decompose runs | | Source-backed rationale or current Mermaid guidance | `./references/external-sources.md`, then fetch the smallest relevant URL | ## Subagent Registry | Subagent | Path | Purpose | | -------- | ---- | ------- | | `refinement-analyst` | `./subagents/refinement-analyst.md` | Inspects an existing flow and returns proposed improvement gaps plus a confirmation question | | `decomposition-planner` | `./subagents/decomposition-planner.md` | Inspects a whole package and returns a bloat map, an earned-or-no-op decision per subagent, and a localized-diagram coverage audit | | `diagram-builder` | `./subagents/diagram-builder.md` | Creates or revises the Markdown plus Mermaid candidate from approved scope and bundled references | | `diagram-quality-reviewer` | `./subagents/diagram-quality-reviewer.md` | Reviews the candidate for Mermaid validity, prompt compliance, approved refinement scope, and scope separation | Read a subagent file only when dispatching that subagent. Keep raw diagrams, candidate drafts, and detailed findings inside subagents except for the final candidate that must be returned to the user. ## Execution 1. Capture all inputs, default `DIAGRAM_SCOPE` to `whole` when absent, derive `MUTATION_LIMITS` for `RUN_MODE=decompose`, and normalize the available source into `PROCESS_INPUTS` before `RUN_MODE` classification. Use `PROCESS_SPEC` for new diagrams; use `EXISTING_FLOW_OR_DIAGRAM`, `REFINEMENT_REQUEST`, any supplied `PROCESS_SPEC`, and explicit assumptions for refinements; use `PACKAGE_PATH`, `SUBAGENT_REGISTRY`, the resolved `ROOT_DIAGRAM_PATH`, `MUTATION_LIMITS`, allowed write targets, and mutation-boundary assumptions for decompose runs. Load `./references/input-contract.md` when the field checklist, path checks, scoped input contract, or missing-field policy is needed. 2. Classify the current pass as `RUN_MODE=new`, `RUN_MODE=refinement`, `RUN_MODE=repair`, or `RUN_MODE=decompose`. For `RUN_MODE=decompose`, follow the Decompose Mode steps below; steps 3-9 cover `new`, `refinement`, and `repair` and are unchanged. 3. For `RUN_MODE=refinement`, dispatch `refinement-analyst` before generating a revised diagram, including `EXISTING_FLOW_OR_DIAGRAM`, `PROCESS_INPUTS`, `REFINEMENT_REQUEST`, and `APPROVED_REFINEMENT_GAPS` when supplied. Consume its return as `PREFLIGHT_VERDICT`: continue only on `PREFLIGHT: PASS`; on `PREFLIGHT: NEEDS_CONFIRMATION`, ask the confirmation q
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.