YonBIP Workflow Path Table Generator
Converts natural language business approval workflow descriptions into YonBIP-standard Excel workflow path tables.
Core Principle: Dynamic Column Extraction
CRITICAL: Do NOT assume any fixed columns. Every table structure must be derived from the user's description:
- Condition Columns: Extract all condition dimensions mentioned
- Examples: Expense Type, Amount, Supplier Type, Department, Region, Procurement Category, etc.
- Role Columns: Extract ALL roles mentioned in the approval chains
- Examples: Department Supervisor, Finance Manager, General Manager, Administrative Supervisor, Procurement Specialist, Legal Counsel, etc.
- Build table structure based ONLY on what's actually in the description
Core Principle: Mutually Exclusive Conditions
The condition combination in each row must be unique and mutually exclusive. Any given input can only match exactly one row.
Why is Mutual Exclusivity Important?
The YonBIP system needs to determine a unique approval path based on conditions. If there is overlap between the conditions of two rows, the system cannot determine which path to take.
Mutual Exclusivity Rules
-
Values in the same column must be mutually exclusive: For each condition column, values in any two rows cannot match the same input simultaneously
- ✅ and are mutually exclusive
- ❌ "All" and overlap ("All" includes )
- ❌ and overlap (values between 3000-5000 match both)
-
Row combinations must be mutually exclusive: Even if single-column values are not mutually exclusive, their combinations must be
- ✅ "Administrative Procurement | < 5000" and "Production Procurement | < 5000" are mutually exclusive (different procurement categories)
- ❌ "Administrative Procurement | All" and "Administrative Procurement | >= 5000" overlap
-
Use partitioning instead of overlay: Do not overlay specific conditions on top of "All"
- ❌ Wrong: First write the "All" rule, then overlay the rule
- ✅ Correct: Partition by amount ranges: and
Standard Partitioning Method for Amount Ranges
< 1000 → Less than 1000
[1000, 5000) → 1000 to below 5000 (includes 1000, excludes 5000)
>= 5000 → 5000 and above
This partitioning method ensures that each amount value matches exactly one row.
Workflow
Dry Run Mode: If user specifies
flag:
- Skip Step 0 (clarification)
- Skip Step 4 (Excel generation)
- Only output the markdown table
Step 0: Understand and Clarify
Skip in --dryrun mode: If the
flag is set, skip this entire step and proceed directly to Step 1.
After receiving the user's approval rules, first analyze the content:
-
Understand: Parse the natural language and identify:
- The main business scenario (Expense Type, Procurement Type, etc.)
- Key conditions mentioned (Amount Range, Supplier Type, etc.)
- Approval roles and their sequences
-
Check for Ambiguities: Determine if the rules are complete and unambiguous:
- Incomplete condition coverage (Are there any missing scenarios?)
- Unclear role definitions (Are role names clear?)
- Boundary conditions not specified (How to handle boundary values?)
- Multiple interpretations possible (Is there any ambiguity?)
-
Decision Point:
- If rules are clear: Skip directly to Step 1 (no user interaction needed)
- If ambiguities exist: Proceed to clarification
-
Interactive Clarification (only if ambiguities exist):
- First, present your understanding of the rules
- Then, ask specific questions using AskUserQuestion tool:
- Present specific questions with clear options
- Allow "Other" for custom input
- Wait for user response before proceeding
- Example: "My understanding of your rules is..., but I have the following questions:..."
-
Proceed to Step 1: Once the rules are clear (either no ambiguities or user has clarified), proceed to extract and structure the data.
Typical scenarios requiring clarification:
-
Incomplete condition coverage:
- Rule: "Amount <1000 goes to A, amount >=5000 goes to B"
- Question: "How to handle amounts between 1000 and 5000?"
-
Unclear roles:
- Rule: "Approved by supervisor"
- Question: "Is it the department supervisor or business supervisor?"
-
Boundary value ambiguity:
- Rule: "Amount <1000" and "Amount 1000-5000"
- Question: "Which path should exactly 1000 yuan take?"
-
Default/fallback rules:
- Rule: Only specific scenarios are mentioned
- Question: "How to handle other unmentioned scenarios?"
Step 1: Extract and Structure
Analyze the natural language and identify:
A. All Condition Dimensions (First few columns)
- What categories/dimensions determine the approval path?
- Common patterns: Expense Type, Amount Range, Supplier Nature, Department Type, etc.
B. All Approval Roles (Last few columns)
- Who are the approvers? List ALL unique roles mentioned
- Preserve the exact role names from the description
- Do NOT add roles that aren't mentioned
C. Approval Logic (Table content)
- Map out each scenario's approval sequence
- Use numbers (1, 2, 3...) for approval order
- Use for non-participating roles
- Use for conditional approvals
Step 2: Generate Markdown Table
Build the table with extracted columns:
| [Condition Column 1] | [Condition Column 2] | ... | [Role 1] | [Role 2] | [Role 3] | ... |
|----------|----------|-----|---------|---------|---------|-----|
| Value A | Condition X | ... | 1 | n/a | 2 | ... |
Validate mutual exclusivity before presenting:
Check that no two rows have overlapping conditions. If overlap exists:
- Identify the overlapping rows
- Refactor using proper partitioning (e.g., split "All" into specific ranges)
- Ensure each input matches exactly one row
Present to user for confirmation.
Step 3: User Confirmation
Ask: "Please confirm if the above workflow path table is correct? Please let me know directly if modifications are needed."
Wait for approval or modifications.
Step 4: Generate Excel
After confirmation, use the conversion script to generate Excel file.
Write the markdown file to the same folder as the Excel file.
Script location: (within this skill directory)
Usage:
bash
python3 ${SKILL_DIR}/scripts/md_to_excel.py <input.md> <output.xlsx> --condition-cols <N>
Parameters:
- : Specify the first N columns as "condition" columns (e.g., Expense Type, Amount Range), and the remaining columns as "node" columns (Approval Roles)
The script will:
- Parse the Markdown table structure
- Add explanation row ("Condition" | "Node")
- Apply YonBIP standard formatting (headers, borders, alignment)
- Convert to empty cells
- Generate file
Examples
Example 1: Entertainment Expense (Simple Scenario)
Input:
Entertainment expense approval rules: Amount <1000 only requires department supervisor approval; Amount between 1000 and 5000 requires department supervisor and finance manager; Amount >=5000 requires department supervisor, finance manager, and general manager.
Extracted:
- Condition columns: Expense Type, Amount
- Role columns: Department Supervisor, Finance Manager, General Manager
Output:
| Expense Type | Amount | Department Supervisor | Finance Manager | General Manager |
|---|
| Entertainment | < 1000 | 1 | n/a | n/a |
| Entertainment | [1000, 5000) | 1 | 2 | n/a |
| Entertainment | >= 5000 | 1 | 2 | 3 |
Example 2: Procurement Approval (Multiple Conditions + Multiple Roles)
Input:
Administrative Procurement: Regardless of amount, Department Head(1)→Administrative Supervisor(2). Add Finance Director(3) if amount >=5000.
Production Procurement: <20000: Department Head(1)→Procurement Specialist(2)→Finance Director(3).
≥20000: Department Head(1)→Procurement Manager(2)→Finance Director(3)→General Manager(4).
New partners require additional Legal Counsel approval.
Extracted:
- Condition columns: Procurement Category, Amount, Supplier Type
- Role columns: Department Head, Administrative Supervisor, Procurement Specialist, Procurement Manager, Finance Director, General Manager, Legal Counsel
Output:
| Procurement Category | Amount | Supplier Type | Department Head | Administrative Supervisor | Procurement Specialist | Procurement Manager | Finance Director | General Manager | Legal Counsel |
|---|
| Administrative | < 5000 | All | 1 | 2 | n/a | n/a | n/a | n/a | n/a |
| Administrative | >= 5000 | All | 1 | 2 | n/a | n/a | 3 | n/a | n/a |
| Production | < 20000 | All | 1 | n/a | 2 | n/a | 3 | n/a | n/a |
| Production | >= 20000 | Existing Partner | 1 | n/a | n/a | 2 | 3 | 4 | n/a |
| Production | >= 20000 | New Partner | 1 | n/a | n/a | 2 | 3 | 4 | 5 |
Note: Mutually exclusive conditions - Each row represents a unique condition combination with no overlap.
Example 3: Travel Expense (Standard YonBIP Roles)
Input:
Travel expense <5000 requires Supervisor and Finance approval; 5000-10000 adds Manager; >=10000 requires all approvals.
Extracted:
- Condition columns: Expense Type, Amount
- Role columns: Business Supervisor, Finance Specialist, Business Manager, Business General Manager, President (Note: Extract in the order of appearance)
Output:
| Expense Type | Amount | Business Supervisor | Finance Specialist | Business Manager | Business General Manager | President |
|---|
| Travel | < 5000 | 1 | 2 | n/a | n/a | n/a |
| Travel | [5000, 10000) | 1 | 3 | 2 | n/a | n/a |
| Travel | >= 10000 | 1 | 4 | 2 | 3 | 5 |
Value Formatting
Condition Values
- Amount: , , ,
- Category: Specific category names (e.g., Travel Expense, Administrative Procurement)
- General: means no restriction
Approval Nodes
- 1, 2, 3...: Approval sequence order
- n/a: Role does not participate
- N:[condition]: Nth step with additional condition
- Example: = 2nd approver AND amount >= 500
Common Patterns
Threshold phrases:
- "Below X yuan" →
- "Within X yuan" →
- "X to Y yuan" →
- "Above X yuan" →
Chain phrases:
- "Go through A and B" → A then B (sequential)
- "Add C" → Add C to chain
- "Full approval / All" → All roles participate
Condition phrases:
- "If it is X and Y" → Add condition columns
- "Meet XX condition" →
- "Requires XX approval" → Add XX role
Common Mistakes to Avoid
❌ Mistake: Overlapping Conditions
| Procurement Category | Amount | ... |
|---------|------|-----|
| Administrative | All | ... | ← Overlaps with the row below
| Administrative | >= 5000 | ... | ← "All" includes `>= 5000`
Problem: An administrative procurement of 6000 yuan will match both rows simultaneously.
✅ Correct: Mutually Exclusive Partitioning
| Procurement Category | Amount | ... |
|---------|------|-----|
| Administrative | < 5000 | ... | ← Does not include 5000
| Administrative | >= 5000 | ... | ← Starts from 5000
❌ Mistake: Overlapping Range Boundaries
| Amount | ... |
|------|-----|
| < 5000 | ... |
| >= 3000 | ... | ← 3000-5000 overlap
✅ Correct: Clear Boundaries
| Amount | ... |
|------|-----|
| < 3000 | ... |
| [3000, 5000) | ... |
| >= 5000 | ... |
❌ Mistake: Using "All" with Overlaid Specific Conditions
When the user says "Amount >=5000 requires additional approval", do NOT generate:
| Amount | Finance Director |
|------|---------|
| All | n/a | ← Wrong: Overlaps with the row below
| >= 5000 | 3 | ← Included in the above
✅ Correct: Partition to Cover All Scenarios
| Amount | Finance Director |
|------|---------|
| < 5000 | n/a |
| >= 5000 | 3 |