skill-systems-thinking 0.1.0 → 0.1.2

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