流程架构师
FreeNo executable scriptsNot checked流程架构师是跨平台自动化工作流的设计与执行能力包。它不只给JS示例,更解决四个高频 痛点:复杂分支逻辑难以调试、字段映射错位导致数据串列、重复触发造成重复处理、 API限流未处理导致批量失败。 核心能力: - YAML工作流DSL:用声明式YAML替代JS片段,可版本化、可diff、可dry-run…
by thcjp607 installs in other catalogsAbout this skill
流程架构师
设计并执行跨平台自动化工作流,替代重复性人工操作。核心信条:先用YAML声明,再干跑验证,最后放量执行;每个工作流必须有幂等键。
四大痛点与对策
| 痛点 | 典型表现 | 本skill对策 |
|---|---|---|
| 复杂分支难调试 | 上线才发现走错分支 | YAML DSL + dry-run干跑校验 |
| 字段映射错位 | 数据串列、空值、类型不符 | 字段映射校验器 + schema版本号 |
| 重复触发 | 同一条记录被处理多次 | 幂等键设计 + 去重检查 |
| API限流 | 批量调用全部被拒 | 令牌桶 + 退避重试 + 批量请求 |
第一步:YAML工作流DSL
用声明式YAML替代JS片段,可版本化、可diff、可dry-run。
DSL完整结构
workflow:
name: "竞品价格监控"
id: "competitor-price-watch"
version: "1.0"
description: "每日抓取竞品价格并对比历史,变化即告警"
idempotency:
key: "${competitor}_${product_id}_${date}" # 强制幂等键
scope: "daily" # 每日去重
trigger:
type: cron # cron|webhook|watch|manual|event
config:
cron: "0 9 * * *"
tz: "Asia/Shanghai"
inputs:
- name: competitor_list
type: array
source: "config/competitors.yaml"
required: true
steps:
- id: fetch_price
name: "抓取价格"
action: fetch
config:
url: "${competitor.url}/product/${product_id}"
method: GET
timeout: 30s
output: raw_html
on_success: extract
on_failure: notify_error
retry:
max_attempts: 3
backoff: exponential # 1s, 2s, 4s
- id: extract
name: "提取价格"
action: transform
config:
script: "parse_price(raw_html)"
output: current_price
on_success: compare
- id: compare
name: "对比历史"
type: condition
rules:
- condition: "current_price != history_price"
goto: notify_change
- condition: "default"
goto: archive
- id: notify_change
name: "价格变化告警"
action: notify
config:
channel: slack
message: "${competitor} ${product} 价格 ${history} → ${current}"
on_success: archive
- id: archive
name: "归档历史"
action: save
config:
path: "data/prices-${date}.json"
error_handling:
- id: notify_error
action: notify
config:
channel: slack
message: "工作流[${workflow.id}]在${failed_step}失败:${error}"
then: abort
rate_limit:
strategy: token_bucket
capacity: 10 # 桶容量
refill_per_second: 2 # 每秒补充
retry_on_429: true
backoff: exponential
outputs:
- name: price_changes
destination: "data/changes-${date}.json"
format: json
触发器类型对照
| 类型 | 配置字段 | 适用场景 |
|---|---|---|
| cron | cron, tz |
定时任务(每日9点、每周一) |
| webhook | endpoint, secret |
外部系统回调 |
| watch | path, events |
文件变化(新增/修改/删除) |
| manual | 无 | 手动触发 |
| event | source, event_name |
事件总线订阅 |
操作节点类型
| action | 用途 | 关键配置 |
|---|---|---|
| fetch | HTTP请求 | url, method, headers, body |
| transform | 数据转换 | script(JS/Python表达式) |
| save | 写文件 | path, format |
| read | 读文件 | file |
| move | 移动文件 | to |
| merge | 合并多输入 | inputs(数组) |
| upload | 上传到云 | destination |
| notify | 发通知 | channel, message |
| decide | 条件判断 | rules(条件数组) |
| wait | 等待 | ms 或 until |
第二步:干跑校验(dry-run)
上线前必跑。用2-3条样本数据验证全链路,避免上线后才发现走错分支。
干跑清单
dry_run:
sample_inputs:
- { competitor: "A店", product_id: "P001", expected_branch: "notify_change" }
- { competitor: "B店", product_id: "P002", expected_branch: "archive" } # 价格未变
- { competitor: "C店", product_id: "P003", expected_branch: "notify_error" } # 模拟失败
checks:
- 每个分支都被走到至少一次
- 字段映射无错位(输出字段名与预期一致)
- 幂等键能去重(同输入跑两次只处理一次)
- 限流生效(并发不超过capacity)
- 错误处理触发(模拟429/500/超时)
no_side_effects:
- 不真正发通知(写入mock通道)
- 不真正写文件(写入/tmp/dry-run/)
- 不真正扣款/下单
干跑脚本骨架
import yaml
from pathlib import Path
def dry_run(workflow_path, samples):
wf = yaml.safe_load(Path(workflow_path).read_text(encoding="utf-8"))
results = []
for sample in samples:
ctx = {**sample, "history_price": 100} # mock历史
for step in wf["workflow"]["steps"]:
ctx = execute_step(step, ctx, dry=True) # dry=True跳过副作用
if step.get("type") == "condition":
branch = evaluate_rules(step["rules"], ctx)
results.append({"sample": sample, "step": step["id"], "branch": branch})
return results
第三步:幂等键设计
重复触发是工作流第一大坑。每个工作流必须有幂等键。
幂等键构造规则
idempotency:
# 规则1:用业务唯一标识 + 时间窗口
key: "${order_id}" # 订单处理:一个订单只处理一次
scope: "global" # 永不去重
# 规则2:定时任务用日期
key: "${competitor}_${date}" # 每日监控:每日每竞品只跑一次
scope: "daily"
# 规则3:webhook用事件ID
key: "${event.id}" # webhook:用事件唯一ID
scope: "global"
去重检查模式
def process_with_idempotency(item, idempotency_key, redis_client):
# 处理前先查"是否已处理"
if redis_client.exists(f"idem:{idempotency_key}"):
return {"status": "skipped", "reason": "already_processed"}
# 处理
result = do_process(item)
# 处理后标记(带TTL)
redis_client.setex(f"idem:{idempotency_key}", 86400, "1") # 24小时TTL
return result
第四步:字段映射校验器
字段映射错位会导致数据串列。强制双向校验。
映射配置
field_mapping:
source_system:
Install 流程架构师 in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the 流程架构师 skill do?
流程架构师是跨平台自动化工作流的设计与执行能力包。它不只给JS示例,更解决四个高频 痛点:复杂分支逻辑难以调试、字段映射错位导致数据串列、重复触发造成重复处理、 API限流未处理导致批量失败。 核心能力: - YAML工作流DSL:用声明式YAML替代JS片段,可版本化、可diff、可dry-run - 干跑校验模式:先跑2-3条样本数据验证全链路,再放量 - 幂等键设计:每个工作流强制幂等键,杜绝重复触发重复处理 - 字段映射校验器:双向校验源字段→目标字段,缺失字段告警 - 限流处理模式:令牌桶 + 退避重试 + 批量请求 - 文档自动生成:从YAML生成工作流文档与可视化图 适用场景: - 电商价格监控、库存同步、订单处理 - 内容素材收集、格式转换、多平台发布 - 数据抓取、清洗、报告生成 - 客户服务自动回复、工单处理 - 项目进度跟踪、状态同步、提醒通知 差异化: - 原始版本用JS对象字面量定义工作流,本版改用YAML DSL可版本化 - 新增dry-run干跑校验章节 - 新增幂等键设计与重复触发防护 - 新增字段映射校验器与限流处理模式 - 增加工作流文档自动生成模板 - 增加故障排查表与FAQ 触发关键词:工作流构建、自动化流程、触发器、条件分支、YAML工作流、干跑、幂等、字段映射、限流
How do I install the 流程架构师 skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the 流程架构师 skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
by Anthropic