---
name: skill-on-demand-architect-yashu
description: 用控制论思想优化指定技能以节约 token 的抽象方法论（按需加载架构师）。当用户要求优化/瘦身某个技能、减少 AI 多轮问答的 token 消耗、把大文档拆成按需读取的小文档、为技能设计分层加载结构时使用。本技能不针对具体技能，提供通用「诊断-拆分-验证」方法，由 AI 应用到目标技能。
title: skill-on-demand-architect-yashu
canonical_url: https://skilld.dev/gh/steelan9199/wechat-publisher/skill-on-demand-architect-yashu
last_updated: 2026-10-07T07:20:50.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/诊断与手法.md](https://skilld.dev/api/skills-raw/steelan9199/wechat-publisher/skill-on-demand-architect-yashu/references/诊断与手法.md).
>
> If the user asked to install this Skill, run `npx skilld install steelan9199/wechat-publisher/skill-on-demand-architect-yashu`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/skill-on-demand-architect-yashu`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/steelan9199/wechat-publisher/skill-on-demand-architect-yashu) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/skill-on-demand-architect-yashu`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/skill-on-demand-architect-yashu --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/skill-on-demand-architect-yashu --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# 按需加载架构师 Skill On-Demand Architect

## 1. 定位

本技能是**方法论参考**，不是执行器：不直接改目标技能，而是指导 AI 如何优化一个指定的技能以节约 token。

**适用对象**：SKILL.md 体积过大、每次会话全量加载、或执行时反复读取大文档/大脚本的技能。

**不适用**：目标技能已足够精简（SKILL.md < 150 行且无重复读取）时，不做无谓重构。

## 2. 核心模型（动手前先建立）

### 2.1 token 消耗公式

```
单轮问答成本 ≈ 历史上下文累积 + 本轮新读入 + 本轮输出
```

- 历史累积随轮次滚雪球：轮次越多，后面每轮越重；
- 本轮新读入 = 本轮 Read 进上下文的内容（最大可控头）；
- 本轮输出 = AI 回复长度（可控）。

### 2.2 压缩-重读循环（隐藏大头）

上下文超限 → 系统压缩丢细节 → AI 记不住 → 被迫重读文档 → 再次占用上下文 → 再次压缩。

**优化目标不是减少轮次，而是减少每轮携带的冗余信息、切断重读循环。**

### 2.3 三层加载（技能的标准结构）

| 层 | 内容 | 加载时机 | 体积目标 |
|---|---|---|---|
| L1 元信息 | name + description | 常驻 | ~100 词 |
| L2 核心卡 | SKILL.md 正文 | 技能触发时 | < 200 行 |
| L3 按需资源 | references/ scripts/ | 用到才读 | 不限（scripts 执行不读入） |

## 3. 五步工作流

### Step 1 定边界（诊断）

- 画出目标技能的 token 消耗链路：哪些内容每次必读？哪些本应按需却仍被全量读？哪些被重复读？
- 量化基线：统计 SKILL.md 行数、各 references 行数、scripts 体积。
- 产出：链路图 + 必读体积清单。

### Step 2 展开可能性空间

- 列出优化方向：读侧瘦身 / 执行侧减负 / 结构重构 / 机制改造。
- 选控制方式：优先负反馈调节（小步改、每轮验证），不用随机试错。

### Step 3 定目标差

- 定义可量化目标，如「SKILL.md 从 340 行降到 ≤120 行，且能力 100% 保留」。
- 定义容差：列出不可删内容（触发词、铁律、模板表），可删内容（过程细节、示例、旧日志）。

### Step 4 建反馈回路

- 回路：改一版 → 模拟一次典型任务 → 统计必读 token → 比对目标差 → 再改。
- 判稳：每轮只动一个结构点，防止振荡；改完必须验证「任务仍能完成」。

### Step 5 收敛与容错

- 记录每轮目标差，确认单调下降，不振荡。
- 加容错：改前保留备份；路由表写清「某份文档缺失时怎么办」。

## 4. 核心手法

| 手法 | 做法 | 收益 |
|---|---|---|
| 分层加载 | SKILL.md 只留核心卡，细节拆到 references/ | 必读体积直降 |
| 路由表 | SKILL.md 末尾列「什么场景读哪份文档」 | 防止拆了后全读/漏读 |
| 压薄必读 | 铁律/模板表精简，过程文档移出 | 每轮都省 |
| 切断重读 | 关键信息固化成薄接口卡，不藏在长文档 | 防止压缩-重读循环 |
| 数据代码分离 | 坐标/数据进存储或脚本，文档零数值 | 文档不再膨胀 |
| 引用复用 | 已有技能（如 cybernetic-thinking-yashu）不重复写理论 | 避免重复 |

## 4.1 控制论底座（需要时先读）

本技能的方法论内核来自 `cybernetic-thinking-yashu`。当 AI 对「控制论是什么、如何拆解任务」缺乏把握时，先读取 `cybernetic-thinking-yashu` 的 SKILL.md 获取完整框架（系统边界 / 可能性空间 / 目标差 / 反馈回路 / 判稳 / 容错）。

引用方只需遵守该技能的三条原则：

1. **先定义目标差指标，再动手**；
2. **每一轮都要测量，不允许无反馈执行**；
3. **先判稳再寻优**。

本技能不重复控制论理论，避免双份占用上下文。

## 5. 路由表（本技能自身的按需加载）

| 场景 | 读什么 |
|---|---|
| 需要诊断清单 / 手法详表 / 案例 | `references/诊断与手法.md` |
| 需要控制论理论 | 引用 `cybernetic-thinking-yashu` 技能 |

## 6. 验证与交付

- 优化后回读目标技能，确认：触发词保留、能力不降级、路由表清晰、必读体积达标。
- 向用户交付：改了什么、每项收益（行数/比例）、验证结果、仍存在的缺口。
- 用控制论收尾模板汇报：系统边界 / 目标差 / 反馈回路 / 收敛状态。
