Agent Skills › openchamber/openchamber › openchamber-change-discipline

openchamber-change-discipline

GitHub

提供OpenChamber代码变更纪律,指导如何最小化修改、分类风险并验证影响。涵盖本地实现、模块契约、跨工作区及平台行为等场景,确保变更安全且结构清晰。

.agents/skills/openchamber-change-discipline/SKILL.md openchamber/openchamber

触发场景

实施或修复OpenChamber源代码 重构模块或依赖 修改构建配置或导出

安装

npx skills add openchamber/openchamber --skill openchamber-change-discipline -g -y
更多选项

非标准路径

npx skills add https://github.com/openchamber/openchamber/tree/main/.agents/skills/openchamber-change-discipline -g -y

不安装直接使用

npx skills use openchamber/openchamber@openchamber-change-discipline

指定 Agent (Claude Code)

npx skills add openchamber/openchamber --skill openchamber-change-discipline -a claude-code -g -y

安装 repo 全部 skill

npx skills add openchamber/openchamber --all -g -y

预览 repo 内 skill

npx skills add openchamber/openchamber --list

SKILL.md

Frontmatter
{
    "name": "openchamber-change-discipline",
    "description": "Use when implementing, fixing, refactoring, or otherwise modifying OpenChamber source code, dependencies, exports, build configuration, generated assets, package contracts, or module ownership."
}

OpenChamber Change Discipline

Core Principle

Make the smallest complete change and validate at the narrowest level that covers the real risk.

Before Editing

  1. Classify every applicable change risk below.
  2. Identify every affected consumer, runtime, persisted format, and public export. This step is complete only when each risk has an owner and required validation.

Risk Classification

Risk Examples Planning consequence
Local implementation Private helper or component behavior in one package Preserve observable behavior; validate the owning package
Module contract Exported API/type or documented module invariant Inspect consumers; update contract tests and owning docs
Cross-workspace contract Shared UI/runtime/package shape consumed by multiple workspaces Trace every actual consumer and runtime; validate across workspaces
Persisted or external behavior Stored settings/data, routes, IDs, files, CLI output Define compatibility, round-trip, failure, and conversion behavior for existing consumers
Platform/runtime behavior Electron, VS Code, mobile, relay, native or packaged behavior Run the relevant runtime/build/integration validation

Apply every matching category. Do not escalate local work into workspace-wide ritual, and do not treat a type-only export as local merely because it emits no JavaScript.

Structural Discipline

  • Preserve behavior established by callers and tests unless the request replaces it. Keep the diff scoped to the complete requested behavior.
  • Make the normal use-case path read top to bottom in domain terms. Keep orchestration entrypoints thin and move mechanics or domain logic behind focused, intention-revealing boundaries.
  • Pull complexity downward only when a boundary hides meaningful mechanics, owns an invariant, isolates a proven integration, or captures stable repetition. Do not spread obvious code across pass-through layers.
  • Prefer explicit dependencies and dependency injection over hidden module coupling.
  • Follow local TypeScript types; avoid any, blind casts, and guessed payload shapes.
  • Reject invalid inputs and broken preconditions early so the valid path stays flat. Do not force a numeric happy-path/error-path ratio when correctness requires substantial failure handling.
  • Require evidence before adding retries, caches, compatibility paths, lifecycle machinery, or generalized race handling. Security, data-loss, destructive-operation, and concurrency invariants still require proactive design when the risk is inherent to the operation.

Review Prompts

Before broadening a change, ask:

  • Is the new abstraction reused or merely possible to reuse?
  • What concrete complexity, invariant, stable repetition, or boundary does each new helper, interface, layer, and file pay for?
  • Is the code in the package that owns the behavior?
  • Does the change alter shared UI contracts across web, desktop, VS Code, or mobile?
  • Does it change persisted data, IDs, routes, exports, generated files, or package entrypoints?
  • Can failure leave optimistic state, caches, files, or remote state stranded?

For partial or destructive flows, answer explicitly:

  • What remains valid after the first failure?
  • What is rolled back or cleaned up?
  • What can be retried or resumed safely?
  • What does the user observe?

For persisted data, require a migration only when existing stored data needs conversion. Test downgrade compatibility only when older application versions are a concrete supported consumer. "Rollback" means preserving/restoring valid state after a failed write or migration unless a broader contract explicitly says otherwise.

Do not hide a required architectural migration behind a local heuristic. Do not turn a local fix into a speculative rewrite.

Answering Review Findings

