选项

plan-orchestrate

affaan-m/ECC affaan-m/ECC

读取计划文档,将其分解为各个步骤,从 ECC 目录中设计每个步骤对应的代理链,并生成可直接粘贴或进行编排的自定义提示,而无需实际执行这些提示。

...展开全部
9
更新时间 2026-10-04

计划 编排

通过为每个步骤生成一条可直接粘贴的调用指令,将计划文档与/orchestrate custom 功能对接。该技能仅提供生成功能——它绝不会执行/orchestrate 命令。用户可在准备就绪时逐行粘贴。

何时启用

  • 用户拥有一个多步骤计划文档(PRD、RFC、实施方案),并希望将其通过/orchestrate 进行处理。
  • 用户说“协调此计划”、“为每个步骤提供协调提示”、“为此计划构建链”。
  • 已有分步计划,但用户不想为每个步骤手动选择代理。

在以下情况下跳过:

  • 工作仅包含一个临时步骤 → 请直接调用/orchestrate custom。
  • 计划不可读或为空。仅缺少明确的编号并不构成跳过条件——请参阅下文的“无明确步骤”边界情况。

输入

 [--lang=python|typescript|go|rust|cpp|java|kotlin|flutter|auto] [--scope=all|step:|range:-] [--dry-run]
  • — 必填;支持相对或绝对路径(接受@docs/...格式)。
  • --lang— 代码审查语言变体;默认值为auto(从项目中检测)。
  • --scope— 限制生成的步骤;默认为all。
  • --dry-run— 仅打印分解 + 链式推理依据;不输出最终提示。

权威的/orchestrate格式(请勿偏离)

{ORCH_CMD} custom ",,...," ""

其中{ORCH_CMD}在第 0 阶段确定(见下文)。发出的输出中的命令字符串始终采用一种具体形式——绝不同时使用两种形式,也绝不使用占位符。

  • custom是一个顺序链;每个代理的 HANDOFF 会传递给下一个。
  • 以逗号分隔的代理列表。建议不使用空格;允许出现一个空格。
  • 不存在--mode/--gate/--agents=...这些标志——切勿自行添加。
  • 代理名称取自该技能的目录。任务描述中嵌入的双引号将转义为\"。

ECC 安装形式与命名空间

两种安装形式决定了斜杠命令及每个代理名称的前缀。这两种形式必须保持同步——每种输出对应一种形式,切勿混用:

设 表示 Claude Code 的主目录:macOS/Linux 系统下为~/.claude,Windows 系统下为%USERPROFILE%\.claude。请按照主机平台解析用户主目录的方式进行解析(切勿硬编码~)。

形式 检测 {ORCH_CMD} 代理名称格式
插件安装(1.9.0+) 是否存在/plugins/marketplaces/everything-claude-code/ /everything-claude-code:orchestrate everything-claude-code:
旧版精简安装 上述路径不存在;代理文件位于/agents/之下 /orchestrate

为何这很重要:在插件安装模式下,代理会注册为everything-claude-code:tdd-guide。仅使用名称会导致模糊匹配,而在并行调用时会间歇性地失败。在传统模式下,带前缀的形式不会被注册,因此会直接失败。

可用代理目录(必须从以下选项中选择)

通用:

  • 规划器— 需求重述、风险分解、步骤规划
  • architect— 架构、系统设计、重构建议
  • tdd-guide— 编写测试 → 实现 → 80%+ 代码覆盖率
  • 代码审查员— 通用代码审查
  • 安全审查员— 安全审计、OWASP、机密泄露
  • 重构清理员— 死代码、重复代码、knip类清理
  • 文档更新员— 文档、代码映射、README
  • docs-lookup— 第三方库 API 查询(Context7)
  • e2e-runner— 端到端测试编排
  • database-reviewer— PostgreSQL 模式、迁移、性能
  • harness-optimizer— 本地代理测试框架配置
  • loop-operator— 长期运行的自主循环
  • chief-of-staff— 多渠道分流(很少适用于计划步骤)

构建错误解决器:

  • build-error-resolver(通用) /cpp-build-resolver/go-build-resolver/java-build-resolver/kotlin-build-resolver/rust-build-resolver/pytorch-build-resolver

代码审查工具:

  • python-reviewer/typescript-reviewer/go-reviewer/rust-reviewer/cpp-reviewer/java-reviewer/kotlin-reviewer/flutter-reviewer

代理名称拼写错误会导致/orchestrate 失败。在发送之前请与本列表进行交叉核对。

工作原理

第 0 阶段 — 检测 ECC 模式 + 编程语言

  1. 读取 。若缺失或为空,则报告并终止。

  2. 检测一次 ECC 安装形式,并将其固定为ECC_MODE。算法(按顺序执行,首次匹配即停止):

    1. 如果存在/plugins/marketplaces/everything-claude-code/→ECC_MODE=plugin。
    2. 否则,如果/agents/存在且包含至少一个 ECC 代理文件(例如tdd-guide.md、code-reviewer.md)→ECC_MODE=legacy。
    3. 否则 → 默认设置为ECC_MODE=legacy,并在输出顶部显示一行警告:> 警告:无法检测到 ECC 安装;默认采用旧版形式。如果您使用插件安装,请手动编辑前缀。
    4. 如果两种标记都存在(混合安装),则以插件设置为准——只有插件命名空间会在解析代理名称时不进行模糊匹配。

    从这一刻起,每行输出中,斜杠命令和所有代理名称均使用匹配的前缀。同一输出中绝不会同时出现两种形式。

  3. 解析--lang。当设置为auto 时,执行支持多语言的检测:

    • 检测标记:pyproject.toml/uv.lock/requirements.txt→ python;package.json→ typescript;go.mod→ go;Cargo.toml→ rust;CMakeLists.txt或顶级*.cpp→ cpp;pom.xml/build.gradle(Java)→ java;build.gradle.kts或顶级 Kotlin → kotlin;pubspec.yaml→ flutter。
    • 多语言平局处理:如果有多个标记匹配,则选择源文件数量最多的语言(通过git ls-files 统计,排除vendor/、node_modules/、dist/、build/、.venv/、生成的文件以及明显的测试 fixture)。 若出现平局,或没有一种语言的源文件占比超过 60%,则将lang 设为unknown。
    • 无标记匹配 → 设置lang=unknown。
    • lang=unknown是一个哨兵值——它不是代理名称。在第二阶段的规则 4 和 5 中,它会在构建链组合时被转换为代码审查者/构建错误解决者。
  4. 检测PyTorch 子配置文件:当lang=python且pyproject.toml/requirements.txt/uv.lock中的任意文件声明了对torch 的依赖时,将pytorch 设为 true。这仅影响构建链的选择(见下文第二阶段规则);代码审查者仍保持为python-reviewer。

  5. 规范化计划中声明的任何代理名称:如果计划文本以带有插件前缀的形式引用代理(例如everything-claude-code:tdd-guide),则在验证或组合链之前,去除前缀以获取原始目录名称。 根据ECC_MODE(第 4 阶段),仅在输出时才会重新添加前缀。切勿让已添加前缀的名称流入链组合过程——这会在插件模式下导致前缀重复。

第 1 阶段 — 分解步骤

按优先级顺序识别“步骤单元”:

  1. 显式编号:## 第 N 步/### 第 N 阶段/## N. .../ 顶级有序列表。
  2. 表格中的“步骤”列。
  3. ----以动词开头的标题分隔的块。
  4. 否则将每个H2视为一个步骤。

针对每个步骤提取ID(从1开始)、标题(≤80个字符)、意图(1–3句话)和标签。

第 2 阶段 — 标签与链式筛选

按意图进行标注(允许多标签;标签链由主标签 + 堆叠的次级标签构成):

以下触发词匹配不区分大小写。多语言方案通过匹配任何语言的词干来支持,只要其含义与列出的英文触发词一致即可。

