@zmice/zc 0.2.5 → 0.2.7

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.
Files changed (103) hide show
  1. package/README.md +98 -11
  2. package/dist/cli/__tests__/platform.test.js +215 -2
  3. package/dist/cli/__tests__/platform.test.js.map +1 -1
  4. package/dist/cli/__tests__/surface.test.js +52 -0
  5. package/dist/cli/__tests__/surface.test.js.map +1 -1
  6. package/dist/cli/__tests__/team.test.d.ts +2 -0
  7. package/dist/cli/__tests__/team.test.d.ts.map +1 -0
  8. package/dist/cli/__tests__/team.test.js +29 -0
  9. package/dist/cli/__tests__/team.test.js.map +1 -0
  10. package/dist/cli/__tests__/upstream.test.js +4 -0
  11. package/dist/cli/__tests__/upstream.test.js.map +1 -1
  12. package/dist/cli/platform.d.ts +11 -3
  13. package/dist/cli/platform.d.ts.map +1 -1
  14. package/dist/cli/platform.js +216 -54
  15. package/dist/cli/platform.js.map +1 -1
  16. package/dist/cli/team.d.ts.map +1 -1
  17. package/dist/cli/team.js +114 -4
  18. package/dist/cli/team.js.map +1 -1
  19. package/dist/cli/upstream.d.ts +1 -0
  20. package/dist/cli/upstream.d.ts.map +1 -1
  21. package/dist/cli/upstream.js +84 -5
  22. package/dist/cli/upstream.js.map +1 -1
  23. package/dist/node_modules/@zmice/platform-core/dist/index.d.ts +37 -3
  24. package/dist/node_modules/@zmice/platform-core/dist/index.d.ts.map +1 -1
  25. package/dist/node_modules/@zmice/platform-core/dist/index.js +68 -0
  26. package/dist/node_modules/@zmice/platform-core/dist/index.js.map +1 -1
  27. package/dist/node_modules/@zmice/platform-core/dist/index.test.js +44 -1
  28. package/dist/node_modules/@zmice/platform-core/dist/index.test.js.map +1 -1
  29. package/dist/runtime/__tests__/worktree-manager.test.js +63 -1
  30. package/dist/runtime/__tests__/worktree-manager.test.js.map +1 -1
  31. package/dist/runtime/worktree-manager.d.ts +26 -1
  32. package/dist/runtime/worktree-manager.d.ts.map +1 -1
  33. package/dist/runtime/worktree-manager.js +126 -12
  34. package/dist/runtime/worktree-manager.js.map +1 -1
  35. package/dist/team/__tests__/orchestrator.test.js +40 -0
  36. package/dist/team/__tests__/orchestrator.test.js.map +1 -1
  37. package/dist/team/__tests__/planner.test.d.ts +2 -0
  38. package/dist/team/__tests__/planner.test.d.ts.map +1 -0
  39. package/dist/team/__tests__/planner.test.js +43 -0
  40. package/dist/team/__tests__/planner.test.js.map +1 -0
  41. package/dist/team/__tests__/task-queue.test.js +18 -0
  42. package/dist/team/__tests__/task-queue.test.js.map +1 -1
  43. package/dist/team/orchestrator.d.ts +2 -1
  44. package/dist/team/orchestrator.d.ts.map +1 -1
  45. package/dist/team/orchestrator.js +29 -10
  46. package/dist/team/orchestrator.js.map +1 -1
  47. package/dist/team/planner.d.ts +27 -0
  48. package/dist/team/planner.d.ts.map +1 -0
  49. package/dist/team/planner.js +120 -0
  50. package/dist/team/planner.js.map +1 -0
  51. package/dist/team/task-queue.d.ts +3 -0
  52. package/dist/team/task-queue.d.ts.map +1 -1
  53. package/dist/team/task-queue.js +11 -2
  54. package/dist/team/task-queue.js.map +1 -1
  55. package/package.json +2 -2
  56. package/vendor/node_modules/@zmice/platform-core/dist/index.d.ts +37 -3
  57. package/vendor/node_modules/@zmice/platform-core/dist/index.d.ts.map +1 -1
  58. package/vendor/node_modules/@zmice/platform-core/dist/index.js +68 -0
  59. package/vendor/node_modules/@zmice/platform-core/dist/index.js.map +1 -1
  60. package/vendor/node_modules/@zmice/platform-core/dist/index.test.js +44 -1
  61. package/vendor/node_modules/@zmice/platform-core/dist/index.test.js.map +1 -1
  62. package/vendor/packages/platform-claude/dist/index.d.ts.map +1 -1
  63. package/vendor/packages/platform-claude/dist/index.js +12 -70
  64. package/vendor/packages/platform-claude/dist/index.js.map +1 -1
  65. package/vendor/packages/platform-codex/dist/generate.d.ts +1 -1
  66. package/vendor/packages/platform-codex/dist/generate.d.ts.map +1 -1
  67. package/vendor/packages/platform-codex/dist/generate.js +1 -1
  68. package/vendor/packages/platform-codex/dist/generate.js.map +1 -1
  69. package/vendor/packages/platform-codex/dist/index.d.ts +15 -1
  70. package/vendor/packages/platform-codex/dist/index.d.ts.map +1 -1
  71. package/vendor/packages/platform-codex/dist/index.js +320 -47
  72. package/vendor/packages/platform-codex/dist/index.js.map +1 -1
  73. package/vendor/packages/platform-codex/dist/index.test.js +113 -5
  74. package/vendor/packages/platform-codex/dist/index.test.js.map +1 -1
  75. package/vendor/packages/platform-opencode/dist/index.d.ts.map +1 -1
  76. package/vendor/packages/platform-opencode/dist/index.js +15 -81
  77. package/vendor/packages/platform-opencode/dist/index.js.map +1 -1
  78. package/vendor/packages/platform-qwen/dist/index.d.ts.map +1 -1
  79. package/vendor/packages/platform-qwen/dist/index.js +28 -84
  80. package/vendor/packages/platform-qwen/dist/index.js.map +1 -1
  81. package/vendor/packages/toolkit/src/content/agents/architect/body.md +8 -0
  82. package/vendor/packages/toolkit/src/content/agents/code-reviewer/body.md +10 -0
  83. package/vendor/packages/toolkit/src/content/agents/product-owner/body.md +8 -0
  84. package/vendor/packages/toolkit/src/content/commands/plan-review/body.md +3 -1
  85. package/vendor/packages/toolkit/src/content/commands/start/body.md +51 -2
  86. package/vendor/packages/toolkit/src/content/commands/start/meta.yaml +2 -2
  87. package/vendor/packages/toolkit/src/content/skills/branch-finish-and-cleanup/body.md +17 -0
  88. package/vendor/packages/toolkit/src/content/skills/browser-qa-testing/body.md +77 -520
  89. package/vendor/packages/toolkit/src/content/skills/ci-cd-and-automation/body.md +56 -387
  90. package/vendor/packages/toolkit/src/content/skills/code-review-and-quality/body.md +10 -0
  91. package/vendor/packages/toolkit/src/content/skills/code-simplification/body.md +55 -301
  92. package/vendor/packages/toolkit/src/content/skills/context-engineering/body.md +10 -0
  93. package/vendor/packages/toolkit/src/content/skills/continuous-learning/body.md +66 -331
  94. package/vendor/packages/toolkit/src/content/skills/multi-perspective-review/body.md +30 -1
  95. package/vendor/packages/toolkit/src/content/skills/parallel-agent-dispatch/body.md +79 -317
  96. package/vendor/packages/toolkit/src/content/skills/performance-optimization/body.md +60 -330
  97. package/vendor/packages/toolkit/src/content/skills/planning-and-task-breakdown/body.md +35 -0
  98. package/vendor/packages/toolkit/src/content/skills/sdd-tdd-workflow/body.md +66 -342
  99. package/vendor/packages/toolkit/src/content/skills/sprint-retrospective/body.md +66 -303
  100. package/vendor/packages/toolkit/src/content/skills/team-orchestration/body.md +81 -327
  101. package/vendor/packages/toolkit/src/content/skills/test-driven-development/body.md +50 -346
  102. package/vendor/packages/toolkit/src/content/skills/using-agent-skills/body.md +26 -2
  103. package/vendor/references/upstreams.yaml +5 -0
