Multi-Skill Collaborative Workflow
This project integrates the first three hands-on projects into a complete data report generation workflow.
Goal: master multi-Skill orchestration and how to design an orchestration Skill that coordinates the whole process.
Workflow Goal
The user uploads a business data file, and the system automatically completes the following end-to-end work, ultimately delivering a complete business report.
Design Principles of the Orchestration Skill
The orchestration Skill does not perform specific business processing; it only schedules the outputs of other Skills, passes intermediate results, and reports progress to the user at key nodes.
| What the orchestration Skill does | What the orchestration Skill does not do |
|---|---|
| Call sub-Skill scripts in order | Re-implement functionality that sub-Skills already have |
| Pass file paths between steps | Directly manipulate data content |
| Report overall progress to the user | Focus on the internal details of a single step |
| Handle remediation logic after a step fails | Catch exceptions inside sub-Skills |
Orchestration Script
Example
File path: scripts/orchestrator.py
Orchestration entry script for multi-Skill collaboration
import
subprocess
import
sys
import
json
import
os
import
shutil
SKILLS_BASE
=
"/mnt/skills/public"
WORK_DIR
=
"/home/claude/report_work"
OUTPUT_DIR
=
"/mnt/user-data/outputs"
def
run
(
script_path:
str
,
*args
)
dict
:
"""Run a specified script, return JSON result"""
cmd
=
[
sys
.
executable
,
script_path
]
list
(
args
)
result
=
subprocess
.
run
(
cmd
,
capture_output
=
True
,
text
=
True
,
timeout
=
120
)
try
:
return
json.
loads
(
result.
stdout
)
except
json.
JSONDecodeError
:
return
{
"status"
:
"error"
,
"message"
: result.
stderr
or
result.
stdout
or
"Script produced no output"
}
def
orchestrate
(
input_file:
str
)
dict
:
"""Execute the complete report generation workflow"""
os
.
makedirs
(
WORK_DIR
,
exist_ok
=
True
)
── Stage 1: Data Cleaning ─────────────────────────────────
(
"[1/3] Cleaning data..."
,
flush
=
True
)
clean_result
=
run
(
f
"{SKILLS_BASE}/data-cleaner/scripts/clean_data.py"
,
input_file
,
os
.
path
.
join
(
WORK_DIR
,
"cleaned.csv"
)
)
if
clean_result.
get
(
"status"
)
!=
"success"
:
return
{
"status"
:
"error"
,
"stage"
:
"Data cleaning"
,
"message"
: clean_result.
get
(
"message"
)
}
(
f
" Cleaned: removed {clean_result.get('dup_removed', 0)} duplicate rows,"
f
"filled {clean_result.get('nulls_filled', 0)} null values"
,
flush
=
True
)
── Stage 2: Statistical Analysis ─────────────────────────────────
(
"[2/3] Generating statistical report..."
,
flush
=
True
)
stats_result
=
run
(
f
"{SKILLS_BASE}/data-cleaner/scripts/calc_stats.py"
,
clean_result
[
"output"
]
,
os
.
path
.
join
(
WORK_DIR
,
"stats.json"
)
)
if
stats_result.
get
(
"status"
)
!=
"success"
:
return
{
"status"
:
"error"
,
"stage"
:
"Statistical Analysis"
,
"message"
: stats_result.
get
(
"message"
)
}
── Stage 3: Generate Excel Report ──────────────────────────
(
"[3/3] Generating Excel report..."
,
flush
=
True
)
output_name
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
input_file
)
)
[
0
]
"_report.xlsx"
output_path
=
os
.
path
.
join
(
OUTPUT_DIR
,
output_name
)
report_result
=
run
(
f
"{SKILLS_BASE}/data-cleaner/scripts/gen_report.py"
,
clean_result
[
"output"
]
,
stats_result.
get
(
"output"
,
""
)
,
output_path
)
if
report_result.
get
(
"status"
)
!=
"success"
:
return
{
"status"
:
"error"
,
"stage"
:
"Report Generation"
,
"message"
: report_result.
get
(
"message"
)
}
Clean up the working directory
shutil
.
rmtree
(
WORK_DIR
,
ignore_errors
=
True
)
return
{
"status"
:
"success"
,
"output"
: output_path
,
"clean_stats"
:
{
"dup_removed"
: clean_result.
get
(
"dup_removed"
,
0
)
,
"nulls_filled"
: clean_result.
get
(
"nulls_filled"
,
0
)
}
}
if
name
==
"main"
:
if
len
(
sys
.
argv
)
<
2
:
(
json.
dumps
(
{
"status"
:
"error"
,
"message"
:
"Usage: python orchestrator.py
}
)
)
sys
.
exit
(
1
)
result
=
orchestrate
(
sys
.
argv
[
1
]
)
(
json.
dumps
(
result
,
ensure_ascii
=
False
,
indent
=
2
)
)
【1/3】正在清洗数据...
已清洗:删除重复行 5 条,填充空值 18 处
【2/3】正在生成统计报告...
【3/3】正在生成 Excel 报告...
{
"status": "success",
"output": "/mnt/user-data/outputs/runoob_sales_report.xlsx",
"clean_stats": {"dup_removed": 5, "nulls_filled": 18}
}
SKILL.md of the orchestration Skill
---
name: report-pipeline
version: 1.0.0
description: >
完整的数据报告生成流水线:自动对上传的 CSV/Excel 文件执行数据清洗、
统计分析并生成 Excel 报告。当用户需要一键生成数据报告、
从原始数据直接输出分析报告时触发。
---
# Data reporting pipeline
## Prerequisites
The following Skills need to be installed:
- data-cleaner v1.0+
- 本 Skill 的脚本位于 /mnt/skills/public/report-pipeline/
## 执行
After getting the file path uploaded by the user, run the orchestration script directly:
```bash
python scripts/orchestrator.py <文件路径>
The script outputs each stage's progress in real time and outputs the final file path upon completion. After parsing the JSON output, call present_files to display the report file.
Failure Handling
If any stage fails, output an error message containing stage and message, tell the user which stage failed and the possible reason, and do not continue to subsequent stages.