---
name: bpm-workflow
version: "1.0.0"
category: workflow
description: "当用户需要 BPM 审批流程设计、节点配置、会签/或签设置、穿透逻辑或 BizInfo 传递时使用。不要用于业务需求分析或代码实现。Use when user needs BPM approval workflow design, node configuration, countersign/or-sign settings, penetration logic, or BizInfo transfer. Do NOT use for business requirement analysis or code implementation."
triggers:
  zh: ["bpm", "审批", "workflow", "flow", "流程"]
  en: ["bpm", "workflow", "flow"]
license: MIT
compatibility: Java 11+
config: 
  - dispatch.yaml
dependencies: 
  - ba
metadata: 
  author: "sunhongda@example.com"
  created: "2026-06-16"
  updated: "2026-06-16"
  status: "stable"
---

## Changelog / 版本履历
<!-- Track all changes. Update this table whenever you modify the skill. -->
| 日期 | 版本 | 变更摘要 |
|------|------|---------|
| 2026-06-16 | 1.0.0 | 初始版本 |

# BPM工作流 / BPM Workflow

OpesPro BPM workflow analysis and configuration.

***
## Core Concept / 核心概念

### 🇨🇳
一句话说清：输入业务流程需求 → 设计BPM审批流程配置 → 输出BPM工作流配置文档。明确 **不做什么**。

**输入**: 业务流程需求、审批规则、节点配置要求 | **输出**: BPM workflow configuration and design doc | **不负责**: 业务需求分析（由BA技能处理）、代码实现

### 🇺🇸
One line: Input business process requirements → Design BPM approval workflow configuration → Output BPM workflow configuration document. Explicitly state what is **NOT done**.

**Input**: Business process requirements, approval rules, node configuration requirements | **Output**: BPM workflow configuration and design doc | **NOT responsible for**: Business requirement analysis (handled by BA skill), code implementation

***
## Position / 定位

```
ba (Business Analysis) → bpm-workflow → Implementation Team
    (业务需求分析)              (BPM流程配置设计)        (代码实现)
```

***
## Capabilities / 能力
<!-- List specific capabilities. Each item = concrete ability with brief explanation. -->
- **Approval Nodes Configuration** - Configure approval, condition, and notification nodes in BPM workflows
- **Countersign/Or-sign Settings** - Set up parallel approval (countersign) or alternative approval (or-sign) logic
- **Penetration Logic** - Implement data penetration across modules using `BpmPenetrationConfigEnum`
- **BizInfo Transfer** - Manage business context transfer with `{bizId, bizType, bizName}` structure
- **File Copying/Persistence** - Handle document/file copying between business contexts using BizInfo patterns
- **Cross-module Data Flow** - Design and document data flow between different business modules in approval processes

***
## Configuration / 配置
<!-- If this skill reads YAML config files, document them here. -->

| 配置文件 | 用途 | 必填 |
|---------|------|------|
| `config/dispatch.yaml` | BPM workflow dispatch configuration and routing rules | 是 |

**配置读取规则**：
1. 从 `config/dispatch.yaml` 读取BPM流程分发配置
2. 缺失必填配置 → 🔴 提示用户补全

***
## Iron Law / 核心铁律

### 🇨🇳
1. **铁律1**: 始终验证穿透配置。违规示例：❌ 忽略 `BpmPenetrationConfigEnum` 配置。合规示例：✅ 明确指定每个穿透场景的配置枚举值。
2. **铁律2**: 始终验证 BizInfo 结构。违规示例：❌ 使用不完整的 BizInfo 对象。合规示例：✅ 确保 `{bizId, bizType, bizName}` 三要素完整。
3. **铁律3**: 永远不要跳过节点配置。违规示例：❌ 假设默认节点配置足够。合规示例：✅ 为每个审批节点明确定义类型、规则和处理逻辑。

### 🇺🇸
1. **Law 1**: Always validate penetration configuration. Violation: ❌ Ignore `BpmPenetrationConfigEnum` configuration. Compliance: ✅ Explicitly specify enum values for each penetration scenario.
2. **Law 2**: Always verify BizInfo structure. Violation: ❌ Use incomplete BizInfo objects. Compliance: ✅ Ensure complete `{bizId, bizType, bizName}` triplet.
3. **Law 3**: Never skip node configuration. Violation: ❌ Assume default node configuration is sufficient. Compliance: ✅ Explicitly define type, rules, and processing logic for each approval node.

***
## Rationalization Table / 合理化防御表
<!-- REQUIRED for quality/workflow/tools domains. Prevents model rationalization. -->

| # | Trap / 陷阱 | Question / 请问自己 | Action / 应该怎么做 |
|---|-------------|------------------|------------------|
| 1 | "流程看起来很简单，我可以跳过配置验证" | 这个简单流程是否真的不需要穿透配置和BizInfo验证？ | 即使是最简单的流程也必须验证穿透配置和BizInfo结构 |
| 2 | "节点配置很直观，不需要详细文档" | 如果其他人需要维护这个流程，他们能否理解所有配置细节？ | 为每个节点提供完整的配置文档，包括类型、规则和处理逻辑 |
| 3 | "文件传递逻辑很直接，不需要测试" | 跨模块的文件传递是否考虑了所有边界情况和错误处理？ | 验证文件传递逻辑，确保在所有业务场景下都能正确工作 |

