# Intelligent Workflow Assistant

> 智能工作流助手 v6.0。深度集成 autonomous-agent 和 swarm-orchestrator。自动分析项目、推荐工作流、决定执行模式（单Agent/蜂群）、触发验证验收。触发词：帮我看看项目、智能工作流、检查项目、推荐工作流。

- Skill: `cyangzhou/intelligent-workflow-assistant` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add cyangzhou/intelligent-workflow-assistant`
- Raw SKILL.md: https://api.skillmd.com/api/skills/cyangzhou/intelligent-workflow-assistant/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: cyangzhou (https://skillmd.com/u/cyangzhou)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/cyangzhou/intelligent-workflow-assistant

---


# Intelligent Workflow Assistant - 智能工作流助手 v6.0

## 🎯 核心定位

**智能推荐引擎**：作为 autonomous-agent 的第2层，负责分析项目上下文、推荐最优执行方案、决定执行模式。

---

## 🚨 执行协议（CRITICAL - 必须执行）

**当此 Skill 被调用后，Agent 必须按照以下步骤执行：**

### 步骤 1：分析项目上下文

执行以下命令获取项目信息：

```python
python -c "
import os
import json
from pathlib import Path

context = {
    'project_type': None,
    'files': {},
    'workflows': []
}

# 检测项目类型
indicators = {
    'python': ['requirements.txt', 'setup.py', 'pyproject.toml'],
    'nodejs': ['package.json', 'yarn.lock', 'pnpm-lock.yaml'],
    'rust': ['Cargo.toml'],
    'go': ['go.mod'],
    'java': ['pom.xml', 'build.gradle']
}

for ptype, files in indicators.items():
    if any(Path(f).exists() for f in files):
        context['project_type'] = ptype
        break

# 扫描可用工作流
workflow_dirs = [
    Path('.trae/workflows'),
    Path('C:/Users/Administrator/.trae-cn/workflows')
]

for wdir in workflow_dirs:
    if wdir.exists():
        for yf in wdir.glob('*.yaml'):
            context['workflows'].append(yf.stem)

print(json.dumps(context, ensure_ascii=False, indent=2))
"
```

### 步骤 2：复杂度评分

根据任务描述计算复杂度分数：

| 关键词类型 | 权重 | 示例 |
|-----------|------|------|
| 复杂关键词 | 3分 | 系统、架构、重构、开发、实现、构建、设计 |
| 中等关键词 | 2分 | 优化、集成、扩展、模块 |
| 简单关键词 | 1分 | 修复、修改、添加、更新、删除 |

### 步骤 3：决定执行模式

```python
# 复杂度分数 >= 6 → swarm 模式
# 复杂度分数 < 6 → single_agent 模式

execution_mode = "swarm" if complexity_score >= 6 else "single_agent"
```

### 步骤 4：返回结果

**必须返回以下格式的结果**：

```json
{
  "execution_mode": "swarm|single_agent",
  "complexity_score": 6,
  "project_context": {
    "project_type": "python|nodejs|...",
    "has_tests": true,
    "has_docs": true
  },
  "recommended_workflows": [
    {
      "name": "workflow-name",
      "priority": "high|medium|low",
      "reason": "推荐理由"
    }
  ],
  "swarm_config": {
    "max_workers": 5,
    "workers": ["researcher", "coder", "tester", "writer", "reviewer"]
  }
}
```

---

## 📐 系统架构

```
┌─────────────────────────────────────────────────────────────────────────────┐
│                    INTELLIGENT WORKFLOW ASSISTANT v4.0                      │
├─────────────────────────────────────────────────────────────────────────────┤
│                                                                             │
│  输入来源                                                                    │
│  ├── autonomous-agent 调用                                                  │
│  └── 用户直接触发（"帮我看看项目"）                                          │
│                                                                             │
│                          │                                                  │
│                          ▼                                                  │
│                                                                             │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ 步骤1: 项目上下文分析 [执行命令]                                      │   │
│  │ • 检测项目类型                                                        │   │
│  │ • 扫描可用工作流                                                      │   │
│  │ • 分析依赖状态                                                        │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│                                    ▼                                        │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ 步骤2: 复杂度评分 [自动计算]                                          │   │
│  │ • 分析任务关键词                                                      │   │
│  │ • 计算复杂度分数                                                      │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│                                    ▼                                        │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ 步骤3: 执行模式决策 [自动判断]                                        │   │
│  │ • 分数 >= 6 → swarm                                                  │   │
│  │ • 分数 < 6 → single_agent                                            │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                    │                                        │
│                                    ▼                                        │
│  ┌─────────────────────────────────────────────────────────────────────┐   │
│  │ 步骤4: 返回结果 [必须执行]                                            │   │
│  │ • execution_mode                                                     │   │
│  │ • recommended_workflows                                              │   │
│  │ • swarm_config (如果适用)                                            │   │
│  └─────────────────────────────────────────────────────────────────────┘   │
│                                                                             │
└─────────────────────────────────────────────────────────────────────────────┘
```

---

## 📊 推荐规则

### 触发规则表

| 触发条件 | 推荐工作流 | 优先级 |
|---------|-----------|--------|
| 依赖文件变更 | dependency-auto-update | 🔴 高 |
| 测试覆盖率 < 80% | code-coverage-report | 🟡 中 |
| API代码变更 | doc-sync-check | 🟡 中 |
| 复杂任务（score≥6） | swarm-execution | 🔴 高 |
| 静态网页开发 | static-webpage-development | 🟡 中 |

---

## 📋 执行示例

### 示例：被 autonomous-agent 调用

```
autonomous-agent 调用:
  task = "重构马年网页"
  context = {}

执行流程:

[步骤1] 分析项目上下文
> 执行 Python 命令
> project_type: 未检测到标准项目
> workflows: [static-webpage-development, git-commit-summary, ...]

[步骤2] 复杂度评分
> 关键词: 重构(3分) + 设计(3分) = 6分

[步骤3] 执行模式决策
> 分数 >= 6 → swarm 模式

[步骤4] 返回结果
{
  "execution_mode": "swarm",
  "complexity_score": 6,
  "project_context": {
    "project_type": "unknown",
    "has_tests": false,
    "has_docs": true
  },
  "recommended_workflows": [
    {"name": "static-webpage-development", "priority": "high", "reason": "检测到HTML文件"}
  ],
  "swarm_config": {
    "max_workers": 4,
    "workers": ["researcher", "coder", "tester", "writer"]
  }
}
```

---

## 🔒 强制规则

1. **必须返回执行模式**：分析完成后必须返回 single_agent 或 swarm
2. **必须返回推荐工作流**：即使为空也要返回列表
3. **蜂群模式必须配置**：如果建议蜂群模式，必须提供 swarm_config
4. **结果必须是 JSON 格式**：方便 autonomous-agent 解析

