skill-systems-thinking 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,396 +1,482 @@
1
- # systems-thinking
2
-
3
- <!-- Language toggle / 语言切换 -->
4
-
5
- > **中文** | [English](#english)
6
-
7
- ---
8
-
9
- ## 简介
10
-
11
- `systems-thinking` 是一个思维模式 skill。它把控制论的思想装进 LLM 的思考过程里,让模型在写代码、改代码、做架构之前,先想清楚:状态是什么、怎么观测、稳不稳定、边界在哪、耦合怎么处理。
12
-
13
- > **一句话:用系统视角写代码——先识别状态,再动手,最后闭环验证。**
14
-
15
- 这不是给人类做的知识测试,也不是一本排错手册。它是一个脚手架,改变的是模型**怎么想**,而不是怎么拼 diff。
16
-
17
- 源自钱学森、宋健《工程控制论》。语言和框架无关,拿来就能用。
18
-
19
- ## 它解决什么问题
20
-
21
- 写代码时常见的做法是:先动手,再祈祷测试能过。这个 skill 要改变的是这个顺序。
22
-
23
- 它特别适合这些场景:
24
-
25
- - 改一段你不完全理解的遗留代码
26
- - 调试一个时好时坏、复现不了的问题
27
- - 重构几个互相牵制的模块
28
- - 做任何"既要正确又要稳"的改动
29
-
30
- 在这些场景里,"写个最小补丁"往往不够。你需要先搞清楚系统的状态,再动手。
31
-
32
- ## 核心思想
33
-
34
- 一句话:**程序是一个动态系统,你是控制器。**
35
-
36
- 每次改动都在往系统里注入一个控制信号。你只能部分观测系统的真实状态。bug 是不稳定或欠阻尼的轨迹。调试就是状态估计。测试是反馈回路的传感器。**闭环永远比开环好。**
37
-
38
- ## 安装
39
-
40
- 本 skill 面向支持自定义 skill 的 AI 编程助手(Kilo、Claude Code、Aider、Cursor 等)。
41
-
42
- ### 直接复制
43
-
44
- ```bash
45
- cp -r systems-thinking <agent-skills-dir>/
46
- ```
47
-
48
- ### 符号链接(开发用)
49
-
50
- ```bash
51
- ln -s /absolute/path/to/systems-thinking <agent-skills-dir>/
52
- ```
53
-
54
- ### 各助手路径参考
55
-
56
- | 助手 | 路径 |
57
- |---|---|
58
- | Kilo | `~/.config/kilo/skills/` 或项目内 `.kilo/agent/` |
59
- | Claude Code | `~/.claude/plugins/custom-skills/` 或项目内 `.claude/` |
60
- | Aider | 使用 `--skills-dir` 参数 |
61
- | Cursor | 项目内 `.cursor/rules/` 或全局设置 |
62
-
63
- ### 验证安装
64
-
65
- ```bash
66
- pwsh init.ps1
67
- ```
68
-
69
- 看到 `Verification Complete — OK` 就说明装好了。
70
-
71
- ## 使用方式
72
-
73
- ### 1. 触发时机
74
-
75
- 在涉及以下任务时加载本 skill:
76
-
77
- - 架构设计
78
- - 调试非确定性行为
79
- - 跨模块重构
80
- - 任何"正确且稳健必须同时满足"的改动
81
-
82
- ### 2. SKILL.md
83
-
84
- 先读 `SKILL.md`,里面的运行时提示块会安装认知法则。下面的工作流是自然延伸。
85
-
86
- ### 3. 动手之前,先命名
87
-
88
- 改代码之前,必须说清楚四个东西:
89
-
90
- - `x` — 被控变量,什么必须保持正确
91
- - `u` — 控制变量,你实际会动的那个杠杆
92
- - 可观测性 — 你怎么知道 `x` 的当前值
93
- - 边界 — 每个执行器都会饱和,不接受无界循环
94
-
95
- ### 4. 七步循环
96
-
97
- | 步骤 | 原则 | 参考文件 |
98
- |---|---|---|
99
- | 1 | 识别:命名 `x`、`u`、可观测性、边界 | `references/state-and-control.md` |
100
- | 2 | 分析:复现、测量、定位故障、建立模型 | `references/modeling.md` |
101
- | 3 | 稳定:在加新功能之前先消灭发散/振荡/泄露 | `references/stability.md` |
102
- | 4 | 综合:最小 `u`;解耦有害,协调有益 | `references/multivariable.md` |
103
- | 5 | 闭环:观察实际结果,修正直到偏差有界 | `references/closed-loop-workflow.md` |
104
- | 6 | 补偿:可测扰动用前馈;有延迟就加阻尼 | `references/disturbance.md` |
105
- | 7 | 优化:稳定之后才谈性能调优 | `references/bounded-control.md` |
106
-
107
- 涉及采样和测试节奏的问题,额外参考 `references/discrete-systems.md`。
108
-
109
- ### 5. 模板
110
-
111
- 以下文件位于 skill 安装目录下的 `templates/` 子目录中:
112
-
113
- - **调试时**:把 `templates/debugging-checklist.md` 复制进会话
114
- - **规划改动时**:用 `templates/change-proposal.md` 写控制计划
115
-
116
- ### 6. 自审计
117
-
118
- 宣布完成之前,必须通过 `evals/checks.json` 中所有的 MUST 检查项。
119
-
120
- ## 认知法则
121
-
122
- 这个 skill 强制执行 8 条认知法则:
123
-
124
- 1. 先命名 `x` 再命名 `u`。没名字的目标就没法调节。
125
- 2. 先观测再猜测。综合方案之前先测量当前行为。
126
- 3. 稳定优先于优化。扰动下发散就是失败。
127
- 4. 闭环。观察实际结果,不断修正直到偏差有界。
128
- 5. 可测扰动用前馈,其余用反馈。绝不在延迟回路上提高增益。
129
- 6. 解耦有害耦合,协调有益耦合。调节关系,不只是绝对值。
130
- 7. 最小控制。移动 `x` 到目标所需的最小 `u`,不搞投机性额外操作。
131
- 8. 收敛。修正幅度必须越来越小。如果越来越大,说明不稳定——停下来重新识别。
132
-
133
- ## 工作示例
134
-
135
- **问题**:一个 API 接口在负载下间歇性返回 500。
136
-
137
- | 步骤 | 控制论行动 |
138
- |---|---|
139
- | 识别 | `x` = 错误率;`u` = 重试/超时/缓存逻辑;边界 = 请求预算。 |
140
- | 分析 | 在负载下复现;测量错误率随并发上升(不稳定)。 |
141
- | 稳定 | 加熔断器 + 带退避的有界重试 → 错误率有界。 |
142
- | 综合 | 最小改动,不要重写服务。 |
143
- | 闭环 | 再次压测;错误率收敛到接近 0。 |
144
- | 补偿 | 对可测依赖故障快速失败(前馈)+ 其余用反馈。 |
145
- | 优化 | 此时才 trim p99 延迟。 |
146
-
147
- **没有这套视角的常见失败**:无限制加重试 重试风暴(不稳定延迟环)→ 比原来更糟。
148
-
149
- ## 参考文件
150
-
151
- 8 篇深度参考,每篇对应一个控制论原则,附带 LLM 行为模式说明:
152
-
153
- | 主题 | 文件 |
154
- |---|---|
155
- | 闭环工作流 | `references/closed-loop-workflow.md` |
156
- | 状态、控制、可观测性、边界 | `references/state-and-control.md` |
157
- | 稳定性 | `references/stability.md` |
158
- | 建模与模型有效性 | `references/modeling.md` |
159
- | 多变量:解耦与协调 | `references/multivariable.md` |
160
- | 扰动补偿与时延 | `references/disturbance.md` |
161
- | 有界控制 | `references/bounded-control.md` |
162
- | 离散系统与测试节奏 | `references/discrete-systems.md` |
163
-
164
- ## 自审计
165
-
166
- `evals/checks.json` 列出了一组 MUST/SHOULD 检查项,供 LLM 或评审者确认思维 discipline 被遵循。在所有 MUST 项通过之前,不得宣布任务完成。
167
-
168
- ## 贡献
169
-
170
- - `SKILL.md` 中的每条主张都必须追溯到某个参考文件
171
- - 每个引用链接必须能解析到存在的文件
172
- - 保持 skill 精简,与原著保持一致
173
- - 提交前运行 `./init.ps1`
174
-
175
- 完整工作规则见 `AGENTS.md`。
176
-
177
- ## 版本
178
-
179
- 本 skill 遵循 [Semantic Versioning](https://semver.org/)(`X.Y.Z`)。
180
-
181
- | 版本 | 日期 | 说明 |
182
- |---|---|---|
183
- | 0.1.0 | 2026-07-24 | 首次公开发布 |
184
-
185
- 完整变更记录见 [CHANGELOG.md](CHANGELOG.md)。
186
-
187
- ## 协议
188
-
189
- MIT License。详见 [LICENSE](LICENSE)。
190
-
191
- ---
192
-
193
- ## Source
194
-
195
- Qian Xuesen (Tsien Hsue-shen‌; 钱学森) & Song Jian (宋健), *Engineering Cybernetics* (工程控制论). The original book and its mathematical foundations are the authoritative source; this skill is a faithful interpretation, not a replacement.
196
-
197
- ---
198
-
199
- <br/><br/>
200
-
201
- ---
202
-
203
- <a name="english"></a>
204
-
205
- <!-- Language toggle / 语言切换 -->
206
-
207
- > [中文](#简介) | **English**
208
-
209
- ---
210
-
211
- ## About
212
-
213
- `systems-thinking` is a thinking-mode skill. It installs a control-theoretic cognitive operating system in the LLM—shaping how the model *thinks* about systems (state, observability, stability, bounds, coupling) before writing or changing code.
214
-
215
- > **One-line pitch: Control-theoretic thinking for code—know your state before you touch it.**
216
-
217
- This is not a vocabulary test for humans, and not a bug-hunting playbook. It is a scaffold that reframes every non-trivial change from *"write the smallest patch and hope"* to *identify the state, measure the trajectory, stabilize the plant, then steer*.
218
-
219
- Derived from Qian Xuesen (Tsien Hsue-shen‌) & Song Jian, *Engineering Cybernetics* (工程控制论). Language- and framework-agnostic. Self-contained.
220
-
221
- ## What it solves
222
-
223
- The default approach to coding is: start typing, then pray the tests pass. This skill changes that order.
224
-
225
- It fits best when:
226
-
227
- - You're changing legacy code you don't fully understand
228
- - You're debugging something that breaks intermittently and can't be reproduced reliably
229
- - You're refactoring modules that are tangled together
230
- - A change needs to be both correct and robust
231
-
232
- In these situations, "write the smallest patch" is often not enough. You need to understand the system's state first.
233
-
234
- ## Core idea
235
-
236
- One sentence: **a program is a dynamical system, and you are the controller.**
237
-
238
- Every change injects a control signal. You only partially observe the true state. Bugs are unstable or poorly-damped trajectories. Debugging is state estimation. Tests are sensors feeding a feedback loop. **Closed loop beats open loop.**
239
-
240
- ## Installation
241
-
242
- This skill is designed for AI coding agents that support custom skills (Kilo, Claude Code, Aider, Cursor, etc.).
243
-
244
- ### Direct copy
245
-
246
- ```bash
247
- cp -r systems-thinking <agent-skills-dir>/
248
- ```
249
-
250
- ### Symlink (development)
251
-
252
- ```bash
253
- ln -s /absolute/path/to/systems-thinking <agent-skills-dir>/
254
- ```
255
-
256
- ### Agent paths
257
-
258
- | Agent | Path |
259
- |---|---|
260
- | Kilo | `~/.config/kilo/skills/` or `.kilo/agent/` in project |
261
- | Claude Code | `~/.claude/plugins/custom-skills/` or `.claude/` in project |
262
- | Aider | `--skills-dir` flag |
263
- | Cursor | `.cursor/rules/` in project or global settings |
264
-
265
- ### Verify
266
-
267
- ```bash
268
- pwsh init.ps1
269
- ```
270
-
271
- Look for `Verification Complete OK`.
272
-
273
- ## Usage
274
-
275
- ### 1. When to load
276
-
277
- Load this skill when the task involves:
278
-
279
- - Architecture design
280
- - Debugging non-deterministic behavior
281
- - Cross-module refactoring
282
- - Any change where correctness AND robustness both matter
283
-
284
- ### 2. Read SKILL.md
285
-
286
- Read `SKILL.md` first. The runtime prompt block installs the cognitive laws. The workflow below follows naturally.
287
-
288
- ### 3. Name things before touching code
289
-
290
- Before proposing any change, the LLM must name four things:
291
-
292
- - `x` — the controlled variable (what must stay correct)
293
- - `u` the control variable (the lever you will actually move)
294
- - Observability — how will you know the current value of `x`?
295
- - Bounds — every actuator saturates; no unbounded loop is acceptable
296
-
297
- ### 4. Seven-step loop
298
-
299
- | Step | Principle | Reference |
300
- |---|---|---|
301
- | 1 | Identify — name `x`, `u`, observability, bounds. | `references/state-and-control.md` |
302
- | 2 | Analyze reproduce, measure, locate fault, state the model. | `references/modeling.md` |
303
- | 3 | Stabilize — kill divergence / oscillation / leaks before features. | `references/stability.md` |
304
- | 4 | Synthesize — minimal `u`; decouple what hurts, coordinate what helps. | `references/multivariable.md` |
305
- | 5 | Close the loop — observe actual result; correct until bounded. | `references/closed-loop-workflow.md` |
306
- | 6 | Compensate — feedforward measurable disturbances; clamp the actuator. | `references/disturbance.md` |
307
- | 7 | Optimize — only then tune secondary indicators. | `references/bounded-control.md` |
308
-
309
- For sampled-system and test-cadence concerns, also see `references/discrete-systems.md`.
310
-
311
- ### 5. Templates
312
-
313
- These files are located in the skill's `templates/` directory (relative to the skill
314
- installation root).
315
-
316
- - **Debugging**: copy `templates/debugging-checklist.md` into the session.
317
- - **Planning**: use `templates/change-proposal.md` to write a control plan.
318
-
319
- ### 6. Self-audit
320
-
321
- Before declaring done, pass all MUST checks in `evals/checks.json`.
322
-
323
- ## Cognitive laws
324
-
325
- The skill enforces 8 cognitive laws:
326
-
327
- 1. Name `x` before `u`. Unnamed targets are unregulated.
328
- 2. Observe before you guess. Measure current behavior before synthesizing the fix.
329
- 3. Stabilize before you optimize. Divergence under perturbation is failure.
330
- 4. Close the loop. Observe the actual result; correct until deviation is bounded.
331
- 5. Feedforward measurable disturbances; feedback the rest. Never crank gain on delay.
332
- 6. Decouple harmful coupling. Coordinate beneficial coupling. Regulate relations, not just absolutes.
333
- 7. Minimal control. The smallest `u` that moves `x` to target. No speculative extras.
334
- 8. Convergence: corrections must shrink. If they grow, you are unstable — stop and re-identify.
335
-
336
- ## Worked example
337
-
338
- **Symptom:** an API endpoint intermittently returns 500 under load.
339
-
340
- | Step | Control-theoretic action |
341
- |---|---|
342
- | Identify | `x` = error rate; `u` = retry/timeout/cache logic; bound = request budget. |
343
- | Analyze | Reproduce under load; measure that error rate climbs with concurrency (unstable). |
344
- | Stabilize | Add circuit breaker + bounded retries with backoff error rate bounded. |
345
- | Synthesize | Minimal change; don't rewrite the service. |
346
- | Close the loop | Load-test again; error rate now converges to ~0. |
347
- | Compensate | Feedforward on measurable dependency outage (fail fast) + feedback on the rest. |
348
- | Optimize | Only now trim p99 latency. |
349
-
350
- **Without this lens:** add retries with no bound retry storm (an unstable delay loop) → worse than before.
351
-
352
- ## References
353
-
354
- 8 deep-dive references, each anchored to the original text with LLM behavior patterns:
355
-
356
- | Topic | File |
357
- |---|---|
358
- | Closed-loop workflow | `references/closed-loop-workflow.md` |
359
- | State, control, observability, bounds | `references/state-and-control.md` |
360
- | Stability | `references/stability.md` |
361
- | Modeling and model validity | `references/modeling.md` |
362
- | Multivariable: decouple and coordinate | `references/multivariable.md` |
363
- | Disturbance compensation and time-delay | `references/disturbance.md` |
364
- | Bounded control | `references/bounded-control.md` |
365
- | Discrete systems and test cadence | `references/discrete-systems.md` |
366
-
367
- ## Self-audit
368
-
369
- `evals/checks.json` lists concrete MUST/SHOULD checks an LLM or reviewer applies to confirm the discipline was followed. All MUST items must pass before a task is called done.
370
-
371
- ## Contributing
372
-
373
- - Every claim in `SKILL.md` must trace to a reference file.
374
- - Every reference link must resolve to an existing file.
375
- - Keep the skill small and aligned to the book.
376
- - Run `./init.ps1` before submitting.
377
-
378
- See `AGENTS.md` for the full working rules and definition of done.
379
-
380
- ## Version
381
-
382
- This skill follows [Semantic Versioning](https://semver.org/) (`X.Y.Z`).
383
-
384
- | Version | Date | Notes |
385
- |---|---|---|
386
- | 0.1.0 | 2026-07-24 | Initial public release |
387
-
388
- Full history: [CHANGELOG.md](CHANGELOG.md).
389
-
390
- ## License
391
-
392
- MIT License. See [LICENSE](LICENSE) for details.
393
-
394
- ## Source
395
-
396
- Derived from Qian Xuesen (钱学森) & Song Jian (宋健), *Engineering Cybernetics* (工程控制论). The original book and its mathematical foundations are the authoritative source; this skill is a faithful interpretation, not a replacement.
1
+ # systems-thinking
2
+
3
+ <!-- Language toggle / 语言切换 -->
4
+
5
+ > **中文** | [English](#english)
6
+
7
+ ---
8
+
9
+ ## 简介
10
+
11
+ `systems-thinking` 是一个思维模式 skill。它把控制论的思想装进 LLM 的思考过程里,让模型在写代码、改代码、做架构之前,先想清楚:状态是什么、怎么观测、稳不稳定、边界在哪、耦合怎么处理。
12
+
13
+ > **一句话:用系统视角写代码——先识别状态,再动手,最后闭环验证。**
14
+
15
+ 这不是给人类做的知识测试,也不是一本排错手册。它是一个脚手架,改变的是模型**怎么想**,而不是怎么拼 diff。
16
+
17
+ 源自钱学森、宋健《工程控制论》。语言和框架无关,拿来就能用。
18
+
19
+ ## 它解决什么问题
20
+
21
+ 写代码时常见的做法是:先动手,再祈祷测试能过。这个 skill 要改变的是这个顺序。
22
+
23
+ 它特别适合这些场景:
24
+
25
+ - 改一段你不完全理解的遗留代码
26
+ - 调试一个时好时坏、复现不了的问题
27
+ - 重构几个互相牵制的模块
28
+ - 做任何"既要正确又要稳"的改动
29
+
30
+ 在这些场景里,"写个最小补丁"往往不够。你需要先搞清楚系统的状态,再动手。
31
+
32
+ ## 核心思想
33
+
34
+ 一句话:**程序是一个动态系统,你是控制器。**
35
+
36
+ 每次改动都在往系统里注入一个控制信号。你只能部分观测系统的真实状态。bug 是不稳定或欠阻尼的轨迹。调试就是状态估计。测试是反馈回路的传感器。**闭环永远比开环好。**
37
+
38
+ ## 安装
39
+
40
+ 本 skill 面向支持自定义 skill 的 AI 编程助手(Kilo、Claude Code、Aider、Cursor 等)。
41
+
42
+ ### npm install(推荐)
43
+
44
+ ```bash
45
+ npm install skill-systems-thinking
46
+ ```
47
+
48
+ 安装后,将 skill 链接到你的 agent skill 目录:
49
+
50
+ ```bash
51
+ # 查找 npm 全局安装路径
52
+ npm root -g
53
+ # 或本地项目安装:
54
+ node -e "console.log(require.resolve('skill-systems-thinking'))"
55
+ ```
56
+
57
+ 然后将 skill 符号链接或复制到你的 agent skill 目录(详见下方各 agent 的具体说明)。
58
+
59
+ ### GitHub 下载
60
+
61
+ ```bash
62
+ git clone https://github.com/ShrimpLeon/systems-thinking.git
63
+ cp -r systems-thinking <agent-skills-dir>/
64
+ ```
65
+
66
+ ### 符号链接(开发用)
67
+
68
+ ```bash
69
+ ln -s /absolute/path/to/systems-thinking <agent-skills-dir>/
70
+ ```
71
+
72
+ ### 各 agent 配置
73
+
74
+ npm 包将 skill 文件安装到 `node_modules/skill-systems-thinking/`。你需要让各 agent 找到它们。各 agent 的 skill 目录如下。
75
+
76
+ | Agent | Skill 目录 | npm 链接命令 |
77
+ |---|---|---|
78
+ | Kilo | `~/.config/kilo/skills/` 或项目 `.kilo/agent/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.config/kilo/skills/systems-thinking` |
79
+ | Claude Code | `~/.claude/plugins/custom-skills/` 或项目 `.claude/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.claude/plugins/custom-skills/systems-thinking` |
80
+ | Aider | `--skills-dir` 路径 | `ln -s $(npm root -g)/skill-systems-thinking <aider-skills-dir>/` |
81
+ | Cursor | 项目 `.cursor/rules/` 或全局设置 | `ln -s $(npm root -g)/skill-systems-thinking .cursor/rules/systems-thinking` |
82
+ | OpenAI Codex | `~/.codex/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.codex/skills/systems-thinking` |
83
+ | GitHub Copilot | `~/.copilot/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.copilot/skills/systems-thinking` |
84
+ | Windsurf | `~/.windsurf/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.windsurf/skills/systems-thinking` |
85
+ | Zed | `~/.zed/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.zed/skills/systems-thinking` |
86
+
87
+ > **注意:** 如果你的 agent 未出现在上方,请查阅其文档获取自定义 skill/plugin 路径。npm 包安装到标准的 `node_modules` 位置,因此任何能从任意目录加载 skill 的 agent 都可以使用。
88
+
89
+ ### 验证安装
90
+
91
+ ```bash
92
+ pwsh init.ps1
93
+ ```
94
+
95
+ 看到 `Verification Complete — OK` 就说明装好了。
96
+
97
+ ## 兼容性
98
+
99
+ npm `skill-systems-thinking` 兼容以下 agent 智能体:
100
+
101
+ | Agent | npm 安装兼容 | 说明 |
102
+ |---|---|---|
103
+ | Kilo | | 通过 `~/.config/kilo/skills/` 或 `.kilo/agent/` 链接 |
104
+ | Claude Code | | 通过 `~/.claude/plugins/custom-skills/` 或 `.claude/` 链接 |
105
+ | Aider | | 通过 `--skills-dir` 参数指定链接目录 |
106
+ | Cursor | ✅ | 通过 `.cursor/rules/` 或全局设置链接 |
107
+ | OpenAI Codex | ✅ | 通过 `~/.codex/skills/` 链接 |
108
+ | GitHub Copilot | ✅ | 通过 `~/.copilot/skills/` 链接 |
109
+ | Windsurf | ✅ | 通过 `~/.windsurf/skills/` 链接 |
110
+ | Zed | ✅ | 通过 `~/.zed/skills/` 链接 |
111
+
112
+ npm 安装将 skill 文件部署到 `node_modules/skill-systems-thinking/`,然后通过符号链接暴露给各 agent。由于 npm 包不包含 agent 特有的配置文件(如 `.kilo/`、`.claude/` 等),你需要手动创建符号链接将 skill 指向各 agent 的 skill 目录。这一步在所有支持的 agent 上都是相同的操作。
113
+
114
+ ## 使用方式
115
+
116
+ ### 1. 触发时机
117
+
118
+ 在涉及以下任务时加载本 skill:
119
+
120
+ - 架构设计
121
+ - 调试非确定性行为
122
+ - 跨模块重构
123
+ - 任何"正确且稳健必须同时满足"的改动
124
+
125
+ ### 2. 读 SKILL.md
126
+
127
+ 先读 `SKILL.md`,里面的运行时提示块会安装认知法则。下面的工作流是自然延伸。
128
+
129
+ ### 3. 动手之前,先命名
130
+
131
+ 改代码之前,必须说清楚四个东西:
132
+
133
+ - `x` — 被控变量,什么必须保持正确
134
+ - `u` — 控制变量,你实际会动的那个杠杆
135
+ - 可观测性 你怎么知道 `x` 的当前值
136
+ - 边界 — 每个执行器都会饱和,不接受无界循环
137
+
138
+ ### 4. 七步循环
139
+
140
+ | 步骤 | 原则 | 参考文件 |
141
+ |---|---|---|
142
+ | 1 | 识别:命名 `x`、`u`、可观测性、边界 | `references/state-and-control.md` |
143
+ | 2 | 分析:复现、测量、定位故障、建立模型 | `references/modeling.md` |
144
+ | 3 | 稳定:在加新功能之前先消灭发散/振荡/泄露 | `references/stability.md` |
145
+ | 4 | 综合:最小 `u`;解耦有害,协调有益 | `references/multivariable.md` |
146
+ | 5 | 闭环:观察实际结果,修正直到偏差有界 | `references/closed-loop-workflow.md` |
147
+ | 6 | 补偿:可测扰动用前馈;有延迟就加阻尼 | `references/disturbance.md` |
148
+ | 7 | 优化:稳定之后才谈性能调优 | `references/bounded-control.md` |
149
+
150
+ 涉及采样和测试节奏的问题,额外参考 `references/discrete-systems.md`。
151
+
152
+ ### 5. 模板
153
+
154
+ 以下文件位于 skill 安装目录下的 `templates/` 子目录中:
155
+
156
+ - **调试时**:把 `templates/debugging-checklist.md` 复制进会话
157
+ - **规划改动时**:用 `templates/change-proposal.md` 写控制计划
158
+
159
+ ### 6. 自审计
160
+
161
+ 宣布完成之前,必须通过 `evals/checks.json` 中所有的 MUST 检查项。
162
+
163
+ ## 认知法则
164
+
165
+ 这个 skill 强制执行 8 条认知法则:
166
+
167
+ 1. 先命名 `x` 再命名 `u`。没名字的目标就没法调节。
168
+ 2. 先观测再猜测。综合方案之前先测量当前行为。
169
+ 3. 稳定优先于优化。扰动下发散就是失败。
170
+ 4. 闭环。观察实际结果,不断修正直到偏差有界。
171
+ 5. 可测扰动用前馈,其余用反馈。绝不在延迟回路上提高增益。
172
+ 6. 解耦有害耦合,协调有益耦合。调节关系,不只是绝对值。
173
+ 7. 最小控制。移动 `x` 到目标所需的最小 `u`,不搞投机性额外操作。
174
+ 8. 收敛。修正幅度必须越来越小。如果越来越大,说明不稳定——停下来重新识别。
175
+
176
+ ## 工作示例
177
+
178
+ **问题**:一个 API 接口在负载下间歇性返回 500。
179
+
180
+ | 步骤 | 控制论行动 |
181
+ |---|---|
182
+ | 识别 | `x` = 错误率;`u` = 重试/超时/缓存逻辑;边界 = 请求预算。 |
183
+ | 分析 | 在负载下复现;测量错误率随并发上升(不稳定)。 |
184
+ | 稳定 | 加熔断器 + 带退避的有界重试 → 错误率有界。 |
185
+ | 综合 | 最小改动,不要重写服务。 |
186
+ | 闭环 | 再次压测;错误率收敛到接近 0。 |
187
+ | 补偿 | 对可测依赖故障快速失败(前馈)+ 其余用反馈。 |
188
+ | 优化 | 此时才 trim p99 延迟。 |
189
+
190
+ **没有这套视角的常见失败**:无限制加重试 → 重试风暴(不稳定延迟环)→ 比原来更糟。
191
+
192
+ ## 参考文件
193
+
194
+ 8 篇深度参考,每篇对应一个控制论原则,附带 LLM 行为模式说明:
195
+
196
+ | 主题 | 文件 |
197
+ |---|---|
198
+ | 闭环工作流 | `references/closed-loop-workflow.md` |
199
+ | 状态、控制、可观测性、边界 | `references/state-and-control.md` |
200
+ | 稳定性 | `references/stability.md` |
201
+ | 建模与模型有效性 | `references/modeling.md` |
202
+ | 多变量:解耦与协调 | `references/multivariable.md` |
203
+ | 扰动补偿与时延 | `references/disturbance.md` |
204
+ | 有界控制 | `references/bounded-control.md` |
205
+ | 离散系统与测试节奏 | `references/discrete-systems.md` |
206
+
207
+ ## 自审计
208
+
209
+ `evals/checks.json` 列出了一组 MUST/SHOULD 检查项,供 LLM 或评审者确认思维 discipline 被遵循。在所有 MUST 项通过之前,不得宣布任务完成。
210
+
211
+ ## 贡献
212
+
213
+ - `SKILL.md` 中的每条主张都必须追溯到某个参考文件
214
+ - 每个引用链接必须能解析到存在的文件
215
+ - 保持 skill 精简,与原著保持一致
216
+ - 提交前运行 `./init.ps1`
217
+
218
+ 完整工作规则见 `AGENTS.md`。
219
+
220
+ ## 版本
221
+
222
+ 本 skill 遵循 [Semantic Versioning](https://semver.org/)(`X.Y.Z`)。
223
+
224
+ | 版本 | 日期 | 说明 |
225
+ |---|---|---|
226
+ | 0.1.0 | 2026-07-24 | 首次公开发布 |
227
+
228
+ 完整变更记录见 [CHANGELOG.md](CHANGELOG.md)。
229
+
230
+ ## 协议
231
+
232
+ MIT License。详见 [LICENSE](LICENSE)。
233
+
234
+ ---
235
+
236
+ ## Source
237
+
238
+ Qian Xuesen (Tsien Hsue-shen‌; 钱学森) & Song Jian (宋健), *Engineering Cybernetics* (工程控制论). The original book and its mathematical foundations are the authoritative source; this skill is a faithful interpretation, not a replacement.
239
+
240
+ ---
241
+
242
+ <br/><br/>
243
+
244
+ ---
245
+
246
+ <a name="english"></a>
247
+
248
+ <!-- Language toggle / 语言切换 -->
249
+
250
+ > [中文](#简介) | **English**
251
+
252
+ ---
253
+
254
+ ## About
255
+
256
+ `systems-thinking` is a thinking-mode skill. It installs a control-theoretic cognitive operating system in the LLM—shaping how the model *thinks* about systems (state, observability, stability, bounds, coupling) before writing or changing code.
257
+
258
+ > **One-line pitch: Control-theoretic thinking for code—know your state before you touch it.**
259
+
260
+ This is not a vocabulary test for humans, and not a bug-hunting playbook. It is a scaffold that reframes every non-trivial change from *"write the smallest patch and hope"* to *identify the state, measure the trajectory, stabilize the plant, then steer*.
261
+
262
+ Derived from Qian Xuesen (Tsien Hsue-shen‌) & Song Jian, *Engineering Cybernetics* (工程控制论). Language- and framework-agnostic. Self-contained.
263
+
264
+ ## What it solves
265
+
266
+ The default approach to coding is: start typing, then pray the tests pass. This skill changes that order.
267
+
268
+ It fits best when:
269
+
270
+ - You're changing legacy code you don't fully understand
271
+ - You're debugging something that breaks intermittently and can't be reproduced reliably
272
+ - You're refactoring modules that are tangled together
273
+ - A change needs to be both correct and robust
274
+
275
+ In these situations, "write the smallest patch" is often not enough. You need to understand the system's state first.
276
+
277
+ ## Core idea
278
+
279
+ One sentence: **a program is a dynamical system, and you are the controller.**
280
+
281
+ Every change injects a control signal. You only partially observe the true state. Bugs are unstable or poorly-damped trajectories. Debugging is state estimation. Tests are sensors feeding a feedback loop. **Closed loop beats open loop.**
282
+
283
+ ## Installation
284
+
285
+ This skill is designed for AI coding agents that support custom skills (Kilo, Claude Code, Aider, Cursor, etc.).
286
+
287
+ ### npm install (recommended)
288
+
289
+ ```bash
290
+ npm install skill-systems-thinking
291
+ ```
292
+
293
+ After installing, link the skill into your agent's skill directory:
294
+
295
+ ```bash
296
+ # Find where npm installed the package
297
+ npm root -g
298
+ # or for local project install:
299
+ node -e "console.log(require.resolve('skill-systems-thinking'))"
300
+ ```
301
+
302
+ Then symlink or copy the skill into your agent's skill directory (see agent-specific instructions below).
303
+
304
+ ### GitHub download
305
+
306
+ ```bash
307
+ git clone https://github.com/ShrimpLeon/systems-thinking.git
308
+ cp -r systems-thinking <agent-skills-dir>/
309
+ ```
310
+
311
+ ### Symlink (development)
312
+
313
+ ```bash
314
+ ln -s /absolute/path/to/systems-thinking <agent-skills-dir>/
315
+ ```
316
+
317
+ ### Agent-specific setup
318
+
319
+ The npm package installs the skill files into `node_modules/skill-systems-thinking/`. You then need to make your agent aware of them. Below are the paths for each supported agent.
320
+
321
+ | Agent | Skill directory | npm link command |
322
+ |---|---|---|
323
+ | Kilo | `~/.config/kilo/skills/` or project `.kilo/agent/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.config/kilo/skills/systems-thinking` |
324
+ | Claude Code | `~/.claude/plugins/custom-skills/` or project `.claude/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.claude/plugins/custom-skills/systems-thinking` |
325
+ | Aider | `--skills-dir` path | `ln -s $(npm root -g)/skill-systems-thinking <aider-skills-dir>/` |
326
+ | Cursor | Project `.cursor/rules/` or global settings | `ln -s $(npm root -g)/skill-systems-thinking .cursor/rules/systems-thinking` |
327
+ | OpenAI Codex | `~/.codex/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.codex/skills/systems-thinking` |
328
+ | GitHub Copilot | `~/.copilot/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.copilot/skills/systems-thinking` |
329
+ | Windsurf | `~/.windsurf/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.windsurf/skills/systems-thinking` |
330
+ | Zed | `~/.zed/skills/` | `ln -s $(npm root -g)/skill-systems-thinking ~/.zed/skills/systems-thinking` |
331
+
332
+ > **Note:** If your agent does not appear above, check its documentation for custom skill/plugin paths. The npm package installs to a standard `node_modules` location, so any agent that can load skills from an arbitrary directory will work.
333
+
334
+ ### Verify installation
335
+
336
+ ```bash
337
+ pwsh init.ps1
338
+ ```
339
+
340
+ Look for `Verification Complete OK`.
341
+
342
+ ## Compatibility
343
+
344
+ The npm package `skill-systems-thinking` is compatible with the following AI agents:
345
+
346
+ | Agent | npm install compatible | Notes |
347
+ |---|---|---|
348
+ | Kilo | | Link via `~/.config/kilo/skills/` or `.kilo/agent/` |
349
+ | Claude Code | ✅ | Link via `~/.claude/plugins/custom-skills/` or `.claude/` |
350
+ | Aider | | Link via `--skills-dir` flag |
351
+ | Cursor | ✅ | Link via `.cursor/rules/` or global settings |
352
+ | OpenAI Codex | ✅ | Link via `~/.codex/skills/` |
353
+ | GitHub Copilot | ✅ | Link via `~/.copilot/skills/` |
354
+ | Windsurf | | Link via `~/.windsurf/skills/` |
355
+ | Zed | ✅ | Link via `~/.zed/skills/` |
356
+
357
+ The npm install deploys skill files to `node_modules/skill-systems-thinking/`, then you symlink them into each agent's skill directory. Since the npm package does not include agent-specific config files (like `.kilo/`, `.claude/`, etc.), you need to manually create symlinks pointing from each agent's skill directory to the npm-installed location. This is the same operation across all supported agents.
358
+
359
+ ## Usage
360
+
361
+ ### 1. When to load
362
+
363
+ Load this skill when the task involves:
364
+
365
+ - Architecture design
366
+ - Debugging non-deterministic behavior
367
+ - Cross-module refactoring
368
+ - Any change where correctness AND robustness both matter
369
+
370
+ ### 2. Read SKILL.md
371
+
372
+ Read `SKILL.md` first. The runtime prompt block installs the cognitive laws. The workflow below follows naturally.
373
+
374
+ ### 3. Name things before touching code
375
+
376
+ Before proposing any change, the LLM must name four things:
377
+
378
+ - `x` the controlled variable (what must stay correct)
379
+ - `u` — the control variable (the lever you will actually move)
380
+ - Observability — how will you know the current value of `x`?
381
+ - Bounds — every actuator saturates; no unbounded loop is acceptable
382
+
383
+ ### 4. Seven-step loop
384
+
385
+ | Step | Principle | Reference |
386
+ |---|---|---|
387
+ | 1 | Identify — name `x`, `u`, observability, bounds. | `references/state-and-control.md` |
388
+ | 2 | Analyze — reproduce, measure, locate fault, state the model. | `references/modeling.md` |
389
+ | 3 | Stabilize — kill divergence / oscillation / leaks before features. | `references/stability.md` |
390
+ | 4 | Synthesize — minimal `u`; decouple what hurts, coordinate what helps. | `references/multivariable.md` |
391
+ | 5 | Close the loop — observe actual result; correct until bounded. | `references/closed-loop-workflow.md` |
392
+ | 6 | Compensate feedforward measurable disturbances; clamp the actuator. | `references/disturbance.md` |
393
+ | 7 | Optimize — only then tune secondary indicators. | `references/bounded-control.md` |
394
+
395
+ For sampled-system and test-cadence concerns, also see `references/discrete-systems.md`.
396
+
397
+ ### 5. Templates
398
+
399
+ These files are located in the skill's `templates/` directory (relative to the skill
400
+ installation root).
401
+
402
+ - **Debugging**: copy `templates/debugging-checklist.md` into the session.
403
+ - **Planning**: use `templates/change-proposal.md` to write a control plan.
404
+
405
+ ### 6. Self-audit
406
+
407
+ Before declaring done, pass all MUST checks in `evals/checks.json`.
408
+
409
+ ## Cognitive laws
410
+
411
+ The skill enforces 8 cognitive laws:
412
+
413
+ 1. Name `x` before `u`. Unnamed targets are unregulated.
414
+ 2. Observe before you guess. Measure current behavior before synthesizing the fix.
415
+ 3. Stabilize before you optimize. Divergence under perturbation is failure.
416
+ 4. Close the loop. Observe the actual result; correct until deviation is bounded.
417
+ 5. Feedforward measurable disturbances; feedback the rest. Never crank gain on delay.
418
+ 6. Decouple harmful coupling. Coordinate beneficial coupling. Regulate relations, not just absolutes.
419
+ 7. Minimal control. The smallest `u` that moves `x` to target. No speculative extras.
420
+ 8. Convergence: corrections must shrink. If they grow, you are unstable — stop and re-identify.
421
+
422
+ ## Worked example
423
+
424
+ **Symptom:** an API endpoint intermittently returns 500 under load.
425
+
426
+ | Step | Control-theoretic action |
427
+ |---|---|
428
+ | Identify | `x` = error rate; `u` = retry/timeout/cache logic; bound = request budget. |
429
+ | Analyze | Reproduce under load; measure that error rate climbs with concurrency (unstable). |
430
+ | Stabilize | Add circuit breaker + bounded retries with backoff → error rate bounded. |
431
+ | Synthesize | Minimal change; don't rewrite the service. |
432
+ | Close the loop | Load-test again; error rate now converges to ~0. |
433
+ | Compensate | Feedforward on measurable dependency outage (fail fast) + feedback on the rest. |
434
+ | Optimize | Only now trim p99 latency. |
435
+
436
+ **Without this lens:** add retries with no bound → retry storm (an unstable delay loop) → worse than before.
437
+
438
+ ## References
439
+
440
+ 8 deep-dive references, each anchored to the original text with LLM behavior patterns:
441
+
442
+ | Topic | File |
443
+ |---|---|
444
+ | Closed-loop workflow | `references/closed-loop-workflow.md` |
445
+ | State, control, observability, bounds | `references/state-and-control.md` |
446
+ | Stability | `references/stability.md` |
447
+ | Modeling and model validity | `references/modeling.md` |
448
+ | Multivariable: decouple and coordinate | `references/multivariable.md` |
449
+ | Disturbance compensation and time-delay | `references/disturbance.md` |
450
+ | Bounded control | `references/bounded-control.md` |
451
+ | Discrete systems and test cadence | `references/discrete-systems.md` |
452
+
453
+ ## Self-audit
454
+
455
+ `evals/checks.json` lists concrete MUST/SHOULD checks an LLM or reviewer applies to confirm the discipline was followed. All MUST items must pass before a task is called done.
456
+
457
+ ## Contributing
458
+
459
+ - Every claim in `SKILL.md` must trace to a reference file.
460
+ - Every reference link must resolve to an existing file.
461
+ - Keep the skill small and aligned to the book.
462
+ - Run `./init.ps1` before submitting.
463
+
464
+ See `AGENTS.md` for the full working rules and definition of done.
465
+
466
+ ## Version
467
+
468
+ This skill follows [Semantic Versioning](https://semver.org/) (`X.Y.Z`).
469
+
470
+ | Version | Date | Notes |
471
+ |---|---|---|
472
+ | 0.1.0 | 2026-07-24 | Initial public release |
473
+
474
+ Full history: [CHANGELOG.md](CHANGELOG.md).
475
+
476
+ ## License
477
+
478
+ MIT License. See [LICENSE](LICENSE) for details.
479
+
480
+ ## Source
481
+
482
+ Derived from Qian Xuesen (钱学森) & Song Jian (宋健), *Engineering Cybernetics* (工程控制论). The original book and its mathematical foundations are the authoritative source; this skill is a faithful interpretation, not a replacement.