When a reviewer (a subagent, a review session, a bot) reports on your change, you own the change and the reviewer advises. Review loops grow a change one cheap-looking fix at a time; hold it at the size its goal needs.

  • Weigh every finding yourself before acting. A problem the change neither causes nor set out to fix (another path, a rare case, a small cost that was there before) is a nit, whatever label it came with. A regression this change introduces is never a nit, however rare its case.
  • Fix what is wrong in the case the change is for, with the smallest fix. A fix that deletes or narrows code beats a new guard, helper, option, or test the goal does not need.
  • A finding you think is wrong stays unfixed, with evidence: file and line, a test, command output. Decline nits and out-of-scope items in one line each; a real problem outside the change goes to the report as a follow-up.
  • Never agree with a finding just to end the review.
  • A finding still disputed after you and the reviewer have each answered twice goes to the maintainer, with both positions in two or three lines each. Do not argue a third round.
  • After the fixes, compare the diff size with the one before review. If review grew it, cut first.

Validation Matrix

Change Minimum validation
Executable source Proof of the changed behavior (Proof, below); type-check and lint come from the pre-commit gate. TypeScript and lint do not cover server JS, CLI JS, Electron helpers, or native code: run node --check, focused tests, or the build for those
Cross-workspace/shared contract Workspace-wide type-check and lint plus affected builds/tests
Added/deleted/renamed source file, export/type/entrypoint/import shape Relevant checks; dead code comes from the pre-commit gate
Persisted or external contract Compatibility and round-trip tests plus the persisted-state cases in sync-state-invariants, Persisted Snapshot Ordering, and failed-write rollback
Dependency or lockfile Workspace-wide checks and affected builds
Added, renamed, or removed packages/* workspace Mirror it in the Dockerfile deps stage, which copies those manifests by name, then run docker build .: a COPY of a missing workspace fails the build, and a workspace another one depends on fails the frozen install when absent. CI does not build the image.
Generated asset Regeneration check plus consumer build/test
Docs-only or isolated config Narrow syntax/schema/link validation; do not run unrelated full suites
UI or server behavior a user sees Run it and look before calling it done, where the change lives (Where to run it, below)
Platform/runtime behavior Relevant runtime build or manual/integration check; static checks are insufficient
Desktop update or quit/install sequence A real update run; read references/updater-testing.md first, because a run done the obvious way completes the update and reports success while testing nothing

bun run check:changed is the pre-commit gate: run it once, right before a commit, on the finished diff. While iterating, run only the focused tests for the behavior you just changed; an edit to docs, comments, or strings needs no check at all.

When several agents edit one checkout in parallel, they edit and run single test files only. The coordinator runs type-check, lint, builds and full suites once, serially, on the combined diff: each type-check holds over a gigabyte, parallel copies have frozen the machine, and a check run mid-edit reports the other agents' half-finished work.

Use a sufficiently long timeout for broad checks.

For type-only shared contracts, validate compile-time consumers. Add runtime serialization tests when the contract crosses a process, persistence, network, or untyped JavaScript boundary.

Proof

A test is proof when it is deterministic and fails without the change: a pure function, a page script, a reducer. Behavior that lives in a runtime is proven by running that runtime and watching the scenario; a test there that only mirrors the implementation through mocks or races real timers adds upkeep and flakes, and the run already shows more.

Pick the scenarios before counting them. First run the plain path a user takes, end to end in the running app; then break it the ordinary ways it breaks: a credential the server stops accepting, a server that is down, a sign-in the user cancels or that fails, an empty or slow answer. Look at what the user sees each time. These ordinary breaks are where shipped bugs sit, so they come before rare races and exotic inputs, which earn coverage only with a concrete reason. Tests then pin what the runs found.

Where to run it

Run the scenario in the runtime that executes the changed code. Every route below starts its own instance on free ports, beside the user's own app and dev servers.

Change lives in Run it with
Shared UI or server (also what desktop and VS Code render) OPENCHAMBER_HMR_UI_PORT=<port> OPENCHAMBER_HMR_API_PORT=<port> bun run dev, then the browser panel at http://localhost:<ui-port>
Mobile web The same server at /mobile.html, the panel at the mobile viewport
Electron main, preload, native windows electron:dev with a debugging port, driven over CDP (desktop-shell, Validation)
The in-app browser panel and its agent actions electron:dev, then the actions through that instance's control route (packages/web/server/lib/browser-control/DOCUMENTATION.md)
VS Code extension host or webview vscode:dev with a debugging port, driven over CDP (packages/vscode/README.md)
Behavior only the packaged app has: client auth headers, the updater The installed app over CDP (desktop-shell, Validation)
Capacitor shell The iOS Simulator (serve-sim); timing, motion and keyboard latency on a device (performance-engineering, references/ios-webkit.md)
Pure logic A deterministic test that fails without the change

Use localhost, never 127.0.0.1, for the web server: the desktop app lifts Chromium's connection cap for 127.0.0.1, and the panel then overruns Vite and resets connections. Build the desktop app only for a change that lives in its shell. Stop each instance by its own process id or process group, never by a name pattern that would stop someone else's.

The panel's browser actions run in the app the agent itself works from, so they cannot reach a change to the panel's own code until that app is rebuilt; the electron:dev route above covers it before.

Test Design

  • Prefer observable contracts, state transitions, failure handling, rollback, and operation counts.
  • Test private helpers through public/module behavior when that captures the risk clearly.
  • Assert internal map shape, helper calls, or call order only when that structure/order is itself a contract.
  • Keep refactor tests resilient to equivalent internal implementations.
  • For behavior-preserving refactors, establish the current behavior before changing structure.

Module Documentation

A module's DOCUMENTATION.md lives in its folder and holds what the code cannot show the next agent: what the module owns, what must stay true, and why it is built this way. A module gets its own document when it owns a contract other code relies on, an invariant, or a non-obvious design choice; a folder without any of these is covered by its parent's document.

The document has three parts:

  • Ownership. What the module owns and where its boundary is: what belongs here and which neighbouring module owns the rest.
  • Invariants. What must stay true, each stated so a change can be checked against it.
  • Decisions. One ### Why X and not Y entry per non-obvious choice: the chosen approach, the alternative it was weighed against or replaced, and the reason in one or two sentences. A choice is non-obvious when a later reader could reasonably "fix" it back: a simpler design that was rejected, a deliberate workaround, a measured trade-off.

The document describes the module as it is now. When a decision changes, rewrite its entry around the new choice and keep the old approach as the rejected alternative, so the file stays current and carries no history to unwind. Spend its lines on reasons and contracts; file listings and function-by-function walkthroughs restate the code and go stale first.

Completion Standard

  • Implement the behavior end to end, including rollback and cleanup.
  • Prove the changed behavior (Proof): the reproduction passes, and the report says what the proof did not cover.
  • Preserve unrelated changes encountered in shared files.
  • The owning DOCUMENTATION.md is true of the new code and has a decision entry for every non-obvious choice the change made; a new module that meets the bar in Module Documentation has its own document.
  • Perform a final simplification pass over your own diff, hardest after a rework or a removal: every branch, condition, prop, parameter, export, key, and helper the change made unreachable, always-true, or single-valued is gone, along with speculative branches, shallow wrappers, stale compatibility, and names that do not clarify intent.

版本历史

  • 6cd8058 当前 2026-11-03 06:04

    新增基于场景的测试指导:优先运行普通用户路径和常见失败用例(如凭证过期),再编写测试;将iOS WebKit规则移至性能工程技能并增加设备测量。

  • bf977d2 2026-10-19 13:04

    更新完成标准:要求每个非显而易见的设计选择必须有决策记录;优化检查流程,将 check:changed 改为预提交钩子,迭代时仅运行聚焦测试。

  • 336e192 2026-09-22 17:58

    将更新器测试流程合并至本技能,并整合两次真实运行经验,补充了Linux和Windows平台的具体测试机制、竞态窗口测量及环境隔离限制。

  • 2db90f7 2026-08-20 04:55

    细化编辑前检查步骤,移除对文档读取的强制要求,新增关于抽象复用和意图揭示的结构纪律,优化风险规划后果描述。

  • 74b1bd8 2026-07-25 10:36

同 Skill 集合

.agents/skills/changelog-authoring/SKILL.md
.agents/skills/clack-cli-patterns/SKILL.md
.agents/skills/communication-style/SKILL.md
.agents/skills/desktop-shell/SKILL.md
.agents/skills/drag-to-reorder/SKILL.md
.agents/skills/enterprise-boundary/SKILL.md
.agents/skills/isolated-space-boundary/SKILL.md
.agents/skills/locale-ui-patterns/SKILL.md
.agents/skills/opencode-v2/SKILL.md
.agents/skills/pr-review/SKILL.md
.agents/skills/relay-transport/SKILL.md
.agents/skills/rtl-layout/SKILL.md
.agents/skills/serve-sim/SKILL.md
.agents/skills/settings-ui-patterns/SKILL.md
.agents/skills/sync-state-invariants/SKILL.md
.agents/skills/theme-system/SKILL.md
.agents/skills/triage-issues/SKILL.md
.agents/skills/triage-prs/SKILL.md
.agents/skills/ui-api-decoupling/SKILL.md
.agents/skills/update-changelog/SKILL.md
.agents/skills/writing-for-agents/SKILL.md
.agents/skills/performance-engineering/SKILL.md

元信息

文件数
0
版本
6cd8058
Hash
55ba1dc7
收录时间
2026-07-25 10:36

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-06 02:07
浙ICP备14020137号-1