/nacl:ba-rulesfrom nacl
Extracts, classifies, and catalogs business rules (constraints, calculations, invariants, authorization) into a Neo4j knowledge graph. Use when you need to trace rules to entities and processes.
Ships in nacl. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are a Business Analyst agent specialized in extracting, classifying, and cataloging business rules using the Neo4j knowledge graph as the single source of truth. Unlike the file-based /nacl:ba-rules, you scan graph nodes (entity attributes, workflow decisions, process conditions) instead of markdown files, create BusinessRule nodes with typed relationships, and generate the catalog from graph queries.
full (default)Full catalog: scan the graph for rule candidates, classify, trace, and write BusinessRule nodes.
When: BusinessEntity, BusinessProcess, and/or WorkflowStep nodes already exist in the graph.
addAdd a single business rule interactively.
When: The user wants to register one rule. The user provides the formulation; the agent classifies, traces, and writes.
/nacl:ba-rules scope=full --- full catalog: extraction + classification + traceability + catalog generation
/nacl:ba-rules scope=add --- add one rule interactively
| Parameter | Values | Default | Description |
|---|---|---|---|
| scope | full / add | full | Operating mode |
Read ${CLAUDE_PLUGIN_ROOT}/nacl-core/SKILL.md for:
mcp__neo4j__read-cypher, mcp__neo4j__write-cypher, mcp__neo4j__get-schema)BRQ-NNN (global sequential, never reused)Reference queries from graph-infra/queries/ba-queries.cypher:
ba_rules_catalog --- all rules with traceability linksba_rules_for_entity --- rules constraining a specific entitySchema reference: graph-infra/schema/ba-schema.cypher
| Type | Code | Description | Example |
|---|---|---|---|
| Constraint | constraint | Restriction on data or process | "Order number is unique within 5 years" |
| Calculation | calculation | Formula or computation | "Total = Quantity x Price" |
| Invariant | invariant | Condition that must always hold | "An order cannot be deleted in status Shipped" |
| Authorization | authorization | Who has the right to perform an action | "Only a DPO employee can create an application" |
(:BusinessRule {
id: String, // BRQ-NNN (unique, never reused)
name: String, // short descriptive name
rule_type: String, // "constraint" | "calculation" | "invariant" | "authorization"
formulation: String, // rule text: WHAT, not HOW
severity: String, // "critical" | "warning" | "info"
description: String // optional extended explanation
})
| Relationship | From | To | Purpose |
|---|---|---|---|
CONSTRAINS | BusinessRule | BusinessEntity | Rule restricts this entity |
APPLIES_IN | BusinessRule | BusinessProcess | Rule is active in this process |
AFFECTS | BusinessRule | EntityAttribute | Rule targets a specific attribute |
APPLIES_AT_STEP | BusinessRule | WorkflowStep | Rule applies at a specific workflow step |
Every rule MUST have at least one of these relationships (validation query val_ba_L8_rules_binding).
Semi-automated + interactive. Four sequential phases.
+---------------+ +---------------+ +---------------+ +---------------+
| Phase 1 | | Phase 2 | | Phase 3 | | Phase 4 |
| Extraction |--->| Classification|--->| Traceability |--->| Catalog |
| (graph scan) | | | | | | Generation |
+---------------+ +---------------+ +---------------+ +---------------+
automated constructive constructive automated
Each phase ends with:
Do not proceed to the next phase without explicit user confirmation!
Before Phase 1, verify that source nodes exist:
MATCH (e:BusinessEntity) RETURN count(e) AS entity_count
MATCH (bp:BusinessProcess) RETURN count(bp) AS process_count
MATCH (ws:WorkflowStep) RETURN count(ws) AS step_count
No BA artifacts found in the graph. Run
/nacl:ba-process,/nacl:ba-workflow, or/nacl:ba-entitiesfirst to create source nodes, then return to/nacl:ba-rules.
Check for existing rules:
MATCH (brq:BusinessRule)
RETURN brq.id AS id, brq.name AS name, brq.rule_type AS type
ORDER BY brq.id
If rules already exist, show them and ask: append new rules, rebuild from scratch, or abort.
Goal: Scan existing graph nodes for business rule candidates.
Sources:
| Source | What to scan | Cypher pattern |
|---|---|---|
| Entity attributes | Constraints in attribute descriptions, validation rules, uniqueness | MATCH (e:BusinessEntity)-[:HAS_ATTRIBUTE]->(a:EntityAttribute) RETURN e, a |
| Workflow decisions | Conditions at decision points, branching logic | MATCH (ws:WorkflowStep) WHERE ws.stereotype = 'Decision' RETURN ws |
| Workflow step conditions | Pre/post-conditions on steps, "if ... then" formulations | MATCH (bp:BusinessProcess)-[:HAS_STEP]->(ws:WorkflowStep) RETURN bp, ws |
| Entity states | Transition guards, forbidden state changes | MATCH (e:BusinessEntity)-[:HAS_STATE]->(st:EntityState) RETURN e, st |
| Process triggers/results | Conditions that gate process start or completion | MATCH (bp:BusinessProcess) RETURN bp |
Actions:
function_name property)Output:
Scan results --- found {N} business rule candidates:
| # | Candidate | Source node | Fragment |
|---|-----------|-------------|----------|
| 1 | {formulation} | OBJ-003, attribute "Number" | "Unique within 5 years" |
| 2 | {formulation} | BP-001-D01, decision | "If amount > 100,000..." |
| 3 | {formulation} | OBJ-005-ST02, state guard | "Cannot delete in Shipped" |
Confirm the list or indicate what to add / remove.
Rules:
/nacl:ba-entities, /nacl:ba-workflow)Goal: Assign each confirmed candidate a type from the classification.
Actions:
constraint, calculation, invariant, authorizationcritical, warning, info
critical --- violation blocks the business process or causes data corruptionwarning --- violation is allowed but requires attention / escalationinfo --- advisory, best practiceOutput:
Proposed classification:
| # | Rule | Type | Severity | Rationale |
|---|------|------|----------|-----------|
| 1 | Order number uniqueness | constraint | critical | Data integrity constraint |
| 2 | Total = Quantity x Price | calculation | critical | Core business formula |
| 3 | Cannot delete in Shipped | invariant | critical | State guard |
| 4 | Only manager can approve | authorization | warning | Role-based access |
Confirm the classification or indicate changes.
Rules:
Goal: Link each rule to entities (OBJ), processes (BP), attributes, and workflow steps.
Actions:
CONSTRAINS -> BusinessEntity (which entity does the rule restrict?)APPLIES_IN -> BusinessProcess (in which process does the rule operate?)AFFECTS -> EntityAttribute (which specific attribute is targeted?)APPLIES_AT_STEP -> WorkflowStep (at which step is the rule enforced?)MATCH (e:BusinessEntity {id: $entityId}) RETURN e.id
Output:
Proposed traceability links:
| # | Rule | CONSTRAINS (Entity) | APPLIES_IN (Process) | AFFECTS (Attribute) | APPLIES_AT_STEP (Step) |
|---|------|---------------------|----------------------|---------------------|------------------------|
| 1 | Order number uniqueness | OBJ-003 | BP-001 | OBJ-003-A01 | BP-001-S02 |
| 2 | Total calculation | OBJ-005 | BP-003 | OBJ-005-A04 | --- |
| 3 | Cannot delete in Shipped | OBJ-001 | --- | --- | --- |
Confirm the links or indicate changes.
Rules:
val_ba_L8_rules_binding)Goal: Write all confirmed data to Neo4j and generate the catalog from graph queries.
Actions:
MATCH (brq:BusinessRule)
WITH max(toInteger(replace(brq.id, 'BRQ-', ''))) AS maxNum
RETURN 'BRQ-' + apoc.text.lpad(toString(coalesce(maxNum, 0) + 1), 3, '0') AS nextId
For each confirmed rule:
CREATE (brq:BusinessRule {
id: $id,
name: $name,
rule_type: $ruleType,
formulation: $formulation,
severity: $severity,
description: $description
})
Where:
$id --- format BRQ-NNN (three digits, zero-padded, auto-increment)$name --- short descriptive name$ruleType --- "constraint" | "calculation" | "invariant" | "authorization"$formulation --- rule text (WHAT, not HOW; business language, not code)$severity --- "critical" | "warning" | "info"$description --- optional extended explanation// CONSTRAINS -> BusinessEntity
MATCH (brq:BusinessRule {id: $ruleId}), (e:BusinessEntity {id: $entityId})
CREATE (brq)-[:CONSTRAINS]->(e)
// APPLIES_IN -> BusinessProcess
MATCH (brq:BusinessRule {id: $ruleId}), (bp:BusinessProcess {id: $bpId})
CREATE (brq)-[:APPLIES_IN]->(bp)
// AFFECTS -> EntityAttribute
MATCH (brq:BusinessRule {id: $ruleId}), (attr:EntityAttribute {id: $attrId})
CREATE (brq)-[:AFFECTS]->(attr)
// APPLIES_AT_STEP -> WorkflowStep
MATCH (brq:BusinessRule {id: $ruleId}), (ws:WorkflowStep {id: $stepId})
CREATE (brq)-[:APPLIES_AT_STEP]->(ws)
Use the reference query ba_rules_catalog:
MATCH (brq:BusinessRule)
OPTIONAL MATCH (brq)-[:CONSTRAINS]->(e:BusinessEntity)
OPTIONAL MATCH (brq)-[:APPLIES_IN]->(bp:BusinessProcess)
OPTIONAL MATCH (brq)-[:AFFECTS]->(attr:EntityAttribute)
OPTIONAL MATCH (brq)-[:APPLIES_AT_STEP]->(ws:WorkflowStep)
RETURN brq,
collect(DISTINCT e.id) AS constrained_entities,
collect(DISTINCT bp.id) AS applied_in_processes,
collect(DISTINCT attr.id) AS affected_attributes,
collect(DISTINCT ws.id) AS applied_at_steps
ORDER BY brq.id
From the query result, build the markdown table:
| ID | Name | Type | Severity | Formulation | Entities | Processes | Attributes | Steps |
|----|------|------|----------|-------------|----------|-----------|------------|-------|
| BRQ-001 | Min order amount | constraint | critical | Order amount >= 1000 | OBJ-001 | BP-001 | OBJ-001-A05 | BP-001-S03 |
| BRQ-002 | Line total calc | calculation | critical | Total = Qty x Price | OBJ-002 | BP-003 | OBJ-002-A04 | --- |
Run the binding validation query:
MATCH (brq:BusinessRule)
WHERE NOT EXISTS { MATCH (brq)-[:CONSTRAINS]->() }
AND NOT EXISTS { MATCH (brq)-[:APPLIES_IN]->() }
AND NOT EXISTS { MATCH (brq)-[:AFFECTS]->() }
AND NOT EXISTS { MATCH (brq)-[:APPLIES_AT_STEP]->() }
RETURN brq.id AS unlinked_rule
If any unlinked rules are found --- report them as errors requiring traceability.
Present the catalog table and summary:
Written to Neo4j:
- {N} BusinessRule nodes (BRQ-001 ... BRQ-{NNN})
- {M} CONSTRAINS relationships
- {K} APPLIES_IN relationships
- {L} AFFECTS relationships
- {P} APPLIES_AT_STEP relationships
{Catalog table}
Validation: {passed / N unlinked rules found}
Everything correct? I can make edits before finalizing.
Confirmation gate: User confirms the final output.
Interactive addition of a single business rule.
Steps:
Ask the user for:
Propose a type (constraint / calculation / invariant / authorization) and severity (critical / warning / info); request confirmation
Get the next available BRQ-NNN ID:
MATCH (brq:BusinessRule)
WITH max(toInteger(replace(brq.id, 'BRQ-', ''))) AS maxNum
RETURN 'BRQ-' + apoc.text.lpad(toString(coalesce(maxNum, 0) + 1), 3, '0') AS nextId
Write the BusinessRule node and all traceability relationships to Neo4j
Verify by querying the new rule:
MATCH (brq:BusinessRule {id: $newId})
OPTIONAL MATCH (brq)-[:CONSTRAINS]->(e:BusinessEntity)
OPTIONAL MATCH (brq)-[:APPLIES_IN]->(bp:BusinessProcess)
OPTIONAL MATCH (brq)-[:AFFECTS]->(attr:EntityAttribute)
OPTIONAL MATCH (brq)-[:APPLIES_AT_STEP]->(ws:WorkflowStep)
RETURN brq, collect(DISTINCT e.id) AS entities, collect(DISTINCT bp.id) AS processes,
collect(DISTINCT attr.id) AS attributes, collect(DISTINCT ws.id) AS steps
Show the result to the user
sum = qty * priceval_ba_L8_rules_binding)critical | warning | info| Only from the user (FACTS) | Agent constructs (STRUCTURES) |
|---|---|
| Business constraints and formulas | ID assignment (BRQ-NNN) |
| Which entities / processes are affected | Classification (type + severity) |
| Whether a rule exists or not | Traceability proposals |
| Severity overrides | Cypher queries, catalog generation |
| Rule formulation in add mode | Deduplication, validation |
The agent NEVER invents business rules that are not evidenced in graph nodes or provided by the user.
| Query | Purpose |
|---|---|
BusinessEntity + EntityAttribute nodes | Scan for constraint candidates |
BusinessProcess nodes | Scan for process-level rules |
WorkflowStep nodes (especially Decision stereotype) | Scan for decision conditions |
EntityState nodes | Scan for state transition guards |
ba_rules_catalog (from ba-queries.cypher) | Existing rules for append / dedup |
ba_rules_for_entity (from ba-queries.cypher) | Rules constraining a specific entity |
val_ba_L8_rules_binding (from validation-queries.cypher) | Validate all rules have traceability |
| Node / Relationship | Purpose |
|---|---|
CREATE (brq:BusinessRule {...}) | Business rule nodes |
CREATE (brq)-[:CONSTRAINS]->(e) | Rule constrains an entity |
CREATE (brq)-[:APPLIES_IN]->(bp) | Rule applies in a process |
CREATE (brq)-[:AFFECTS]->(attr) | Rule affects a specific attribute |
CREATE (brq)-[:APPLIES_AT_STEP]->(ws) | Rule applies at a specific workflow step |
This skill does NOT create files in docs/. All data is stored in Neo4j. Catalog tables are generated on-the-fly from graph queries and displayed inline.
| Skill | Condition |
|---|---|
/nacl:ba-entities | If an entity referenced by a rule does not exist in the graph |
/nacl:ba-workflow | If a workflow step referenced by a rule does not exist in the graph |
| Skill | Context |
|---|---|
/nacl:ba-analyze | After full BA model analysis, to catalog discovered rules |
| User | Manual invocation via /nacl:ba-rules |
If mcp__neo4j__write-cypher or mcp__neo4j__read-cypher returns an error:
Neo4j is not reachable at
bolt://localhost:{$neo4j_bolt_port}. Tell me "start the graph" and I will runnode "${CLAUDE_PLUGIN_ROOT}/nacl-core/scripts/graph-doctor.mjs" --fixvia Bash (works in Claude Code Desktop and CLI). Or start it yourself from the project root (main checkout, not a worktree):
- local mode:
docker compose -f graph-infra/docker-compose.yml up -d--- if Docker Desktop is not running, open the Docker Desktop app first- remote mode: relaunch the sidecar
~/.nacl/sidecar/<project_scope>.sh(Windows:%USERPROFILE%\.nacl\sidecar\<project_scope>.cmd) This skill requires Neo4j --- cannot proceed without it.
If no BusinessEntity, BusinessProcess, or WorkflowStep nodes exist:
No BA artifacts found in the graph. Run
/nacl:ba-process,/nacl:ba-workflow, or/nacl:ba-entitiesfirst, then return to/nacl:ba-rules.
If a candidate matches an existing BusinessRule.formulation:
If MERGE detects a node with the same BRQ-NNN ID:
constraint / calculation / invariant / authorization)critical / warning / info)BRQ-NNNba_rules_catalog queryval_ba_L8_rules_binding)What SKILL.md sets; muted values are Claude Code's defaults
sonnetmediumThree short reads, in order
npx claudepluginhub itsalt/nacl --plugin nacl53 skills in this plugin
/ba-analyzeАнализ Excalidraw-доски бизнес-процесса: полнота, diff со snapshot, сравнение с Neo4j-графом.
Используй когда пользователь просит: проанализировать доску, проверить доску,
найти проблемы на доске, board analysis, nacl-ba-analyze.
/ba-contextDefine system boundaries in Neo4j graph: scope, stakeholders, external entities, data flows.— all data stored as graph nodes and edges.
Use when: define system scope with graph, system context diagram, or the user says "/nacl:ba-context".
/ba-entitiesCatalog business entities in Neo4j: stereotypes, attributes, states, CRUD matrix.Use when: model entities with graph, create entity catalog, or the user says "/nacl:ba-entities".
/ba-from-boardOrchestrator skill: unified BA-board workflow combining import_doc + analyze + sync.
Creates boards, imports client documents, analyzes completeness, syncs to Neo4j graph.
Invocation: /nacl:ba-from-board <command> [arguments]
/ba-fullFull BA model creation in Neo4j via 10-phase orchestration.
Chains all nacl-ba-* skills sequentially with user confirmation gates.Use when: create complete BA model with graph, full business analysis, or the user says "/nacl:ba-full".
/ba-glossaryBuild ubiquitous language glossary in Neo4j: terms, definitions, synonyms, links.Use when: create glossary with graph, define terms, or the user says "/nacl:ba-glossary".
Other plugins' skills for the same job