标签 触发词 默认链
设计 建筑, 设计, 选择, 评估, RFC 规划师、架构师
计划 计划、分解、里程碑 规划师
impl 实现、构建、添加、创建、移植 TDD指南,-审阅者
测试 测试、覆盖率、端到端、集成 tdd-guide,e2e-runner
重构 重构、清理、去重、拆分 架构师、重构清理工具、-reviewer
迁移 迁移、升级、重写、移植 架构师、TDD指南、-reviewer
数据库 模式、迁移、索引、SQL、Postgres、alembic、sqlmodel 数据库审查员,-reviewer
安全 加密、身份验证、密钥、OWASP、PII 安全审查员,-reviewer
构建 构建、编译、代码检查失败、持续集成 -构建解析器(回退到构建错误解析器)
文档 文档、读我文件、代码映射、变更日志 文档更新器
查找 lookup、参考、API 使用说明 文档查询
review 审查、审计、验证 -审阅者、代码审阅者
循环 循环、自主、看门狗 循环运算符

链式组合规则:

  1. 主标签选择:当某一步匹配多个标签时,按表中顺序排在最前面的那个(表首 = 最高优先级)为主标签;其余为次要标签。下文的组合规则 2 和 3 明确处理特定的多标签组合;否则,按标签表中的顺序追加次要链。
  2. impl+security→tdd-guide,-reviewer,security-reviewer.
  3. impl+db→tdd-guide,database-reviewer,-reviewer。
  4. 对生成的链进行去重(保留首次出现的结果)。例如,review+lang=unknown根据规则 5 会生成code-reviewer,code-reviewer;去重后将其合并为code-reviewer。
  5. 当 lang=unknown 时,-reviewer解析为code-reviewer。
  6. 当 lang=unknown 时,- build -resolver解析为build-error-resolver。特殊情况:如果第 0 阶段设置了pytorch=true,则无论 。不存在python-build-resolver;当--lang=python且pytorch=true未设置时,将解析为build-error-resolver。
  7. 零标签步骤:如果没有触发词匹配,则将链设置为code-reviewer并写入“未匹配任何标签”;在“链理由”下默认使用仅审查链。
  8. 去重后链长度 ≤ 4。若超出,则舍弃最弱的标签(优先舍弃“lookup”和“docs”)。
  9. 不要在实现链中将规划师和架构师配对(浪费令牌)。仅在设计步骤中将它们配对。
  10. 标记为impl、refactor 或migration的步骤以reviewer 类代理结尾——即-reviewer、code-reviewer、security-reviewer 或database-reviewer 中的任意一个。 最符合领域特性的审阅者将占据末尾位置(例如:规则 2 的impl+security以security-reviewer 结束;规则 3 的impl+db以-reviewer结束,因为database-reviewer已在链条更早阶段对 migration 进行了门控)。测试和 构建步骤由各自的验证器(分别是e2e-runner和构建解析器)进行门控,无需额外的审核员。

第三阶段 — 压缩任务描述

