A flow file (<skill>.kdl) describes one skill's workflow so that a person can review it in minutes. Its nodes are the skeleton: phases, steps, decisions, who acts, data, invariants and exits. Its quoted strings are prose: the intent of each node.
A flow file is a KDL 2.0.0 document, not KDL v1, YAML or JSON.
A name, arguments, key=value properties, then an optional { … } block of children.
step draft by=llm "Write the draft." { output draft "the first draft" }A newline, ; or the parent's } ends a node. A \ at the end of a line continues it.
phase p { step a by=llm; step b by=code }A word without spaces or (){}[]/\"#;= is a string. It cannot start with a digit. The keywords are #true, #false and #null; a bare true, false, null, inf or nan is an error.
output draft // ok output 2nd-draft // error: starts with a digit
"…" holds text with spaces. Its escapes are \n \t \\ \" \s and \u{…}; any other \x is an error. A raw string has no escapes.
#"text with "quotes""#
Open with """ and a line break. Close with """ on its own line; its indent is removed from every line. """text""" on one line is an error. The page shows lists, `code`, **bold** and *italic* in it.
step draft by=llm """
Group the changes **by type**:
- features
- new commands
- fixes
"""// runs to the end of the line. /* … */ sits inline. /- before a node comments out the whole node.
// a comment /- step old by=llm
A flow file has only these nodes. A node in the wrong place is an error. Names of phases, steps and decisions are bare words, unique in the file. ref="label" links a node to the part of the skill that has that label.
skillflowThe first line
The format version, exactly 1.0. Reverse and sync add the stamps skill-version and skillflow-version. skill="path" names the target skill folder.
skillflow 1.0 skill-version="0.2"
contextRight after skillflow 1.0, optional
Facts about the whole skill: its inputs, outputs and invariants.
context "Drafts release notes." {
input tag "the git tag to describe"
}inputIn context
What the user gives at the start, with a description.
input tag "the git tag to describe"
outputIn context
What the skill produces, with a description. A named output must be produced on every path that reaches the end of the flow.
output "a new section in CHANGELOG.md" output notes "the release notes"
invariantIn context
A rule that holds during the whole flow. Optional by says who keeps it: code is a script that fails or blocks, human a person at a gate or in a step of their own, llm the model's instructions alone.
invariant by=human "nothing is published without approval"
phaseTop level, phase, when
A group of steps.
phase write "Draft and approve." {
step draft by=llm
}stepTop level, phase, when, catch
One action. by is required: llm the model, code a script or fixed command, human the user. file= names the script of a code step; skill= names a skill the step loads.
step collect by=code file="scripts/collect.sh" step draft by=llm "Group the changes by type."
decideTop level, phase, when, catch
A fork of the path: a name, a question and by. At least one when holds a node or an end. With one when, the other outcome is implied and continues below.
decide mode "Which mode?" by=llm {
when draft "the draft continues below"
when publish { end "nothing to draft" }
}gateTop level, phase, when, catch
An approval by the user; no by. Two outcomes are implied: approved continues, revise redoes the work before the gate and asks again. A when adds an outcome or overrides an implied one.
gate approved "Did the user approve the draft?" {
when rejected { end "stopped without approval" }
}whenIn decide, gate
One outcome, with prose or a block. After it the flow continues below the decide or gate, unless it reaches end.
when yes { step publish by=code }
when no "The draft stays local."catchIn step, at most one
What happens when the step fails. Unless it reaches end, the flow goes on after the step. An output inside names data that the recovery restores.
step publish by=code {
catch "Show the error." { end "nothing is published" }
}endTop level, phase, when, catch
The flow stops here. A node after it in the same block is an error.
end "the tag does not exist"
toolsIn step, decide, gate
Tools the node uses: MCP, CLI, web and agent tools, such as a question tool. A name may carry its kind: (agent) a subagent, (mcp) a tool of an MCP server.
tools (agent)reviewer (mcp)jira gh
input output in a nodeIn step, decide, gate; output also in when and catch
output is data the node produces. input is material the skill asks the user for at that node.
output changes "the commits since the last tag" input notes "the user's own notes on the release"
// ?On its own line above a node
An unclear place in the skill. The page shows it as ❓ on that card.
// ? how many revision rounds? (SKILL.md:24)
A complete flow for an imagined skill release-notes: it drafts release notes for a git tag and adds them to CHANGELOG.md. It uses every node, property, executor and tool kind. Pick a point, or point at a line or a card: the other side shows its match.
by=code runs a script: collect-changes and publish. by=llm is the model: draft. by=human is work the user does alone: announce.
changes, size, highlights and draft each have one line with a description. highlights is an input: the step asks the user for it.
decide size forks the path. when major holds a step; when regular says in prose why nothing happens. Then both go on to draft.
gh is a CLI and has no kind. (agent)editor is a subagent, and (mcp)jira is a tool of an MCP server.
The catch of collect-changes ends the flow at once. The one of publish reports the error in a step of its own, then ends the flow. The one of announce is one line of prose, and the flow goes on.
The revision loop is in the prose of draft. A flow has no loop node.
gate approved writes no when approved: approved goes on to publish, and revise sends the draft back. when rejected ends the flow.
Each rule shows the flow to avoid beside the flow to write, each with its graph. Point at a line or a card: the other side shows its match.
A fact is a node only when its change would show in the result or in the dialogue. All else is prose or stays in the skill.
step draft by=llm "Group the changes by type. Write them to a temp file first; sort it with sort -u." {
tools sort
output temp-file "the scratch file of the sort"
}step draft by=llm "Group the changes by type."
The executor, a question to the user, a branch, or data a reviewer would notice. Model actions in a row are one step.
step read-commits by=llm "Read the commits." step group by=llm "Group them by type." step write-notes by=llm "Write the notes." gate approved "Did the user approve the draft?"
step draft by=llm "Read the commits; write the notes by type." gate approved "Did the user approve the draft?"
Two at most, 200 characters, or one list of up to five items. The details stay in the skill; ref= points to them.
step match by=llm """ Read each row of the table. Compare its name with every entry of the register, first by the exact name and then without case. When two entries fit, take the newer one. Write the pairs as a CSV file with a header line. """
step match ref="S3" by=llm "Match each row to an entry."
A flow has no loop node.
step draft by=llm "Write the draft."
decide again "Does the user want changes?" by=human {
when yes {
step redraft by=llm "Write the draft again."
}
}step draft by=llm "Write the draft. Revise it until the user approves it."
An approval is a gate. An answer that changes the path is a decide by=human. Any other answer is an input of the node that asks.
decide tone "Formal or casual?" by=human {
when formal "The notes are formal."
when casual "The notes are casual."
}
step draft by=llm "Write the notes."step draft by=llm "Ask for the tone; write the notes." {
input tone "formal or casual"
}Write output or input where the data first appears, with a description. A later change and a later read are prose.
step collect by=code {
output changes "the commits since the last tag"
}
step draft by=llm "Group the changes by type." {
input changes "the commits"
output changes "the grouped commits"
}step collect by=code {
output changes "the commits since the last tag"
}
step draft by=llm "Group the changes by type."Say who keeps it with by=. A rule about the result is prose of the node that makes the result.
context {
invariant "the notes have one section for each type"
}
step draft by=llm "Write the notes."context {
invariant by=code "build.py refuses an unsigned build"
}
step draft by=llm "Write one section for each type."A failure that several steps handle the same way is one invariant that names the script. A catch holds only the failures of its own step.
step collect by=code {
catch {
end "collect.sh failed"
}
}
step count by=code {
catch {
end "collect.sh failed"
}
}context {
invariant by=llm "When collect.sh fails, report it and end."
}
step collect by=code
step count by=codeWrite // ? with the file and line above the node. Do not guess.
gate approved "Did the user approve the draft? At most three rounds."
// ? how many revision rounds? (SKILL.md:24) gate approved "Did the user approve the draft?"
fmt lays out the file and changes no word. Each validator message has its line and its fix.
node skillflow.mjs fmt flow.kdl node skillflow.mjs validate flow.kdl
skillflowctl edit <skill> opens the flow in the browser. The Source view in Edit mode holds the text, and the graph follows it.
skillflow or context, is not in the list. The order of the nodes and the when blocks make the connections.render writes holds the editor as a sandbox: Edit in its Source view, or the address #edit, tries changes in this tab. It saves the flow to a file that you pick, or downloads it; Reset puts the page's text back. The page never changes, and a reload shows its text again. It has no skill folder, so it does not check file=, ref=, skill-version, or skill=. While the text differs from the page's text, new comments wait; the comments that the page has can still be edited, resolved, or deleted."…" string, and goes to the next field; after the last field, the cursor goes to the end of the line. In a field on a line of its own, Enter adds a line and Shift+Enter ends the field. Escape ends the fields.