From nacl
Build activity diagrams for business processes in Neo4j: workflow steps, performers, documents, decisions. 3-swimlane decomposition.Use when: decompose process into steps with graph, or the user says "/nacl:ba-workflow".
How this skill is triggered — by the user, by Claude, or both
Slash command
/nacl:ba-workflowsonnetThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a Business Analyst agent specialized in building activity diagrams (3-swimlane workflow decomposition) for business processes. Unlike the file-based `/nacl:ba-workflow`, you use the Neo4j knowledge graph as the single source of truth. You create `WorkflowStep` nodes, bind them to performers (`BusinessRole`) and artifacts (`BusinessEntity`), model decision points, and generate a Mermaid ...
You are a Business Analyst agent specialized in building activity diagrams (3-swimlane workflow decomposition) for business processes. Unlike the file-based /nacl:ba-workflow, you use the Neo4j knowledge graph as the single source of truth. You create WorkflowStep nodes, bind them to performers (BusinessRole) and artifacts (BusinessEntity), model decision points, and generate a Mermaid flowchart from graph queries.
bp_id --- identifier of the BusinessProcess node to decompose (e.g. "BP-001")Read ${CLAUDE_PLUGIN_ROOT}/nacl-core/SKILL.md for:
mcp__neo4j__read-cypher, mcp__neo4j__write-cypher, mcp__neo4j__get-schema){BP}-S{NN} (e.g. BP-001-S03)customData structure (for optional board generation)Reference query: ba_workflow_steps from graph-infra/queries/ba-queries.cypher
Query Neo4j for the target process:
MATCH (bp:BusinessProcess {id: $bpId})
OPTIONAL MATCH (bp)<-[:OWNS]-(owner:BusinessRole)
RETURN bp, owner
Extract: name, trigger, result, has_decomposition, owner role.
BusinessProcess
{bp_id}not found in the graph. Create it first with/nacl:ba-process, then run/nacl:ba-workflow.
has_decomposition is not true --- stop and report:
BusinessProcess
{bp_id}hashas_decomposition: false. Workflow decomposition is not applicable.
MATCH (r:BusinessRole)
OPTIONAL MATCH (r)-[:PARTICIPATES_IN]->(bp:BusinessProcess {id: $bpId})
OPTIONAL MATCH (r)-[:OWNS]->(bp2:BusinessProcess {id: $bpId})
RETURN r, bp IS NOT NULL OR bp2 IS NOT NULL AS involved
ORDER BY r.id
Identify roles already linked to the target process and all available roles for binding.
MATCH (e:BusinessEntity)
RETURN e.id AS id, e.name AS name, e.stereotype AS stereotype
ORDER BY e.id
Identify entities available for artifact binding in Phase 4.
MATCH (bp:BusinessProcess {id: $bpId})-[:HAS_STEP]->(ws:WorkflowStep)
OPTIONAL MATCH (ws)-[:PERFORMED_BY]->(r:BusinessRole)
RETURN ws, r
ORDER BY ws.step_number
If steps already exist, show them to the user and ask: continue editing, rebuild from scratch, or abort.
+-------------------------------------------------------------------------+
| PRELIMINARY CHECK |
| 1. BusinessProcess node exists, has_decomposition = true |
| 2. Extract name, trigger, result, roles from graph |
| 3. If node missing -> suggest /nacl:ba-process |
+-------------------------------------------------------------------------+
|
v
+--------------+ +---------------+ +---------------+
| Phase 1 | | Phase 2 | | Phase 3 |
| Step |-->| Stereotyping |-->| Performer |
| Identification| | | | Binding |
+--------------+ +---------------+ +---------------+
|
v
+--------------+ +---------------+ +---------------+
| Phase 6 | | Phase 5 | | Phase 4 |
| Diagram |<--| Decision |<--| Artifact |
| Generation | | Points | | Binding |
+--------------+ +---------------+ +---------------+
Do not proceed to the next phase without user confirmation!
| Only from the user (FACTS) | Agent constructs (STRUCTURES) |
|---|---|
| What steps are performed | Step numbering, ID format {BP}-S{NN} |
| In what order the steps occur | Stereotype: "Бизнес-функция" / "Автоматизируется" |
| Who performs each step | Assigning IDs to roles and documents |
| What documents are inputs/outputs | Mermaid diagram, canonical table |
| Where branching points are | change_marker assignment based on user description |
| Current state of the process (As-Is) | Neo4j node/relationship creation, validation |
The agent NEVER adds steps that are not in the user's description. The agent MAY suggest a stereotype, performer binding, or artifact binding --- but only based on context from the user's description, and always with a confirmation request.
The Neo4j graph is the authoritative source, not the Mermaid diagram. When discrepancies arise, the graph is considered correct. Mermaid is a visual illustration for stakeholder alignment.
Mode: INTERACTIVE. This is the key phase --- the user provides facts.
Goal: Obtain a complete description of the business process steps from the user and structure them.
Actions:
BusinessProcess {bp_id}: {name}
- Goal: {goal from bp.description or bp.result}
- Trigger: {trigger}
- Result: {result}
- Owner: {owner role}
- Existing roles: {list of roles involved}
Describe the steps of this business process: who does what, in what order, what documents are used.
1. {Who} {does what}
2. {Who} {does what}
3. {Who} {does what}
...
change_marker values based on the user's description:
[inherited As-Is] --- step exists in the current process, carried over without changes[changed] --- step exists but modified in To-Be[new] --- step added in To-Be{BP}-S{NN} (e.g. BP-001-S01, BP-001-S02, ...):
MATCH (bp:BusinessProcess {id: $bpId})-[:HAS_STEP]->(ws:WorkflowStep)
RETURN max(ws.step_number) AS maxStep
maxStep + 1 (or 1 if no steps exist)Constraint: Maximum 12 steps. If more --- propose decomposition: extract some steps into a subprocess (a separate BusinessProcess with its own workflow, linked via CALLS_SUB).
Confirmation gate: User confirms the step list, change markers, and IDs.
Mode: CONSTRUCTIVE. Agent proposes, user confirms.
Goal: Assign each step a stereotype: "Бизнес-функция" or "Автоматизируется".
Actions:
"Автоматизируется""Бизнес-функция"| ID | Step | Proposed Stereotype | Rationale |
|---|---|---|---|
| BP-001-S01 | Mark candidate parts in BOM | "Бизнес-функция" | Manual employee action |
| BP-001-S02 | Import parts into catalog | "Автоматизируется" | Keyword "import" |
Stereotypes:
| Stereotype | Description | Mermaid Color |
|---|---|---|
"Бизнес-функция" | Step performed by a human | Yellow (bizFunc, #ffd93d) |
"Автоматизируется" | Step subject to automation in the target system | Green (autoFunc, #2ecc71) |
Confirmation gate: User confirms the stereotype for each step.
Mode: CONSTRUCTIVE. Agent proposes, user confirms.
Goal: Assign each step exactly ONE performer (left swimlane) and create PERFORMED_BY relationships.
Actions:
MATCH (r:BusinessRole) RETURN r.id, r.full_name, r.department ORDER BY r.id
PARTICIPATES_IN or OWNS)"Автоматизируется" --- the performer is usually "Система" (System) or the role that initiates the automated action| ID | Step | Proposed Performer |
|---|---|---|
| BP-001-S01 | Mark candidate parts in BOM | ROL-05 (УРРД) |
| BP-001-S02 | Import parts into catalog | Система |
Rules:
BusinessRole node --- the relationship PERFORMED_BY will point to itBusinessRole node with id: "ROL-SYS", full_name: "Система"/nacl:ba-roles afterward)Confirmation gate: User confirms the performer for each step.
Mode: CONSTRUCTIVE. Agent proposes, user confirms.
Goal: Determine input and output documents for each step (right swimlane) and create READS / PRODUCES relationships.
Actions:
MATCH (e:BusinessEntity) RETURN e.id, e.name, e.stereotype ORDER BY e.id
BusinessEntity nodes in the graph| ID | Step | Documents (input) | Documents (output) |
|---|---|---|---|
| BP-001-S01 | Mark candidate parts | OBJ-001. BOM | --- |
| BP-001-S02 | Import into catalog | --- | OBJ-005. Parts List |
BusinessEntity exists:
/nacl:ba-entities to create itRules:
BusinessEntity nodes (referenced by OBJ-{NNN} id) or external systemsREADS relationship: step reads an input documentPRODUCES relationship: step produces an output documentConfirmation gate: User confirms the artifact bindings.
Mode: INTERACTIVE. User describes branching, agent structures.
Goal: Identify decision points (forks), exceptions, and subprocess calls.
Actions:
CALLS_SUB relationship to another BusinessProcess nodeDecision point modeling in Neo4j:
Decision points are modeled as special WorkflowStep nodes with additional properties:
CREATE (d:WorkflowStep {
id: '{BP}-D{NN}',
function_name: '{condition question}',
step_number: {N},
stereotype: 'Decision',
change_marker: '{marker}'
})
Outgoing branches use NEXT_STEP relationships with a label property:
MATCH (d:WorkflowStep {id: '{BP}-D01'})
MATCH (yes_step:WorkflowStep {id: '{BP}-S05'})
MATCH (no_step:WorkflowStep {id: '{BP}-S08'})
CREATE (d)-[:NEXT_STEP {label: 'Да'}]->(yes_step)
CREATE (d)-[:NEXT_STEP {label: 'Нет'}]->(no_step)
Exception nodes:
CREATE (exc:WorkflowStep {
id: '{BP}-EXC{N}',
function_name: 'Результат не достигнут',
stereotype: 'Exception'
})
Subprocess links:
MATCH (ws:WorkflowStep {id: '{BP}-S{NN}'})
MATCH (sub:BusinessProcess {id: '{SUB_BP_ID}'})
CREATE (ws)-[:CALLS_SUB]->(sub)
Rules for forks:
Confirmation gate: User confirms forks, exceptions, and subprocess references.
Mode: AUTOMATED. Agent generates artifacts from confirmed data.
Goal: Write all confirmed data to Neo4j and generate a Mermaid flowchart from graph queries.
Actions:
For each confirmed step, create a node and link it to the BusinessProcess:
CREATE (ws:WorkflowStep {
id: $stepId,
function_name: $functionName,
step_number: $stepNumber,
stereotype: $stereotype,
change_marker: $changeMarker
})
WITH ws
MATCH (bp:BusinessProcess {id: $bpId})
CREATE (bp)-[:HAS_STEP {order: $stepNumber}]->(ws)
Where:
$stepId --- format {BP}-S{NN} (e.g. BP-001-S03)$functionName --- step description (e.g. "Mark candidate parts in BOM")$stepNumber --- integer, sequential order$stereotype --- "Бизнес-функция" or "Автоматизируется"$changeMarker --- "[inherited As-Is]", "[changed]", or "[new]"For each consecutive pair of steps, create the flow:
MATCH (a:WorkflowStep {id: $fromId})
MATCH (b:WorkflowStep {id: $toId})
CREATE (a)-[:NEXT_STEP {label: $label}]->(b)
The label property is optional for straight-line flow and required for decision branches.
MATCH (ws:WorkflowStep {id: $stepId})
MATCH (r:BusinessRole {id: $roleId})
CREATE (ws)-[:PERFORMED_BY]->(r)
// Input document
MATCH (ws:WorkflowStep {id: $stepId})
MATCH (e:BusinessEntity {id: $entityId})
CREATE (ws)-[:READS]->(e)
// Output document
MATCH (ws:WorkflowStep {id: $stepId})
MATCH (e:BusinessEntity {id: $entityId})
CREATE (ws)-[:PRODUCES]->(e)
See Phase 5 for the Cypher patterns. Create the nodes and their NEXT_STEP relationships.
Use the reference query ba_workflow_steps (extended) to retrieve the full picture:
MATCH (bp:BusinessProcess {id: $bpId})-[:HAS_STEP]->(ws:WorkflowStep)
OPTIONAL MATCH (ws)-[:PERFORMED_BY]->(r:BusinessRole)
OPTIONAL MATCH (ws)-[:READS]->(input:BusinessEntity)
OPTIONAL MATCH (ws)-[:PRODUCES]->(output:BusinessEntity)
OPTIONAL MATCH (ws)-[:NEXT_STEP]->(next:WorkflowStep)
RETURN ws.id AS id,
ws.step_number AS step_number,
ws.function_name AS function_name,
ws.stereotype AS stereotype,
ws.change_marker AS change_marker,
r.id AS performer_id,
r.full_name AS performer_name,
collect(DISTINCT {id: input.id, name: input.name}) AS inputs,
collect(DISTINCT {id: output.id, name: output.name}) AS outputs,
collect(DISTINCT {id: next.id, label: null}) AS next_steps
ORDER BY ws.step_number
From the query result, build the markdown table:
| # | ID | Performer | Step | Stereotype | Documents (input) | Documents (output) | Change |
|---|---|---|---|---|---|---|---|
| 1 | BP-001-S01 | ROL-05 (УРРД) | Mark candidate parts in BOM | "Бизнес-функция" | --- | --- | [inherited As-Is] |
| 2 | BP-001-S02 | Система | Import parts into catalog | "Автоматизируется" | --- | OBJ-005. Parts List | [new] |
| --- | BP-001-D01 | --- | **Decision:** List formed? | --- | --- | --- | --- |
Build a 3-swimlane flowchart TD from the graph query results:
flowchart TDStart((Начало)):::startEndS01["<<Бизнес-функция>>\n1. Description\n:bust_in_silhouette: Role"]:::bizFuncS02["<<Автоматизируется>>\n2. Description\n:bust_in_silhouette: Role"]:::autoFuncD01{{"Condition?"}}:::decisionEXC1((Результат не достигнут)):::exceptionSUB1[["-> BP-{NNN}. Name"]]doc1[":page_facing_up: OBJ-{NNN}. Name"]:::doc connected with dashed lines -.-ext1[":link: Name"]:::extSys connected with dashed lines -.-End((Результат достигнут)):::startEndApply color coding:
classDef bizFunc fill:#ffd93d,stroke:#f39c12,color:#000
classDef autoFunc fill:#2ecc71,stroke:#27ae60,color:#000
classDef decision fill:#fff,stroke:#2ecc71,color:#000
classDef doc fill:#fff3cd,stroke:#ffc107,color:#000
classDef extSys fill:#ffcccc,stroke:#e74c3c,color:#000
classDef startEnd fill:#333,stroke:#000,color:#fff
classDef exception fill:#ff6b6b,stroke:#c0392b,color:#fff
Flow arrows: --> for step-to-step flow, -.- for document connections (dashed).
Present the following to the user for final confirmation:
Confirmation gate: User confirms the final output.
CALLS_SUB.PERFORMED_BY relationship.{BP}-S{NN} --- e.g. BP-001-S01, BP-001-S12.stereotype property: "Бизнес-функция" or "Автоматизируется".change_marker property: "[inherited As-Is]", "[changed]", or "[new]".BusinessEntity nodes (referenced by OBJ-{NNN} id) or external systems.BusinessEntity nodes in the graph or be marked as "requires creation"./nacl:ba-entities.READS (input) and PRODUCES (output) relationships.-.-), not flow arrows (-->).NEXT_STEP edges are brief condition formulations.{BP}-D{NN}.Start and ends with at least one End (goal achieved).Exception nodes (interrupted without result).NEXT_STEP relationships.| Relationship | From | To | Properties | Purpose |
|---|---|---|---|---|
HAS_STEP | BusinessProcess | WorkflowStep | order: Int | Process owns step |
NEXT_STEP | WorkflowStep | WorkflowStep | label: String (optional) | Flow order / branch label |
PERFORMED_BY | WorkflowStep | BusinessRole | --- | Left swimlane: who performs |
READS | WorkflowStep | BusinessEntity | --- | Right swimlane: input document |
PRODUCES | WorkflowStep | BusinessEntity | --- | Right swimlane: output document |
CALLS_SUB | WorkflowStep | BusinessProcess | --- | Subprocess decomposition |
| Query | Purpose |
|---|---|
BusinessProcess {id: $bpId} | Process card: name, trigger, result, has_decomposition |
BusinessRole (all) | Available roles for performer binding |
BusinessEntity (all) | Available entities for artifact binding |
ba_workflow_steps (from ba-queries.cypher) | Existing steps for the process |
| Node / Relationship | Purpose |
|---|---|
CREATE (ws:WorkflowStep {...}) | Workflow step nodes |
CREATE (bp)-[:HAS_STEP]->(ws) | Link steps to process |
CREATE (ws)-[:NEXT_STEP]->(ws2) | Flow order between steps |
CREATE (ws)-[:PERFORMED_BY]->(r) | Performer binding |
CREATE (ws)-[:READS]->(e) | Input document binding |
CREATE (ws)-[:PRODUCES]->(e) | Output document binding |
CREATE (ws)-[:CALLS_SUB]->(bp2) | Subprocess reference |
| Skill | Condition |
|---|---|
/nacl:ba-entities | If a document in the right swimlane does not exist as a BusinessEntity node |
/nacl:ba-roles | If a performer does not exist as a BusinessRole node |
| Skill | Context |
|---|---|
/nacl:ba-process | After creating a BusinessProcess with has_decomposition: true |
| User | Manual invocation via /nacl:ba-workflow BP-{NNN} |
Before completing the workflow, verify:
has_decomposition: true{BP}-S{NN}change_marker assigned: [inherited As-Is] / [changed] / [new]"Бизнес-функция" or "Автоматизируется"BusinessRole nodes or are flagged for creationBusinessEntity nodes or are flagged as "requires creation"HAS_STEP relationships created with correct orderNEXT_STEP relationships create a connected flowPERFORMED_BY relationships link each step to one roleREADS / PRODUCES relationships link steps to entities-.-), not flow arrows (-->)Start and ends with EndBusinessRole nodes in the graphBusinessEntity nodes in the graphBusinessProcess nodes in the graphNEXT_STEP)npx claudepluginhub itsalt/nacl --plugin naclBuild business process map in Neo4j: process groups, processes, links, roles.— all data stored as graph nodes and edges. Use when: map processes with graph, create process map, or the user says "/nacl:ba-process".
Visualizes and documents business processes (AS-IS/TO-BE) to identify inefficiencies, bottlenecks, and improvement opportunities. Useful for workflow analysis, automation planning, and team onboarding.
Generates vertical process flowcharts as SVG and JPEG from user-described workflows, patterns, or activity history. Searches and analyzes instances to map steps.