Agent Skills › zai-org/ZCode › architecture-governance

architecture-governance

GitHub

用于在ZCode仓库中检查模块和层级边界,确保代码变更符合架构规范。通过生成有界上下文和分析所有权变更,在编码前明确设计决策,防止架构漂移。

.agents/skills/architecture-governance/SKILL.md zai-org/ZCode

Trigger Scenarios

编辑ZCode仓库代码前 涉及跨模块或所有权变更的代码修改

Install

npx skills add zai-org/ZCode --skill architecture-governance -g -y
More Options

Non-standard path

npx skills add https://github.com/zai-org/ZCode/tree/main/.agents/skills/architecture-governance -g -y

Use without installing

npx skills use zai-org/ZCode@architecture-governance

指定 Agent (Claude Code)

npx skills add zai-org/ZCode --skill architecture-governance -a claude-code -g -y

安装 repo 全部 skill

npx skills add zai-org/ZCode --all -g -y

预览 repo 内 skill

npx skills add zai-org/ZCode --list

SKILL.md

Frontmatter
{
    "name": "architecture-governance",
    "description": "Check ZCode module and layer boundaries for code changes. Generate bounded context for cross-module or ownership changes; skip documentation-only work."
}

Architecture governance

Use this skill before editing code in the ZCode repository. It is a design guide as well as a gate: the goal is to make the intended architecture obvious before code is generated, so the checker confirms a decision instead of discovering it for the first time.

Before writing code

  1. Identify intended files and modules from the task, contracts, and existing tests. Run pnpm architecture:check --changed for the current baseline; a clean diff does not identify files you have not edited yet.
  2. For cross-module changes, state ownership changes, or an unclear contract, run pnpm architecture:context <module-id> (or node .agents/skills/architecture-governance/scripts/context-package.mjs <module-id>). For a local change with a known contract, read only the relevant contract, spec, and affected tests; expand when a concrete dependency or evidence gap requires it.
  3. Apply the spec and regression-evidence rules in AGENTS.md. New behavior needs a spec before implementation; restoring already specified behavior needs regression evidence, not a duplicate feature document. Pure refactors update docs only when contracts change.
  4. For changes to mutable state, asynchronous behavior, or module boundaries, make the relevant design decisions before coding:
    • One owner: name the single component that owns each piece of mutable state. Other layers read through its contract and send commands; they do not keep a second accepted queue, cache, or derived truth.
    • One path: reuse an existing command, service, hook, adapter, or contract when it already expresses the behavior. Do not create a parallel helper for the same responsibility.
    • Explicit boundaries: choose the layer for every new file and the public contract for every cross-module edge. Keep ui → hooks/services → app → domain → adapters and keep IO out of domain.
    • Explicit time: for asynchronous or remote behavior, write the event order, owner/lease, idempotency key, stale-result rule, replay/resume boundary, and desktop versus mobile delivery kind before implementation.
    • Bounded context: use the relevant contracts, specs, and tests. A generated reading package helps when dependencies are unclear; do not require a whole-module reading pass for every local edit.
  5. If the change alters a public contract, ownership, or allowed dependency, record that decision in the relevant spec/contract before implementation. Editing files in two modules alone does not require a new document. Use the root task boundary for when to consult the user; ordinary authorized implementation choices proceed autonomously.

Use this compact design sketch while planning stateful changes:

input → single owner → command admission → state transition → contract/event
                  └── persistence / replay / projection are derived from the owner

For remote or streaming changes, make the delivery boundary explicit:

desktop: continuous ── direct live stream ──┐
                                           ├─ same owner and sequence
mobile: replayable ─ snapshot + gap repair ┘

During and after editing

  1. Keep changes inside the declared module and its allowed layer direction. Add a module dependency or public contract before introducing a cross-module edge.
  2. Run pnpm architecture:check --changed after editing. Report new violations separately from baseline violations; include owners and event-order assumptions when affected. Follow the root validation matrix, finish after required checks pass, and expand checks only for new edits, failures, or unresolved risks.

The executable policy is architecture-policy.yaml; keep its detailed rule definitions there. Check the actual managed-module coverage before claiming the gate verifies a boundary: a passing result does not prove unconfigured modules or runtime semantics are correct. Use pnpm architecture:baseline:update only when a reviewed change intentionally changes the accepted legacy baseline. CI never refreshes baseline automatically.

For a new managed module, provide module.ts, contract.ts, contract.example.ts, contract.test.ts, and a short CONTRACT.md. Keep runtime and persistence details behind the contract. Prefer typed service calls for one-to-one interactions, commands for state changes, and typed events for broadcast facts.

See policy-schema.md, module-contract.md, and rule-catalog.md when the change needs their detailed guidance. The golden-module fixture is the smallest compliant example. See ai-guidance.md for the anti-patterns this workflow is designed to prevent and the questions an agent must answer before proposing code.

Version History

  • aac4755 Current 2026-10-18 16:06

    更新到v3.15.1,添加UI插件和内联Gen UI体验,更新桌面、远程工作区和智能体能力,扩展内置插件和回归覆盖。

  • 872ad96 2026-09-21 23:46

Same Skill Collection

.agents/skills/agent-browser/SKILL.md
.agents/skills/ai-elements/SKILL.md
.agents/skills/dep-refs/SKILL.md
.agents/skills/dogfood/SKILL.md
.agents/skills/e2e-case-lifecycle/SKILL.md
.agents/skills/feature-boundary-planner/SKILL.md
.agents/skills/react-best-practices/SKILL.md
.agents/skills/zcode-large-task-fixture/SKILL.md
apps/zcode-cli/.agents/skills/opentui/SKILL.md
apps/zcode-cli/.agents/skills/vercel-react-best-practices/SKILL.md
.agents/skills/electron/SKILL.md
apps/zcode-cli/.agents/skills/vercel-react-view-transitions/SKILL.md

Metadata

Files
0
Version
aac4755
Hash
1f039ca5
Indexed
2026-09-21 23:46

홈 - 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-20 04:39
浙ICP备14020137号-1