@@ -1,326 +1,80 @@
1
1
  # Code Simplification
2
2
 
3
- > Inspired by the [Claude Code Simplifier plugin](https://github.com/anthropics/claude-plugins-official/blob/main/plugins/code-simplifier/agents/code-simplifier.md). Adapted here as a model-agnostic, process-driven skill for any AI coding agent.
3
+ ## 角色定位
4
4
 
5
- ## Overview
5
+ 在不改变行为的前提下降低代码理解成本。目标不是减少行数,而是让下一位维护者更快理解、更安全修改、更容易验证。
6
6
 
7
- Simplify code by reducing complexity while preserving exact behavior. The goal is not fewer lines — it's code that is easier to read, understand, modify, and debug. Every simplification must pass a simple test: "Would a new team member understand this faster than the original?"
7
+ ## 何时使用
8
8
 
9
- ## When to Use
9
+ - 功能已经工作且测试通过,但实现明显偏重。
10
+ - review 指出可读性、重复、嵌套或抽象层级问题。
11
+ - 最近修改的代码引入了重复或不一致。
12
+ - 需要在进入下一轮功能前降低维护成本。
10
13
 
11
- - After a feature is working and tests pass, but the implementation feels heavier than it needs to be
12
- - During code review when readability or complexity issues are flagged
13
- - When you encounter deeply nested logic, long functions, or unclear names
14
- - When refactoring code written under time pressure
15
- - When consolidating related logic scattered across files
16
- - After merging changes that introduced duplication or inconsistency
14
+ 不适用:
17
15
 
18
- **When NOT to use:**
16
+ - 还没有理解代码为什么存在。
17
+ - 缺少能保护行为的测试或验证方式。
18
+ - 性能关键路径会因为“更简单”变慢。
19
+ - 即将废弃或重写的代码。
19
20
 
20
- - Code is already clean and readable — don't simplify for the sake of it
21
- - You don't understand what the code does yet — comprehend before you simplify
22
- - The code is performance-critical and the "simpler" version would be measurably slower
23
- - You're about to rewrite the module entirely — simplifying throwaway code wastes effort
21
+ ## 快速路径
24
22
 
25
- ## The Five Principles
23
+ 1. 明确要保持不变的行为、输入、输出、副作用和错误路径。
24
+ 2. 读取邻近代码和项目约定,确认本仓库的风格。
25
+ 3. 找一个具体简化目标:命名、重复、嵌套、函数职责、死代码、无效抽象。
26
+ 4. 一次只做一个简化切片。
27
+ 5. 每个切片后运行最小相关测试。
28
+ 6. 对比前后可读性和 diff 可审性。
29
+ 7. 如果新版本更难审或行为证据不足,回退该切片。
26
30
 
27
- ### 1. Preserve Behavior Exactly
31
+ ## 简化信号
28
32
 
29
- Don't change what the code does — only how it expresses it. All inputs, outputs, side effects, error behavior, and edge cases must remain identical. If you're not sure a simplification preserves behavior, don't make it.
33
+ 优先处理具体信号,而不是泛泛“感觉复杂”:
30
34
 
31
- ```
32
- ASK BEFORE EVERY CHANGE:
33
- Does this produce the same output for every input?
34
- Does this maintain the same error behavior?
35
- Does this preserve the same side effects and ordering?
36
- Do all existing tests still pass without modification?
37
- ```
38
-
39
- ### 2. Follow Project Conventions
40
-
41
- Simplification means making code more consistent with the codebase, not imposing external preferences. Before simplifying:
42
-
43
- ```
44
- 1. Read CLAUDE.md / project conventions
45
- 2. Study how neighboring code handles similar patterns
46
- 3. Match the project's style for:
47
- - Import ordering and module system
48
- - Function declaration style
49
- - Naming conventions
50
- - Error handling patterns
51
- - Type annotation depth
52
- ```
53
-
54
- Simplification that breaks project consistency is not simplification — it's churn.
55
-
56
- ### 3. Prefer Clarity Over Cleverness
57
-
58
- Explicit code is better than compact code when the compact version requires a mental pause to parse.
59
-
60
- ```typescript
61
- // UNCLEAR: Dense ternary chain
62
- const label = isNew ? 'New' : isUpdated ? 'Updated' : isArchived ? 'Archived' : 'Active';
63
-
64
- // CLEAR: Readable mapping
65
- function getStatusLabel(item: Item): string {
66
- if (item.isNew) return 'New';
67
- if (item.isUpdated) return 'Updated';
68
- if (item.isArchived) return 'Archived';
69
- return 'Active';
70
- }
71
- ```
72
-
73
- ```typescript
74
- // UNCLEAR: Chained reduces with inline logic
75
- const result = items.reduce((acc, item) => ({
76
- ...acc,
77
- [item.id]: { ...acc[item.id], count: (acc[item.id]?.count ?? 0) + 1 }
78
- }), {});
79
-
80
- // CLEAR: Named intermediate step
81
- const countById = new Map<string, number>();
82
- for (const item of items) {
83
- countById.set(item.id, (countById.get(item.id) ?? 0) + 1);
84
- }
85
- ```
86
-
87
- ### 4. Maintain Balance
88
-
89
- Simplification has a failure mode: over-simplification. Watch for these traps:
90
-
91
- - **Inlining too aggressively** — removing a helper that gave a concept a name makes the call site harder to read
92
- - **Combining unrelated logic** — two simple functions merged into one complex function is not simpler
93
- - **Removing "unnecessary" abstraction** — some abstractions exist for extensibility or testability, not complexity
94
- - **Optimizing for line count** — fewer lines is not the goal; easier comprehension is
95
-
96
- ### 5. Scope to What Changed
97
-
98
- Default to simplifying recently modified code. Avoid drive-by refactors of unrelated code unless explicitly asked to broaden scope. Unscoped simplification creates noise in diffs and risks unintended regressions.
99
-
100
- ## The Simplification Process
101
-
102
- ### Step 1: Understand Before Touching (Chesterton's Fence)
103
-
104
- Before changing or removing anything, understand why it exists. This is Chesterton's Fence: if you see a fence across a road and don't understand why it's there, don't tear it down. First understand the reason, then decide if the reason still applies.
105
-
106
- ```
107
- BEFORE SIMPLIFYING, ANSWER:
108
- - What is this code's responsibility?
109
- - What calls it? What does it call?
110
- - What are the edge cases and error paths?
111
- - Are there tests that define the expected behavior?
112
- - Why might it have been written this way? (Performance? Platform constraint? Historical reason?)
113
- - Check git blame: what was the original context for this code?
114
- ```
115
-
116
- If you can't answer these, you're not ready to simplify. Read more context first.
117
-
118
- ### Step 2: Identify Simplification Opportunities
35
+ - 3 层以上嵌套,可以改为 guard clause 或提取谓词。
36
+ - 长函数承担多个职责,可以拆成命名清楚的小函数。
37
+ - 重复条件或重复逻辑,可以提取共享函数。
38
+ - 命名不能表达业务含义,可以重命名。
39
+ - 注释解释“做什么”,代码本身可表达时可以删除;解释“为什么”的注释保留。
40
+ - 只有一个实现的过度抽象,可以考虑内联。
41
+ - 不可达分支、未使用变量、过期注释,可以在确认后删除。
119
42
 
120
- Scan for these patterns — each one is a concrete signal, not a vague smell:
43
+ ## 行为保护
121
44
 
122
- **Structural complexity:**
45
+ 简化前先回答:
123
46
 
124
- | Pattern | Signal | Simplification |
125
- |---------|--------|----------------|
126
- | Deep nesting (3+ levels) | Hard to follow control flow | Extract conditions into guard clauses or helper functions |
127
- | Long functions (50+ lines) | Multiple responsibilities | Split into focused functions with descriptive names |
128
- | Nested ternaries | Requires mental stack to parse | Replace with if/else chains, switch, or lookup objects |
129
- | Boolean parameter flags | `doThing(true, false, true)` | Replace with options objects or separate functions |
130
- | Repeated conditionals | Same `if` check in multiple places | Extract to a well-named predicate function |
47
+ - 现有测试覆盖了什么?
48
+ - 哪些边界没有测试但需要人工验证?
49
+ - 这个代码是否有历史原因、平台限制或性能约束?
50
+ - 是否有调用方依赖当前副作用或错误行为?
131
51
 
132
- **Naming and readability:**
52
+ 无法回答时,先回到 `codebase-onboarding` 或 `test-driven-development` 补证据。
133
53
 
134
- | Pattern | Signal | Simplification |
135
- |---------|--------|----------------|
136
- | Generic names | `data`, `result`, `temp`, `val`, `item` | Rename to describe the content: `userProfile`, `validationErrors` |
137
- | Abbreviated names | `usr`, `cfg`, `btn`, `evt` | Use full words unless the abbreviation is universal (`id`, `url`, `api`) |
138
- | Misleading names | Function named `get` that also mutates state | Rename to reflect actual behavior |
139
- | Comments explaining "what" | `// increment counter` above `count++` | Delete the comment — the code is clear enough |
140
- | Comments explaining "why" | `// Retry because the API is flaky under load` | Keep these — they carry intent the code can't express |
54
+ ## 反模式
141
55
 
142
- **Redundancy:**
56
+ - 为了少几行牺牲可读性。
57
+ - 把有意义的 helper 内联成重复逻辑。
58
+ - 顺手重构无关文件,制造 review 噪声。
59
+ - 同一个提交里混合功能变更和简化重构。
60
+ - 没有测试保护就改公共接口或错误路径。
143
61
 
144
- | Pattern | Signal | Simplification |
145
- |---------|--------|----------------|
146
- | Duplicated logic | Same 5+ lines in multiple places | Extract to a shared function |
147
- | Dead code | Unreachable branches, unused variables, commented-out blocks | Remove (after confirming it's truly dead) |
148
- | Unnecessary abstractions | Wrapper that adds no value | Inline the wrapper, call the underlying function directly |
149
- | Over-engineered patterns | Factory-for-a-factory, strategy-with-one-strategy | Replace with the simple direct approach |
150
- | Redundant type assertions | Casting to a type that's already inferred | Remove the assertion |
151
-
152
- ### Step 3: Apply Changes Incrementally
153
-
154
- Make one simplification at a time. Run tests after each change. **Submit refactoring changes separately from feature or bug fix changes.** A PR that refactors and adds a feature is two PRs — split them.
62
+ ## 输出契约
155
63
 
64
+ ```text
65
+ Simplification evidence:
66
+ - Target:
67
+ - Behavior preserved:
68
+ - Change made:
69
+ - Tests / verification:
70
+ - Before/after readability:
71
+ - Remaining risk:
156
72
  ```
157
- FOR EACH SIMPLIFICATION:
158
- 1. Make the change
159
- 2. Run the test suite
160
- 3. If tests pass → commit (or continue to next simplification)
161
- 4. If tests fail → revert and reconsider
162
- ```
163
-
164
- Avoid batching multiple simplifications into a single untested change. If something breaks, you need to know which simplification caused it.
165
-
166
- **The Rule of 500:** If a refactoring would touch more than 500 lines, invest in automation (codemods, sed scripts, AST transforms) rather than making the changes by hand. Manual edits at that scale are error-prone and exhausting to review.
167
-
168
- ### Step 4: Verify the Result
169
-
170
- After all simplifications, step back and evaluate the whole:
171
-
172
- ```
173
- COMPARE BEFORE AND AFTER:
174
- - Is the simplified version genuinely easier to understand?
175
- - Did you introduce any new patterns inconsistent with the codebase?
176
- - Is the diff clean and reviewable?
177
- - Would a teammate approve this change?
178
- ```
179
-
180
- If the "simplified" version is harder to understand or review, revert. Not every simplification attempt succeeds.
181
-
182
- ## Language-Specific Guidance
183
-
184
- ### TypeScript / JavaScript
185
-
186
- ```typescript
187
- // SIMPLIFY: Unnecessary async wrapper
188
- // Before
189
- async function getUser(id: string): Promise<User> {
190
- return await userService.findById(id);
191
- }
192
- // After
193
- function getUser(id: string): Promise<User> {
194
- return userService.findById(id);
195
- }
196
-
197
- // SIMPLIFY: Verbose conditional assignment
198
- // Before
199
- let displayName: string;
200
- if (user.nickname) {
201
- displayName = user.nickname;
202
- } else {
203
- displayName = user.fullName;
204
- }
205
- // After
206
- const displayName = user.nickname || user.fullName;
207
73
 
208
- // SIMPLIFY: Manual array building
209
- // Before
210
- const activeUsers: User[] = [];
211
- for (const user of users) {
212
- if (user.isActive) {
213
- activeUsers.push(user);
214
- }
215
- }
216
- // After
217
- const activeUsers = users.filter((user) => user.isActive);
74
+ 推荐结论:
218
75
 
219
- // SIMPLIFY: Redundant boolean return
220
- // Before
221
- function isValid(input: string): boolean {
222
- if (input.length > 0 && input.length < 100) {
223
- return true;
224
- }
225
- return false;
226
- }
227
- // After
228
- function isValid(input: string): boolean {
229
- return input.length > 0 && input.length < 100;
230
- }
76
+ ```text
77
+ Recommendation: <apply / stop / add tests first / defer> because <行为证据、维护收益和被放弃替代方案>。
231
78
  ```
232
79
 
233
- ### Python
234
-
235
- ```python
236
- # SIMPLIFY: Verbose dictionary building
237
- # Before
238
- result = {}
239
- for item in items:
240
- result[item.id] = item.name
241
- # After
242
- result = {item.id: item.name for item in items}
243
-
244
- # SIMPLIFY: Nested conditionals with early return
245
- # Before
246
- def process(data):
247
- if data is not None:
248
- if data.is_valid():
249
- if data.has_permission():
250
- return do_work(data)
251
- else:
252
- raise PermissionError("No permission")
253
- else:
254
- raise ValueError("Invalid data")
255
- else:
256
- raise TypeError("Data is None")
257
- # After
258
- def process(data):
259
- if data is None:
260
- raise TypeError("Data is None")
261
- if not data.is_valid():
262
- raise ValueError("Invalid data")
263
- if not data.has_permission():
264
- raise PermissionError("No permission")
265
- return do_work(data)
266
- ```
267
-
268
- ### React / JSX
269
-
270
- ```tsx
271
- // SIMPLIFY: Verbose conditional rendering
272
- // Before
273
- function UserBadge({ user }: Props) {
274
- if (user.isAdmin) {
275
- return <Badge variant="admin">Admin</Badge>;
276
- } else {
277
- return <Badge variant="default">User</Badge>;
278
- }
279
- }
280
- // After
281
- function UserBadge({ user }: Props) {
282
- const variant = user.isAdmin ? 'admin' : 'default';
283
- const label = user.isAdmin ? 'Admin' : 'User';
284
- return <Badge variant={variant}>{label}</Badge>;
285
- }
286
-
287
- // SIMPLIFY: Prop drilling through intermediate components
288
- // Before — consider whether context or composition solves this better.
289
- // This is a judgment call — flag it, don't auto-refactor.
290
- ```
291
-
292
- ## Common Rationalizations
293
-
294
- | Rationalization | Reality |
295
- |---|---|
296
- | "It's working, no need to touch it" | Working code that's hard to read will be hard to fix when it breaks. Simplifying now saves time on every future change. |
297
- | "Fewer lines is always simpler" | A 1-line nested ternary is not simpler than a 5-line if/else. Simplicity is about comprehension speed, not line count. |
298
- | "I'll just quickly simplify this unrelated code too" | Unscoped simplification creates noisy diffs and risks regressions in code you didn't intend to change. Stay focused. |
299
- | "The types make it self-documenting" | Types document structure, not intent. A well-named function explains *why* better than a type signature explains *what*. |
300
- | "This abstraction might be useful later" | Don't preserve speculative abstractions. If it's not used now, it's complexity without value. Remove it and re-add when needed. |
301
- | "The original author must have had a reason" | Maybe. Check git blame — apply Chesterton's Fence. But accumulated complexity often has no reason; it's just the residue of iteration under pressure. |
302
- | "I'll refactor while adding this feature" | Separate refactoring from feature work. Mixed changes are harder to review, revert, and understand in history. |
303
-
304
- ## Red Flags
305
-
306
- - Simplification that requires modifying tests to pass (you likely changed behavior)
307
- - "Simplified" code that is longer and harder to follow than the original
308
- - Renaming things to match your preferences rather than project conventions
309
- - Removing error handling because "it makes the code cleaner"
310
- - Simplifying code you don't fully understand
311
- - Batching many simplifications into one large, hard-to-review commit
312
- - Refactoring code outside the scope of the current task without being asked
313
-
314
- ## Verification
315
-
316
- After completing a simplification pass:
317
-
318
- - [ ] All existing tests pass without modification
319
- - [ ] Build succeeds with no new warnings
320
- - [ ] Linter/formatter passes (no style regressions)
321
- - [ ] Each simplification is a reviewable, incremental change
322
- - [ ] The diff is clean — no unrelated changes mixed in
323
- - [ ] Simplified code follows project conventions (checked against CLAUDE.md or equivalent)
324
- - [ ] No error handling was removed or weakened
325
- - [ ] No dead code was left behind (unused imports, unreachable branches)
326
- - [ ] A teammate or review agent would approve the change as a net improvement
80
+ 如果不能证明行为保持不变,默认不要简化。
@@ -15,6 +15,8 @@
15
15
  - 最小充分上下文优先于“大而全”材料堆叠
16
16
  - 上下文装载要服务当前任务,不为可能发生的旁支需求提前铺料
17
17
  - 一旦任务阶段变化,就主动压缩和重建上下文,避免 drift
18
+ - skill 按需加载优先于常驻加载;常驻文件只放稳定项目约定和路由规则
19
+ - 用户级配置、跨项目路由、跨会话记忆或跨机器同步都属于持久化行为,必须先说明影响并取得明确授权
18
20
 
19
21
  ## 输入前提
20
22
 
@@ -30,6 +32,11 @@
30
32
  4. 控制上下文体积,只保留当前任务需要的信息
31
33
  5. 任务切换或阶段推进时主动压缩总结,清理旧上下文
32
34
  6. 发现上下文冲突、缺口或陈旧信息时,显式暴露而不是猜测
35
+ 7. 区分上下文载体:
36
+ - `AGENTS.md` / `CLAUDE.md` / `GEMINI.md`:长期规则、项目边界、稳定路由
37
+ - skill 文件:阶段性工作流,按需加载
38
+ - references / checklists:需要深入验证时再加载
39
+ - 用户级配置或记忆:只在明确授权后写入
33
40
 
34
41
  ## 成功标准
35
42
 
@@ -39,6 +46,8 @@
39
46
  - 上下文切换不会把旧问题带入新任务
40
47
  - 遇到冲突时能清楚指出需要人类决策的点
41
48
  - 不会因为上下文膨胀而偏离当前任务
49
+ - 没有为了“方便”把所有 skill、所有上游文档或所有历史记忆一次性塞入当前会话
50
+ - 任何持久化写入都有明确授权、可解释影响和回滚路径
42
51
 
43
52
  ## 相关原则
44
53
 
@@ -48,6 +57,7 @@
48
57
  - 外科式修改也适用于上下文,只带入要改的那一小块
49
58
  - 规格和规则优先于猜测
50
59
  - 压缩上下文是持续动作,不是最后补救
60
+ - 上游能力先变成治理记录,再决定是否成为常驻规则或平台能力
51
61
 
52
62
  ## 回到主流程
53
63