每个生成的 必须:

  • 自成体系(第一个代理无需打开计划文档)。
  • 以[Plan:#step-] 开头。
  • 包含 1–3 条可验证的验收标准。
  • 仅当计划为此步骤声明了范围限制(范围外:...)时,才包含该限制。应原样继承。如果计划中没有范围外声明,则完全省略该子句——切勿自行添加。
  • 长度为 200–600 个字符;仅占一行;转义字符 "需用\ 表示;不得包含字面换行符。

第 4 阶段 — 输出

使用由ECC_MODE确定的格式输出 Markdown。 输出应始终采用统一格式——每个{ORCH_CMD}和每个代理名称均应使用第 0 阶段对应的前缀进行渲染。请勿同时输出两种形式;请勿在渲染后的输出中包含“这是插件形式”或“去除前缀”等说明。

具体渲染规则:

  • {ORCH_CMD}=插件模式下为/everything-claude-code:orchestrate ,旧版模式下为/orchestrate。
  • {AGENT(name)}= 在插件模式下为everything-claude-code:, 在旧版中。
  • 概览表中的“Chain”列采用相同的{AGENT(name)}渲染方式。
  • 每步的 bash 代码块仅包含可执行的命令。不包含# plugin 形式或# legacy 形式的注释——该形式是隐含的,并在整个输出中保持统一。

输出结构:

#Plan-Orchestrate 结果

**计划**:``
**语言**:``
**ECC 模式**:``
**步骤**:
**范围**:

## 步骤概览

| # | 标题 | 标签 | 链 |
|---|---|---|---|
| 1 | ... | 实现, 数据库 | `{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}` |
| ... | | | |

---

## 步骤 1 —

**意图**:<1–3 sentences>
**标签**:<a, b>
**链条依据**:<why this chain; which agent closes the loop>

```bash
{ORCH_CMD} custom "{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}" "[计划: docs/foo.md#step-1]<compressed task description>; 验收:<1–3 items>; 超出范围:<…>"
```
</code></pre>
<blockquote>
<p>上文中的<code>{ORCH_CMD}</code>和<code>{AGENT(...)}</code>表示法描述了该技能在运行时执行的替换操作。实际输出的 Markdown 内容包含已解析的字符串,绝不会包含占位符。</p>
</blockquote>
<p>在末尾追加一个“批量执行”块,按顺序汇总每个步骤的命令,以便用户可以一次性粘贴所有命令。<strong>在仅显示概览的模式下跳过该批量块</strong>(参见“大型计划”边界情况):当仅输出概览表时,没有需要汇总的逐步命令。</p>
<h3>第 5 阶段 — 自检(在输出前运行)</h3>
<ul>
<li><input disabled="" type="checkbox"> 每个链中的每个代理均来自目录(在计划中移除任何以<code>everything-claude-code:</code>开头的前缀后;参见第 0 阶段第 5 步)。</li>
<li><input disabled="" type="checkbox"> 已解析的<code>{ORCH_CMD}</code>以及每个已解析的<code>{AGENT(...)}</code>均采用<strong>相同</strong>的形式(<code>插件</code>或<code>传统形式</code>)——绝不会在同一输出中混用。</li>
<li><input disabled="" type="checkbox"> 渲染后的输出中不再包含任何<code># 插件形式</code>/<code># 传统形式</code>注释,也不再有“去除前缀”的指令。</li>
<li><input disabled="" type="checkbox"> 不存在虚构的<code>--mode</code>/<code>--gate</code>/<code>--agents=...</code>字段。</li>
<li><input disabled="" type="checkbox"> 每个任务描述均为单行,用双引号引起来,其中的<code>"</code>已转义。</li>
<li><input disabled="" type="checkbox"> 每个任务描述以<code>[Plan:<path>#step-<id>]</code>开头,并包括验收条件(1–3 项)。只有从计划中继承时,才会出现<code>“Out of scope:”</code>子句。</li>
<li><input disabled="" type="checkbox"> 在第 2 阶段去重后,任何链中均不存在重复的代理。</li>
<li><input disabled="" type="checkbox"> 链长度 ≤ 4。</li>
<li><input disabled="" type="checkbox"> 标记为<code>impl/refactor/migration</code>的步骤以评审员类代理(<code><lang>-reviewer</code>、<code>code-reviewer</code>、<code>security-reviewer</code> 或<code>database-reviewer</code>)结尾。<code>test</code>和<code>build</code>除外——参见第二阶段规则 10。</li>
<li><input disabled="" type="checkbox"> 无标签的步骤会发出<code>“code-reviewer</code>”,理由为<code>“无匹配标签”;默认采用仅审查链</code>。</li>
<li><input disabled="" type="checkbox"> 概述表列出了计划中的每个步骤,无论<code>--scope</code> 参数如何。</li>
<li><input disabled="" type="checkbox"> 每个步骤的详细信息块数量与已确定的<code>--scope</code>参数相匹配(当<code>--scope=all</code> 时为完整计划;<code>step:n</code> 时为一个块;<code>range:a-b</code> 时为范围大小)。在仅概述模式下,不会生成每个步骤的块,也不会生成“批处理”块。</li>
</ul>
<h2>边界情况</h2>
<ul>
<li><strong>无明确步骤</strong>:优先采用 H2/H3 拆分;若仍存在歧义,则报告“未检测到结构化步骤”,同时提供文档大纲,并请用户确认是否按大纲运行。</li>
<li><strong>大型计划(>1500 行)</strong>:进入<strong>仅概述模式</strong>——仅输出概述表,并提示用户使用<code>--scope</code>缩小范围后再重新运行以获取详细信息。在此模式下,跳过每步的详细信息块和“批处理”执行块。</li>
<li><strong>步骤范围过广</strong>(例如“完成所有后端工作”):不要强行生成单一链。建议拆分为 N.a 和 N.b,并提出拆分方案。</li>
<li><strong>计划声明代理</strong>(罕见):首先<strong>去除任何<code>everything-claude-code:</code>前缀以</strong>获取原始目录名称(第 0 阶段第 5 步),然后对照目录进行验证。替换无效的代理,并在“链条依据”下进行说明。输出时将根据<code>ECC_MODE</code> 对原始名称重新添加前缀。</li>
<li><strong>在<code>--lang=auto</code>无法确定优选方案的多语言项目中</strong>:将<code>lang</code> 设为<code>unknown</code>;将 reviewer 解析为<code>code-reviewer</code>,并将 build resolver 解析为<code>build-error-resolver</code>。在“链条依据”部分提及该备选方案。</li>
</ul>
<h2>示例</h2>
<h3>示例 1 — 插件模式,Python 方案</h3>
<p>输入:</p>
<pre><code>plan-orchestrate @docs/plan/example-feature.md --lang=python
</code></pre>
<p>预期输出摘录:</p>
<pre><code class="language-markdown">## 第 2 步 — 加密敏感的 UserProfile 字段

**目标**:引入一个 `EncryptedString` SQLAlchemy 类型,并在持久化前使用 AES-GCM 对 `birth_datetime` / `location` 进行加密;从环境变量中加载密钥。
**标签**:实现, 安全, 数据库
**审查链依据**:由于涉及安全敏感的写入路径,因此由 `security-reviewer` 负责关闭审查链;`database-reviewer` 负责验证 Alembic 迁移;`python-reviewer` 负责检查类型和 PEP 8 规范。

```bash
/everything-claude-code:orchestrate custom "everything-claude-code:tdd-guide,everything-claude-code:database-reviewer,everything-claude-code:python-reviewer,everything-claude-code:security-reviewer" “[计划:docs/plan/example-feature.md#step-2] 实现 EncryptedString SQLAlchemy 类型,并迁移 UserProfile.birth_datetime/location 列;密钥来自环境变量 APP_DB_KEY; 验收标准:加密/解密往返测试通过;在空数据库上,Alembic 的升级/降级操作无异常;迁移后数据库中无明文;范围外:跨租户个人资料共享逻辑"
```
</code></pre>
<h3>示例 2 — 传统模式,相同步骤</h3>
<p>若检测到<code>ECC_MODE=legacy</code>,则会将该步骤作为单条统一命令输出(输出中任何位置均不包含以插件前缀开头的形式):</p>
<pre><code class="language-bash">/orchestrate custom "tdd-guide,database-reviewer,python-reviewer,security-reviewer" "[Plan: docs/plan/example-feature.md#step-2] ..."
</code></pre>
<p>上述两个示例展示了<strong>两种</strong>不同环境下的<strong>两种可能输出</strong>。单次技能调用仅会生成其中一种,且为端到端输出。</p>
<h2>注意事项</h2>
<ul>
<li>仅限生成模式。切勿在此技能内部调用<code>/orchestrate</code>。</li>
<li>任务描述应与计划文档的语言保持一致(代理名称始终保持为英文)。</li>
<li>除非用户明确要求,否则请勿在输出中插入“Co-Authored-By”行或表情符号。</li>
</ul>                                </div>
                                <div class="skilldetailsL1_skillmd">
                                    <a href="https://github.com/affaan-m/ECC/tree/main/skills/plan-orchestrate" title="在 GitHub 上查看" target="_blank" rel="nofollow"
                                        aria-label="在 GitHub 上查看" class="skilldetails_toGitHub">
                                        <span>在 GitHub 上查看</span>
                                        <b></b>
                                    </a>
                                    <pre><code>---
name: plan-orchestrate
description: Reads a plan document, decomposes it into steps, designs a per-step agent chain from the ECC catalogue, and emits ready-to-paste /orchestrate custom prompts without executing them.
---

# Plan Orchestrate

Bridge a plan document to `/orchestrate custom` by emitting one ready-to-paste invocation per step. The skill is generative only — it never executes `/orchestrate`. The user pastes each line when ready.

## When to Activate

- User has a multi-step plan document (PRD, RFC, implementation plan) and wants to drive it through `/orchestrate`.
- User says "orchestrate this plan", "give me orchestrate prompts for each step", "compose chains for this plan".
- A step-by-step plan exists but the user does not want to manually pick agents per step.

Skip when:
- The work is one ad-hoc step → call `/orchestrate custom` directly.
- The plan is unreadable or empty. Lack of explicit numbering alone is not a skip condition — see the "No clear steps" edge case below.

## Inputs

```
<plan-doc-path> [--lang=python|typescript|go|rust|cpp|java|kotlin|flutter|auto] [--scope=all|step:<n>|range:<a>-<b>] [--dry-run]
```

- `<plan-doc-path>` — required; relative or absolute path (`@docs/...` accepted).
- `--lang` — reviewer language variant; defaults to `auto` (detected from project).
- `--scope` — limits emitted steps; defaults to `all`.
- `--dry-run` — print decomposition + chain rationale only; do not emit final prompts.

## Authoritative `/orchestrate` shape (do not deviate)

```
{ORCH_CMD} custom "<agent1>,<agent2>,...,<agentN>" "<task description>"
```

Where `{ORCH_CMD}` is determined in Phase 0 (see below). The command string in the emitted output **always uses one concrete form** — never both, never a placeholder.

- `custom` is a sequential chain; each agent's HANDOFF feeds the next.
- Comma-separated agent list. No spaces preferred; one space tolerated.
- No `--mode` / `--gate` / `--agents=...` flags exist — never invent them.
- Agent names come from the catalogue in this skill. Embedded double quotes in the task description are escaped as `\"`.

## ECC install form and namespacing

Two install forms determine the prefix on **both** the slash command and every agent name. The two MUST stay in sync — one form per output, never mixed:

Let `<claude-home>` denote the Claude Code home directory: `~/.claude` on macOS/Linux, `%USERPROFILE%\.claude` on Windows. Resolve it the way the host platform resolves the user home directory (do not hardcode `~`).

| Form | Detection | `{ORCH_CMD}` | Agent name format |
|---|---|---|---|
| Plugin install (1.9.0+) | `<claude-home>/plugins/marketplaces/everything-claude-code/` exists | `/everything-claude-code:orchestrate` | `everything-claude-code:<name>` |
| Legacy bare install | Above absent; agent files under `<claude-home>/agents/` | `/orchestrate` | `<name>` |

Why this matters: under the plugin install, agents register as `everything-claude-code:tdd-guide`. Bare names force fuzzy matching, which fails intermittently under parallel calls. Under legacy, the prefixed forms are not registered and fail outright.

## Available agent catalogue (must pick from these)

General:
- `planner` — requirement restatement, risk decomposition, step planning
- `architect` — architecture, system design, refactor proposals
- `tdd-guide` — write tests → implement → 80%+ coverage
- `code-reviewer` — generic code review
- `security-reviewer` — security audit, OWASP, secret leakage
- `refactor-cleaner` — dead code, duplicates, knip-class cleanup
- `doc-updater` — documentation, codemap, README
- `docs-lookup` — third-party library API lookups (Context7)
- `e2e-runner` — end-to-end test orchestration
- `database-reviewer` — PostgreSQL schema, migration, performance
- `harness-optimizer` — local agent harness configuration
- `loop-operator` — long-running autonomous loops
- `chief-of-staff` — multi-channel triage (rarely a fit for plan steps)

Build error resolvers:
- `build-error-resolver` (generic) / `cpp-build-resolver` / `go-build-resolver` / `java-build-resolver` / `kotlin-build-resolver` / `rust-build-resolver` / `pytorch-build-resolver`

Code reviewers:
- `python-reviewer` / `typescript-reviewer` / `go-reviewer` / `rust-reviewer` / `cpp-reviewer` / `java-reviewer` / `kotlin-reviewer` / `flutter-reviewer`

A misspelled agent name fails `/orchestrate`. Cross-check against this list before emitting.

## How It Works

### Phase 0 — Detect ECC mode + language

1. Read `<plan-doc-path>`. If missing or empty, report and stop.
2. Detect ECC install form once and freeze it into `ECC_MODE`. Algorithm (run in order, stop at the first match):
   1. If `<claude-home>/plugins/marketplaces/everything-claude-code/` exists → `ECC_MODE=plugin`.
   2. Else if `<claude-home>/agents/` exists and contains at least one ECC agent file (e.g. `tdd-guide.md`, `code-reviewer.md`) → `ECC_MODE=legacy`.
   3. Else → default to `ECC_MODE=legacy` and emit a one-line warning at the top of the output: `> Warning: could not detect ECC install; defaulting to legacy form. If you use the plugin install, edit the prefixes manually.`
   4. If both markers exist (mixed install), `plugin` wins — the plugin namespace is the only one that resolves agent names without fuzzy matching.

   From this point on, every emitted line uses the matching prefix on **both** the slash command and every agent name. **Never emit both forms in the same output.**
3. Resolve `--lang`. When `auto`, run a polyglot-aware detection:
   - Probe markers: `pyproject.toml` / `uv.lock` / `requirements.txt` → python; `package.json` → typescript; `go.mod` → go; `Cargo.toml` → rust; `CMakeLists.txt` or top-level `*.cpp` → cpp; `pom.xml` / `build.gradle` (Java) → java; `build.gradle.kts` or top-level Kotlin → kotlin; `pubspec.yaml` → flutter.
   - **Polyglot tie-break**: if more than one marker matches, pick the language whose source files outnumber the others (count via `git ls-files`, excluding `vendor/`, `node_modules/`, `dist/`, `build/`, `.venv/`, generated files, and obvious test fixtures). On a tie or when no language exceeds 60% of source files, set `lang=unknown`.
   - No marker matched → set `lang=unknown`.
   - `lang=unknown` is a sentinel — it is **not** an agent name. Phase 2 rules 4 and 5 turn it into `code-reviewer` / `build-error-resolver` at chain composition time.
4. Detect a **PyTorch sub-profile**: when `lang=python` and any of `pyproject.toml` / `requirements.txt` / `uv.lock` declares a dependency on `torch`, set `pytorch=true`. This only affects `build` chain selection (Phase 2 rule below); the reviewer remains `python-reviewer`.
5. **Normalize any agent names declared in the plan**: if the plan text references agents by their plugin-prefixed form (e.g. `everything-claude-code:tdd-guide`), strip the prefix to get the bare catalogue name before validating or composing chains. Re-prefixing happens only at output time per `ECC_MODE` (Phase 4). Never let a pre-prefixed name flow into chain composition — it would double-prefix in plugin mode.

### Phase 1 — Decompose steps

Identify "step units" in priority order:

1. Explicit numbering: `## Step N` / `### Phase N` / `## N. ...` / top-level ordered list.
2. A "Step" column in a table.
3. `---`-separated blocks with verb-led headings.
4. Otherwise treat each H2 as one step.

Per step extract `id` (1-based), `title` (≤ 80 chars), `intent` (1–3 sentences), `tags`.

### Phase 2 — Tag and pick chain

Tag by intent (multi-tag allowed; chain built from primary + stacked secondaries):

Trigger words below are matched case-insensitively. Multilingual plans are supported by matching the word stems in any language as long as the meaning aligns with the listed English trigger words.

| Tag | Trigger words | Default chain |
|---|---|---|
| `design` | architecture, design, choose, evaluate, RFC | `planner,architect` |
| `plan` | plan, breakdown, milestone | `planner` |
| `impl` | implement, build, add, create, port | `tdd-guide,<lang>-reviewer` |
| `test` | test, coverage, e2e, integration | `tdd-guide,e2e-runner` |
| `refactor` | refactor, cleanup, dedupe, split | `architect,refactor-cleaner,<lang>-reviewer` |
| `migration` | migrate, upgrade, rewrite, port | `architect,tdd-guide,<lang>-reviewer` |
| `db` | schema, migration, index, SQL, Postgres, alembic, sqlmodel | `database-reviewer,<lang>-reviewer` |
| `security` | encrypt, auth, secret, OWASP, PII | `security-reviewer,<lang>-reviewer` |
| `build` | build, compile, lint failure, CI | `<lang>-build-resolver` (falls back to `build-error-resolver`) |
| `docs` | docs, readme, codemap, changelog | `doc-updater` |
| `lookup` | lookup, reference, API usage | `docs-lookup` |
| `review` | review, audit, verify | `<lang>-reviewer,code-reviewer` |
| `loop` | loop, autonomous, watchdog | `loop-operator` |

Chain composition rules:
1. **Primary tag selection**: when a step matches multiple tags, the **first one in table order** (top of the table = highest priority) is the primary; the rest are secondaries. Composition rules 2 and 3 below handle specific multi-tag combinations explicitly; otherwise, append secondary chains in tag table order.
2. `impl` + `security` → `tdd-guide,<lang>-reviewer,security-reviewer`.
3. `impl` + `db` → `tdd-guide,database-reviewer,<lang>-reviewer`.
4. **Deduplicate** the resulting chain (preserve first occurrence). E.g. `review` + `lang=unknown` would yield `code-reviewer,code-reviewer` after rule 5; deduplication collapses it to `code-reviewer`.
5. `<lang>-reviewer` resolves to `code-reviewer` when `lang=unknown`.
6. `<lang>-build-resolver` resolves to `build-error-resolver` when `lang=unknown`. **Special case**: if Phase 0 set `pytorch=true`, use `pytorch-build-resolver` for `build` chains regardless of `<lang>`. There is no `python-build-resolver`; `--lang=python` without `pytorch=true` resolves to `build-error-resolver`.
7. **Zero-tag steps**: if no trigger word matches, set chain to `code-reviewer` and write `no tag matched; default review-only chain` under "Chain rationale".
8. Chain length ≤ 4 after deduplication. If exceeded, drop weakest tag (`lookup` and `docs` first).
9. Do not pair `planner` and `architect` in an `impl` chain (token waste). Pair them only on `design` steps.
10. Steps tagged `impl`, `refactor`, or `migration` end with a **reviewer-class** agent — any of `<lang>-reviewer`, `code-reviewer`, `security-reviewer`, or `database-reviewer`. The most domain-specific reviewer wins the tail position (e.g. rule 2's `impl+security` ends with `security-reviewer`; rule 3's `impl+db` ends with `<lang>-reviewer` because `database-reviewer` already gates the migration earlier in the chain). `test` and `build` steps are gated by their own validators (`e2e-runner` and the build resolver respectively) and do not require an additional reviewer.

### Phase 3 — Compress task description

Each emitted `<task description>` must:
- Be self-contained (the first agent does not need the plan document open).
- Start with `[Plan: <path>#step-<id>]`.
- Include 1–3 verifiable Acceptance criteria.
- Include a Scope guard (`Out of scope: ...`) **only if the plan declares one for this step**. Inherit verbatim. If the plan has no out-of-scope statement, omit the clause entirely — do not invent one.
- Be 200–600 characters; one line; embedded `"` escaped as `\"`; no literal newlines.

### Phase 4 — Output

Emit Markdown using **the form determined by `ECC_MODE`**. The output uses one form throughout — every `{ORCH_CMD}` and every agent name is rendered with the matching prefix from Phase 0. **Do not emit both forms; do not include "this is plugin form" / "strip the prefix" instructions in the rendered output.**

Concrete rendering rules:

- `{ORCH_CMD}` = `/everything-claude-code:orchestrate` under `plugin`, `/orchestrate` under `legacy`.
- `{AGENT(name)}` = `everything-claude-code:<name>` under `plugin`, `<name>` under `legacy`.
- The overview-table "Chain" column uses the same `{AGENT(name)}` rendering.
- Per-step bash blocks contain only the runnable command. **No `# plugin form` or `# legacy form` comments** — the form is implicit and uniform across the whole output.

Output structure:

````markdown
# Plan-Orchestrate Result

**Plan**: `<path>`
**Lang**: `<detected-or-given>`
**ECC mode**: `<plugin | legacy>`
**Steps**: <N>
**Scope**: <all | step:n | range:a-b>

## Steps overview

| # | Title | Tags | Chain |
|---|---|---|---|
| 1 | ... | impl, db | `{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}` |
| ... | | | |

---

## Step 1 — <title>

**Intent**: <1–3 sentences>
**Tags**: <a, b>
**Chain rationale**: <why this chain; which agent closes the loop>

```bash
{ORCH_CMD} custom "{AGENT(tdd-guide)},{AGENT(database-reviewer)},{AGENT(python-reviewer)}" "[Plan: docs/foo.md#step-1] <compressed task description>; Acceptance: <1–3 items>; Out of scope: <…>"
```
````

> The `{ORCH_CMD}` and `{AGENT(...)}` notation above describes the substitution this skill performs at runtime. The actual emitted Markdown contains the resolved strings, never the placeholders.

Append a final "Batch execution" block aggregating every step's command in order so the user can paste them all at once. **Skip the Batch block in overview-only mode** (see "Large plan" edge case): when only the overview table is being emitted, there are no per-step commands to aggregate.

### Phase 5 — Self-check (run before emitting)

- [ ] Every agent in every chain comes from the catalogue (after stripping any `everything-claude-code:` prefix that appeared in the plan; see Phase 0 step 5).
- [ ] Resolved `{ORCH_CMD}` and every resolved `{AGENT(...)}` use the **same** form (`plugin` or `legacy`) — never mixed in one output.
- [ ] No `# plugin form` / `# legacy form` annotations and no "strip the prefix" instructions remain in the rendered output.
- [ ] No invented `--mode` / `--gate` / `--agents=...` fields.
- [ ] Each task description is single-line, double-quoted, with embedded `"` escaped.
- [ ] Each task description begins with `[Plan: <path>#step-<id>]` and includes Acceptance (1–3 items). The `Out of scope:` clause is present only when inherited from the plan.
- [ ] No duplicate agent in any chain after Phase 2 dedup.
- [ ] Chain length ≤ 4.
- [ ] Steps tagged `impl`/`refactor`/`migration` end with a reviewer-class agent (`<lang>-reviewer`, `code-reviewer`, `security-reviewer`, or `database-reviewer`). `test` and `build` are exempt — see Phase 2 rule 10.
- [ ] Zero-tag steps emit `code-reviewer` with the rationale `no tag matched; default review-only chain`.
- [ ] Overview table lists every step in the plan, regardless of `--scope`.
- [ ] Per-step detail block count matches the resolved `--scope` (full plan when `--scope=all`; one block for `step:n`; range size for `range:a-b`). In overview-only mode, no per-step blocks and no Batch block are emitted.

## Edge cases

- **No clear steps**: prefer H2/H3 splitting; if still ambiguous, report "no structured steps detected" with the document outline and ask the user to confirm running by outline.
- **Large plan (>1500 lines)**: enter **overview-only mode** — emit only the overview table and ask the user to narrow with `--scope` before re-running for details. In this mode, skip per-step detail blocks and skip the Batch execution block.
- **Step too broad** (e.g. "complete all backend work"): do not force a single chain. Suggest splitting into N.a and N.b and propose a split.
- **Plan declares agents** (rare): first **strip any `everything-claude-code:` prefix** to get the bare catalogue name (Phase 0 step 5), then validate against the catalogue. Replace invalid agents and explain under "Chain rationale". The bare name is re-prefixed at output time per `ECC_MODE`.
- **Polyglot project where `--lang=auto` cannot pick a winner**: set `lang=unknown`; reviewer resolves to `code-reviewer` and build resolver to `build-error-resolver`. Mention the fallback under "Chain rationale".

## Examples

### Example 1 — Plugin mode, Python plan

Input:
```
plan-orchestrate @docs/plan/example-feature.md --lang=python
```

Excerpt of expected output:
````markdown
## Step 2 — Encrypt sensitive UserProfile fields

**Intent**: Introduce an `EncryptedString` SQLAlchemy type and AES-GCM encrypt `birth_datetime` / `location` before persistence; load the key from an environment variable.
**Tags**: impl, security, db
**Chain rationale**: Security-sensitive write path, so `security-reviewer` closes the chain; `database-reviewer` validates the alembic migration; `python-reviewer` covers typing and PEP 8.

```bash
/everything-claude-code:orchestrate custom "everything-claude-code:tdd-guide,everything-claude-code:database-reviewer,everything-claude-code:python-reviewer,everything-claude-code:security-reviewer" "[Plan: docs/plan/example-feature.md#step-2] Implement EncryptedString SQLAlchemy type and migrate UserProfile.birth_datetime/location columns; key from ENV APP_DB_KEY; Acceptance: encrypt/decrypt roundtrip tests pass; alembic upgrade/downgrade clean on empty DB; no plaintext in DB after migrate; Out of scope: cross-tenant profile sharing logic"
```
````

### Example 2 — Legacy mode, same step

If `ECC_MODE=legacy` were detected, the same step would be emitted as a single uniform command (no plugin-prefixed forms anywhere in the output):

```bash
/orchestrate custom "tdd-guide,database-reviewer,python-reviewer,security-reviewer" "[Plan: docs/plan/example-feature.md#step-2] ..."
```

The two examples above illustrate **the two possible outputs** for two different environments. A single skill invocation produces only one of them, end to end.

## Notes

- Generative only. Never invoke `/orchestrate` from inside this skill.
- Match the language of the plan document for task descriptions (agent names always remain English).
- Do not insert "Co-Authored-By" lines or emoji in the output unless the user explicitly asks.
</code></pre>                                </div>
                            </div>

                        </div>
                        <script>
                            layui.use(function () {
                                var element = layui.element;
                                element.tab({
                                    headerElem: "#skilldetailsL1_header>button",
                                    bodyElem: "#skilldetailsL1_body>div",
                                });
                            });
                        </script>
                        <div class="skilldetailsL2">
                            <div class="skilldetailsL2_title">
                                <h2>所有文件</h2>
                                <span>1 个文件</span>
                            </div>
                                                        <div class="skillFiles">
                                <div class="skillFilesL">
                                    <b></b>
                                    <a href="https://github.com/affaan-m/ECC/tree/main/skills/plan-orchestrate" title="plan-orchestrate.md" target="_blank"
                                        aria-label="plan-orchestrate.md"
                                        rel="nofollow">plan-orchestrate.md</a>
                                    <span>17.5k</span>
                                </div>
                                <a href="https://github.com/affaan-m/ECC/tree/main/skills/plan-orchestrate" title="查看" target="_blank" aria-label="查看"
                                    rel="nofollow">查看</a>
                            </div>
                                                    </div>
                    </div>
                    <div class="skilldetailsR">
                        <div class="skilldetailsR1">
                            <div class="skilldetailsR1s">
                                <h2>安装 plan-orchestrate</h2>
                                <div class="skilldetailsR1s_header" id="skilldetailsR1s_header">
                                    <button class="layui-this">
                                        <b></b>
                                        <span>下载ZIP</span>
                                    </button>
                                    <button class="">
                                        <b></b>
                                        <span>Git Clone</span>
                                    </button>
                                </div>
                                <div class="skilldetailsR1s_body" id="skilldetailsR1s_body">
                                    <div class="skilldetailsR1s_body1 layui-show">
                                        <p>下载技能文件并将其解压到 .claude/skills/ 目录中。</p>
                                        <a href="javascript:;" title="下载ZIP" data-source="TeeN26C1ni2ZDZRkOJVh9w"
                                            aria-label="下载ZIP" role="button" class="skill_downloadzip">
                                            <b></b>
                                            <span>下载ZIP</span>
                                        </a>
                                    </div>
                                    <div class="skilldetailsR1s_body2">
                                        <p>克隆仓库并复制技能文件到您的项目中。</p>
                                        <div class="skill_clone">
                                            <p>
                                                git clone https://github.com/affaan-m/ECC/tree/main/skills/plan-orchestrate
# Copy SKILL.md to your .claude/skills/ directory                                            </p>
                                            <a href="javascript:;" title="复制" role="button" aria-label="复制"
                                                class="skill_clone_copy">
                                                <img src="/assets/images/prompt_word2RMs_p_btn.png"
                                                    alt="复制" />
                                                <span>复制</span>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                <div class="skilldetailsR1s_info">
                                    <span>快速设置: </span>
                                    将技能文件夹复制到 .claude/skills/
Claude 会自动检测并使用该技能                                </div>
                                <div class="skilldetailsR1s_repository">
                                    <span>仓库</span>
                                    <a href="https://github.com/affaan-m/ECC/tree/main/skills/plan-orchestrate" title="affaan-m/ECC" target="_blank"
                                        aria-label="仓库" rel="nofollow">affaan-m/ECC</a>
                                </div>
                            </div>
                        </div>
                        <div class="skilldetailsR2">
                            <h2>相关技能</h2>
                            <div>
                                                                <div class="skilldetailsR2s">
                                    <a href="/zh/skill/detail/airtableautomation.html" title="airtable-automation" aria-label="airtable-automation">airtable-automation</a>
                                    <div>
                                        <div class="skilldetailsR2s_time">
                                            <b></b>
                                            <span>更新时间                                                2026-06-29</span>
                                        </div>
                                        <button class="xix_star skill_datas"
                                            data-source="P_PqrAzxvKSebU4gaXatSw">
                                            <b></b>
                                            <span
                                                class="collectNums_P_PqrAzxvKSebU4gaXatSw">0</span>
                                        </button>
                                    </div>
                                </div>
                                                                <div class="skilldetailsR2s">
                                    <a href="/zh/skill/detail/notionautomation.html" title="notion-automation" aria-label="notion-automation">notion-automation</a>
                                    <div>
                                        <div class="skilldetailsR2s_time">
                                            <b></b>
                                            <span>更新时间                                                2026-06-29</span>
                                        </div>
                                        <button class="xix_star skill_datas"
                                            data-source="yLOF7em0zgx36kG9EQmIAQ">
                                            <b></b>
                                            <span
                                                class="collectNums_yLOF7em0zgx36kG9EQmIAQ">0</span>
                                        </button>
                                    </div>
                                </div>
                                                                <div class="skilldetailsR2s">
                                    <a href="/zh/skill/detail/seoprogrammatic.html" title="seo-programmatic" aria-label="seo-programmatic">seo-programmatic</a>
                                    <div>
                                        <div class="skilldetailsR2s_time">
                                            <b></b>
                                            <span>更新时间                                                2026-06-29</span>
                                        </div>
                                        <button class="xix_star skill_datas"
                                            data-source="qrlDZwmv4vNLPwqrODKcOQ">
                                            <b></b>
                                            <span
                                                class="collectNums_qrlDZwmv4vNLPwqrODKcOQ">0</span>
                                        </button>
                                    </div>
                                </div>
                                                                <div class="skilldetailsR2s">
                                    <a href="/zh/skill/detail/revops.html" title="revops" aria-label="revops">revops</a>
                                    <div>
                                        <div class="skilldetailsR2s_time">
                                            <b></b>
                                            <span>更新时间                                                2026-06-29</span>
                                        </div>
                                        <button class="xix_star skill_datas"
                                            data-source="ZDIT-veTOzkFQQ0eUEoT-g">
                                            <b></b>
                                            <span
                                                class="collectNums_ZDIT-veTOzkFQQ0eUEoT-g">0</span>
                                        </button>
                                    </div>
                                </div>
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </main>
        <footer>
  <div class="footer">
    <div class="footer1">
      <div class="footer11">
        <span class="footer11_title">热门人工智能工具</span>
        <div class="footer11info">
                    <a href="/zh/tool/ai-clothes-remover.html" aria-label="AI Clothes Remover" class="footer11s">AI Clothes Remover</a>
                    <a href="/zh/tool/deepnude-generator.html" aria-label="DeepNude generator" class="footer11s">DeepNude generator</a>
                    <a href="/zh/tool/purechat.html" aria-label="PureChat" class="footer11s">PureChat</a>
                  </div>
      </div>
      <div class="footer12">
        <span class="footer11_title">有潜力的人工智能工具</span>
        <div class="footer11info">
                    <a href="/zh/tool/idea-box-ai-tool.html" aria-label="Name Idea Box" class="footer11s">Name Idea Box</a>
                    <a href="/zh/tool/qi-jing-ai-ai-tool.html" aria-label="奇境 AI" class="footer11s">奇境 AI</a>
                    <a href="/zh/tool/ezaudio-ai-tool.html" aria-label="EZAudio" class="footer11s">EZAudio</a>
                  </div>
      </div>
      <div class="footer13">
        <span class="footer11_title">查看详情</span>
        <div class="footer11info">
                    <a href="/zh/ainews/ai-hosts-notebooklm-podcast-interviews.html" aria-label="AI寄主Notebooklm播客现已上" class="footer11s">AI寄主Notebooklm播客现已上</a>
                    <a href="/zh/ainews/corporate-ai-adoption-leveling-ramp-data.html" aria-label="Ramp 数据显示企业人工智能应用趋于平稳" class="footer11s">Ramp 数据显示企业人工智能应用趋于平稳</a>
                    <a href="/zh/ainews/microsoft-unveils-businessfocused-copilot-surface-devices-powered-intel.html" aria-label="Microsoft推出了以商业为中心的副吉洛特+地表设备" class="footer11s">Microsoft推出了以商业为中心的副吉洛特+地表设备</a>
                  </div>
      </div>
      <div class="footer4">
        <span class="footer11_title">关注</span>
        <div class="footer11info">
          <a href="javascript:;" class="footer11s">联系我们</a>
          <a href="mailto:admin@xix.ai" role="button" aria-label="联系我们" class="footer11s">admin@xix.ai</a>
          <a href="/sitemap.xml" class="footer11s" aria-label="SiteMap">SiteMap</a>
        </div>
      </div>
    </div>
    <span class="footer2"></span>
    <div class="footer3">Copyright ©2025 xix.ai All Rights Reserved.</div>
  </div>
</footer>
<div class="ai_cookie" style="display: none">
      <div class="ai_cookie_b">
        <div class="icon_f ai_cookie_close">
          <svg class="icon" aria-hidden="true">
            <use xlink:href="#icon-guanbi1"></use>
          </svg>
        </div>
        <p>
          点击“接受所有Cookie”,即表示您同意在您的设备上存储Cookie,以增强网站导航、分析网站使用情况并协助我们的营销工作。<span>隐私政策</span> 通知        </p>
        <div class="cokiesetRight">
          <a href="javascript:;" class="cokieA ai_cookie_open"  role="button" aria-label="Cookie 设置">Cookie 设置</a>
          <a href="javascript:;" class="cokieA RefuseCookies" role="button" aria-label="全部拒绝">全部拒绝</a>
          <a href="javascript:;" class="cokieA cokieAall" role="button" aria-label="接受所有 Cookie">接受所有 Cookie</a>
        </div>
      </div>
    </div>
    <div class="ai_cookieSettings" style="display: none">
      <div class="layuiDivcokie layui-layer-wrap" id="layuiDivcokie" style="display: block">
        <div class="cokielayTop dlyflx">
          <img src="/assets/images/logo.png" alt="" />
          <div class="icon_f ai_cookie_close1">
            <svg class="icon" aria-hidden="true">
              <use xlink:href="#icon-guanbi"></use>
            </svg>
          </div>
        </div>
        <hr />
        <div class="cokielayDown dlyflx">
          <p class="cokielaydTop">隐私偏好设置</p>
          <p class="cokielaydDesc">
            当您访问任何网站时,网站可能会在您的浏览器中存储或检索信息,主要以Cookie的形式。这些信息可能与您、您的偏好或设备有关,主要用于使网站按您期望的方式运行。这些信息通常不会直接识别您的身份,但可以为您提供更个性化的网络体验。由于我们尊重您的隐私权,您可以选择不允许某些类型的Cookie。点击不同的类别标题以了解更多信息并更改我们的默认设置。但是,阻止某些类型的Cookie可能会影响您对网站的体验以及我们能够提供的服务。 <a href="#" title="隐私政策" aria-label="隐私政策"><span>隐私政策</span></a> <b>声明</b>          </p>

          <div class="cokielayDivdown">
            <p class="coklaydownP">管理偏好设置</p>
            <ul class="cokidownUl">
              <li class="cokidownli dlyflx" style="padding: 25px 0px 25px">
                <div class="ckdTops">
                  <div class="ckdLeft">
                    <div class="icon_f">
                      <svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-add"></use>
                      </svg>
                      <svg class="icon icon_active" aria-hidden="true">
                        <use xlink:href="#icon-add1"></use>
                      </svg>
                    </div>
                    <p class="ckdlipmid">严格必要Cookie</p>
                  </div>
                  <p class="ckdlipr">始终启用</p>
                </div>
                <p class="ckdDowns">
                  这些Cookie是网站正常运行所必需的,无法在我们的系统中关闭。它们通常仅在您执行服务请求操作时设置,例如设置隐私偏好、登录或填写表单。您可以将浏览器设置为阻止这些Cookie或就这些Cookie向您发出警报,但网站的某些部分届时将无法正常工作。这些Cookie不会存储任何个人身份识别信息。                </p>
              </li>
            </ul>
          </div>
        </div>
        <div class="cklyBtn">
          <a href="javascript:;" role="button" aria-label="接受所有 Cookie" class="active cokieAall">接受所有 Cookie</a>
        </div>
      </div>
      <script>
        $(document).on("click", ".ai_cookie_close", function () {
          $(".ai_cookie").hide();
        });
        $(document).on("click", ".ai_cookie_close1", function () {
          $(".ai_cookieSettings").hide();
        });
        $(document).on("click", ".ai_cookie_open", function () {
          $(".ai_cookieSettings").show();
        });
        $(document).on("click", ".ckdLeft", function () {
          var $li = $(this).closest("li"); 
          var $downs = $li.find(".ckdDowns"); 
          var $iconBox = $(this).find(".icon_f"); 

         
          $downs.slideToggle(200, function () {
            if ($downs.is(":visible")) {
              $iconBox.find(".icon").hide();
              $iconBox.find(".icon_active").show();
            } else {
              $iconBox.find(".icon").hide();
              $iconBox.find(".icon").first().show(); 
            }
          });
        });     
      </script>
    </div>
<link rel="stylesheet" type="text/css" href="https://accounts.google.com/gsi/style">
<div class="login_tab">
  <div class="login_mainC">
    <div class="login_tab_top">
      <div class="login_tab_top1">
        <a href="javascript:;" role="tab" aria-label="登录" aria-selected="true" class="login_tab_top1a ">登录</a>
        <a href="javascript:;" role="tab" aria-label="注册" aria-selected="false" class="login_tab_top2a">注册</a>
      </div>
      <div class="login_tab_top2">
        <a href="javascript:;"><img src="/assets/images/login_mainC_top_m_img.png" alt=""></a>
      </div>

    </div>
    <div class="forms_google">
      <div id="g_id_signin"></div>
    </div>
    <div class="forms_or">
      <div class="forms_line"></div>
      <span>OR</span>
      <div class="forms_line"></div>
    </div>
    <div class="login_tab_bottom">
      <div class="login_tab_top1a_bottom">

        <div class="login_form ">
          <div class="login_forms">
            <img src="/assets/images/login_email.png" alt="邮箱">
            <input type="text" placeholder="请填写您的邮箱地址" class="login_forms_email">
            <span></span>
          </div>
          <div class="login_forms">
            <img src="/assets/images/login_password.png" alt="密码">
            <input type="password" placeholder="请输入您的密码" class="login_forms_password">
            <i style="cursor: pointer;" class="layui-icon layui-icon-eye-invisible toggle-password"
              id="toggleLoginPassword"></i>
            <span></span>
          </div>
          <div class="login_forms forms_code1">
            <input type="text" placeholder="请输入图形验证码"
              class="login_forms_captcha">
            <img src="" alt="请输入图形验证码" class="login-js-refresh-captcha">
            <span></span>
          </div>
          <div class="login_forms_bottom">
            <label class="login_remember">
              <input type="checkbox" aria-label="记住我">
              <span>记住我</span>
            </label>
            <a href="/zh/account/forgetPassword.html" aria-label="修改密码" class="login_forget">忘记密码?</a>
          </div>
          <a href="javascript:;" type="button" role="button" aria-label="登录" id="login_button" class="login_button">登录</a>

        </div>
      </div>
      <div class="login_tab_top2a_bottom">
        <div class="login_form">
          <div class="login_forms">
            <img src="/assets/images/login_email.png" alt="邮箱">
            <input type="text" placeholder="请填写您的邮箱地址" class="register_forms_email">
            <span></span>
          </div>
          <div class="login_forms">
            <img src="/assets/images/login_password.png" alt="密码">
            <input type="password" placeholder="请输入您的密码" class="register_forms_password">
            <i style="cursor: pointer;" class="layui-icon layui-icon-eye-invisible toggle-password"
              id="toggleRegisterPassword"></i>
            <span></span>
          </div>
          <div class="login_forms forms_code1">
            <input type="text" placeholder="请输入图形验证码"
              class="register_forms_captcha">
            <img src="" alt="请输入图形验证码" class="register-js-refresh-captcha" id="register_captcha">
            <span></span>
          </div>
          <div class="login_forms">
            <input type="text" class="verify-code-input" placeholder="请输入验证码">
            <button id="verifyCodeBtn" class="verify-code-btn" data-text="获取验证码">获取验证码</button>
            <span></span>
          </div>
          <a href="javascript:;" role="button" aria-label="注册" class="login_button" id="register_button">注册</a>
        </div>
      </div>

    </div>
  </div>
</div>
<script src="https://accounts.google.com/gsi/client" async defer></script>
<script>
  $(document).ready(function () {
    LoginRegister.init({
      selectors: {
        email: {
          login: '.login_forms_email',
          register: '.register_forms_email'
        },
        password: {
          login: '.login_forms_password',
          register: '.register_forms_password'
        },
        captcha: {
          login: '.login_forms_captcha',
          register: '.register_forms_captcha',
          verify: '.verify-code-input'
        },
        buttons: {
          login: '#login_button',
          register: '#register_button',
          verifyCode: '#verifyCodeBtn'
        },
        tabs: {
          login: '.login_tab_top1a',
          register: '.login_tab_top2a',
          close: '.login_tab_top2 a'
        }
      },
      messages: {
        email: "邮箱格式不正确",
        password: {
          empty: "请输入您的密码",
          invalid: "密码必须为6-18位字母数字组合"
        },
        captcha: "请输入图形验证码",
        verifyCode: "请输入验证码",
        operationInProgress: "操作进行中,请稍候",
        unexpectedError: "发生了一个意外错误,程序猿正在紧急处理中"
      },
      urls: {
        login: "/zh/account/dologin.html",
        register: "/zh/account/register.html",
        getMailSign: "/zh/account/getMailSign",
        sendMail: "/zh/account/registerSendMail.html",
        redirctUrl:'pc'
      }
    });
  });
  function initializeGoogleSignIn() {
    if (typeof google === 'undefined' || !google.accounts) {
      setTimeout(initializeGoogleSignIn, 100);
     
      return;
    }

    google.accounts.id.initialize({
      client_id: "294584378011-s53466qiuig7d30tcqrpjv1ue3ni2gun.apps.googleusercontent.com",
      callback: handlePCCredentialResponse,
      auto_select: false,
      locale: 'zh-cn',
      
    });
    
    google.accounts.id.renderButton(
      document.getElementById("g_id_signin"),
      {
        theme: "outline",
        size: "large",
        type: "standard",
        shape: "rectangular",
        logo_alignment: "left",
        text: "signin_with",
        width: 400,
        locale: 'zh-cn',
      }
    );
    
  }
  document.addEventListener('DOMContentLoaded', initializeGoogleSignIn);
</script>
  <!-- Google tag (gtag.js) -->
  <script  async src="https://www.googletagmanager.com/gtag/js?id=G-LN407DS0B4"></script>
  <script>
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'G-LN407DS0B4');
  </script>
  <script src="/kukukuwl.js"   type="text/javascript"></script>
 <a href="javascript:void(0);" class="totop" role="button" aria-label="返回顶部"><img src="/assets/images/totop.png" alt="" /></a>
        <script>
            layui.use(function () {
                var element = layui.element;
                element.tab({
                    headerElem: "#skilldetailsR1s_header>button",
                    bodyElem: "#skilldetailsR1s_body>div",
                });
            });
            function initSkillCloneCopy() {
                $(document)
                    .off("click.skillCloneCopy")
                    .on("click.skillCloneCopy", ".skill_clone .skill_clone_copy", function (e) {
                        e.preventDefault();

                        var $btn = $(this);
                        var $img = $btn.find("img");

                        var text = $.trim($btn.siblings("p").text());

                        var $temp = $("<textarea>");
                        $("body").append($temp);
                        $temp.val(text).select();

                        try {
                            document.execCommand("copy");

                            // 切换成功图标
                            $img.attr("src", "/assets/images/prompt_word2RMs_p_btn_ok.png");
                            $btn.addClass("active");
                            // 清除上一次定时器
                            clearTimeout($btn.data("copyTimer"));

                            // 3秒后恢复原图
                            var timer = setTimeout(function () {
                                $img.attr("src", "/assets/images/prompt_word2RMs_p_btn.png");
                                $btn.removeClass("active");
                            }, 3000);

                            $btn.data("copyTimer", timer);
                        } catch (err) {
                            alert("复制失败");
                        }

                        $temp.remove();
                    });
            }

            function initSkilldetailsFixed() {
                var $box = $(".skilldetailsR1");
                if (!$box.length) {
                    return;
                }
                var fixedTop = 20;
                var topOffset = $box.offset().top;
                var boxHeight = $box.outerHeight();
                var $placeholder = $("<div></div>").height(boxHeight).hide();
                $box.before($placeholder);
                function handleFixed() {
                    if ($(window).width() <= 1024) {
                        $placeholder.hide();
                        $box.css({
                            position: "",
                            top: "",
                            width: "",
                            zIndex: "",
                        });
                        return;
                    }
                    var scrollTop = $(window).scrollTop();
                    if (scrollTop >= topOffset - fixedTop) {
                        $placeholder.show();
                        $box.css({
                            position: "fixed",
                            top: fixedTop + "px",
                            width: $placeholder.width() + "px",
                            zIndex: 100,
                        });
                    } else {
                        $placeholder.hide();
                        $box.css({
                            position: "",
                            top: "",
                            width: "",
                            zIndex: "",
                        });
                    }
                }
                $(window).on("scroll.skilldetailsFixed resize.skilldetailsFixed", handleFixed);
                handleFixed();
            }
            function initSkilldetailsExpand() {
                $(".skilldetailsL_p").each(function () {
                    var $item = $(this);

                    $item.find(".skilldetailsL_p_expand").text($item.hasClass("active") ? "...展开全部" : "隐藏");
                });

                $(document)
                    .off("click.skilldetailsExpand")
                    .on("click.skilldetailsExpand", ".skilldetailsL_p_expand", function (e) {
                        e.preventDefault();

                        var $parent = $(this).closest(".skilldetailsL_p");

                        if ($parent.hasClass("active")) {
                            $parent.removeClass("active");
                            $(this).text("隐藏");
                        } else {
                            $parent.addClass("active");
                            $(this).text("...展开全部");
                        }
                    });
            }

            function checkFollow() {
                let dataSources = [];
                $('button.skill_datas').each(function () {
                    let source = $(this).data('source');
                    if (source) {
                        dataSources.push(String(source).trim());
                    }
                });
                dataSources = [...new Set(dataSources)];
                if (dataSources.length === 0) {
                    return;
                }
                $.post('/api/user/FindSkillFollow', {
                    source: dataSources
                }, function (res) {
                    if (res.code == 1 && res.data.length > 0) {
                        res.data.forEach(function (id) {
                            $('button.skill_datas[data-source="' + id + '"]').addClass('active');
                        });
                    }
                }, 'json');
            }
            $(function () {
                checkFollow();
                initSkillCloneCopy();
                initSkilldetailsFixed();
                initSkilldetailsExpand();
            });
            $(document).on('click', 'button.skill_datas', function (e) {
                e.preventDefault();
                const that = $(this);
                let source = that.data('source');
                if (!source || source === undefined || !CommonUtils.checkLogin()) return false;
                layer.load(2, {
                    shade: [0.3, "#000"],
                    time: 0,
                });
                var path = "/user/followSkill";
                var realPath = CommonUtils.getRealPath(path);
                $.post(realPath, { source: source }, function (result) {
                    layer.closeAll();
                    CommonUtils.showMsg(result.msg, result.code);
                    if (result.code == 1) {
                        var values = result.data.data_source;
                        var count = result.data.count;
                        var collected = result.data.collected;
                        var elements = $(".collectNums_" + values);
                        if (elements.length > 0) {
                            elements.each(function () {
                                $(this).parents('button').toggleClass('active', collected);
                                $(this).text(count);
                            });
                        }
                    }
                })
            })

            $(document).on('click', '.skill_downloadzip', function (e) {
                e.preventDefault();
                const url = $(this).data("source");
                if (!url) return;
                window.open("/api/index/download_zip?source=" + encodeURIComponent(url), "_blank");
            })

        </script>
    </body>

</html>