***
## Red Flags / 三层防御

### Layer 1: Input / 输入
- **INPUT-01**: 业务需求缺少审批规则细节 → 🔴 CRITICAL → 要求BA技能提供完整的审批规则文档
- **INPUT-02**: BizInfo结构不完整（缺少bizId、bizType或bizName） → 🔴 CRITICAL → 拒绝处理并要求补全

### Layer 2: Execution / 执行
- **EXEC-01**: 穿透配置未指定 `BpmPenetrationConfigEnum` → 🔴 CRITICAL → 中断执行并提示必须明确穿透配置
- **EXEC-02**: 节点配置缺少类型或处理逻辑 → 🟡 WARN → 继续但标记为高风险配置

### Layer 3: Output / 输出
- **OUTPUT-01**: BPM配置文档缺少文件传递逻辑说明 → 🟡 WARN → 继续但要求补充文档
- **OUTPUT-02**: 交叉模块数据流未完整记录 → 🔵 INFO → 记录缺失信息供后续完善

**级别标识**: 🔴 CRITICAL → 中断 | 🟡 WARN → 继续+标记 | 🔵 INFO → 记录

***
## Output / 输出规范

### 🇨🇳
输出BPM工作流配置文档，包含以下要素：
- 审批节点配置（类型、规则、处理逻辑）
- 穿透配置（`BpmPenetrationConfigEnum` 枚举值）
- BizInfo结构定义（`{bizId, bizType, bizName}`）
- 文件传递逻辑和路径
- 跨模块数据流说明
- 会签/或签设置详情

### 🇺🇸
Output BPM workflow configuration document containing:
- Approval node configuration (type, rules, processing logic)
- Penetration configuration (`BpmPenetrationConfigEnum` enum values)
- BizInfo structure definition (`{bizId, bizType, bizName}`)
- File transfer logic and paths
- Cross-module data flow documentation
- Countersign/or-sign settings details

***
## Dependencies / 依赖
<!-- List skills, configs, or resources this skill depends on. -->
- ba - Provides business requirement analysis and process requirements
- dispatch.yaml - Contains BPM workflow dispatch configuration

***
## Workflow / 工作流程

### Step 1: Pre-check / 前置检查
**EN:** Validate input requirements and BizInfo structure completeness
**中文：** 验证输入需求和BizInfo结构完整性

**中断条件**: Missing critical approval rules or incomplete BizInfo → 🔴 CRITICAL → Request complete information from BA skill

### Step 2: Execute / 执行
**EN:** Design BPM workflow configuration based on requirements
**中文：** 根据需求设计BPM工作流配置

### Step 3: Verify / 验证
**EN:** Validate penetration configuration and node settings against requirements
**中文：** 验证穿透配置和节点设置是否符合需求

***
## Examples / 示例

### 🇨🇳 场景1: 流程发起
```java
BpmApplyMain applyMain = new BpmApplyMain();
applyMain.setBizId(bizId);
applyMain.setBizType(bizType);
bpmApplyMainService.add(applyMain);
```

### 🇨🇳 场景2: 文件穿透
```java
BizInfo sourceBizInfo = new BizInfo(sourceId, sourceType, name);
BizInfo targetBizInfo = new BizInfo(targetId, BizType.CONTRACT_LIST, name);
docboxInfoService.copyTo(sourceBizInfo, fileCodes, targetBizInfo);
```

### 🇺🇸 Scenario 1: Process Initiation
```java
BpmApplyMain applyMain = new BpmApplyMain();
applyMain.setBizId(bizId);
applyMain.setBizType(bizType);
bpmApplyMainService.add(applyMain);
```

### 🇺🇸 Scenario 2: File Penetration
```java
BizInfo sourceBizInfo = new BizInfo(sourceId, sourceType, name);
BizInfo targetBizInfo = new BizInfo(targetId, BizType.CONTRACT_LIST, name);
docboxInfoService.copyTo(sourceBizInfo, fileCodes, targetBizInfo);
```

***
## Auto-Review / 自检清单

> 每次执行后自动检查：

| # | 检查项 | 状态 |
|---|--------|------|
| 1 | Workflow nodes properly configured (approval/condition/notification) with explicit type and rules | ☐ |
| 2 | Penetration logic correct (`BpmPenetrationConfigEnum` explicitly specified) | ☐ |
| 3 | BizInfo structure validated (`{bizId, bizType, bizName}` complete triplet) | ☐ |
| 4 | File copying/persistence paths verified with source and target BizInfo | ☐ |
| 5 | Cross-module data flow documented with all penetration scenarios | ☐ |
| 6 | Countersign/or-sign settings properly configured for parallel/alternative approvals | ☐ |
| 7 | All output files are properly formatted and validated against dispatch.yaml | ☐ |
| 8 | No sensitive information is exposed in BPM configuration outputs | ☐ |
| 9 | All dependencies (BA skill output) are properly handled and referenced | ☐ |
