Architecture Guidelines 标志

Architecture Guidelines

组织
l-gevity
architecture-guidelines

关于子系统、服务和抽象设计的第一性原理架构规则,涵盖极简主义、模块化、函数式核心、韧性、层级自足性、集成、命名和并发。当您引入子系统、服务或抽象,跨子系统边界重构,应用 SOLID 原则,判断某个控制是否可以依赖其下层,设计应用或服务之间的集成边,或审查架构属性(纯度、幂等性、命名、快速失败)时,触发此技能。对于现有子系统内的错误修复、内容或文案编辑、仅涉及 CSS 的更改、依赖项升级和简单重命名,请跳过此技能。当设计决策产生可强制执行的依赖约束时,向 `architecture-as-code` 输出 `Enforcement` 交接内容。

Add to TypingMind

概览

发布者l-gevity
代码仓库l-gevity-skills
技能名称architecture-guidelines
星标数
72
复刻数
13
附带文件
仅含指令
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 指令自成一体

    模型所需的一切都包含在指令中,无需同步额外文件。

  • 开源

    由 l-gevity 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Architecture Guidelines AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/l-gevity/l-gevity-skills/tree/main/.agents/skills/architecture-guidelines
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/l-gevity/l-gevity-skills.git /tmp/l-gevity-skills
mkdir -p .claude/skills
cp -r /tmp/l-gevity-skills/.agents/skills/architecture-guidelines .claude/skills/architecture-guidelines
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Architecture Guidelines,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Architecture Guidelines。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Architecture Guidelines 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Architectural Discipline (First Principles)

Core Directives

  • Patternization: A unified, simpler whole beats a fragmented system of locally perfect solutions. Accept local suboptimality for universal patterns.
  • Minimalism: Smallest viable solution. ZERO speculative extensibility.
  • Traceability: Names reflect architectural layer, domain role, and technical purpose.
  • Dependency Discipline: Graphs MUST be directed, acyclic, shallow. Cycles forbidden. Depth is cost.

1. Minimalism & Abstraction

  • YAGNI: No speculative features or extensibility hooks.
  • Rule of 3: Wait for three proven instances before abstracting. Prefer copying < 20 lines over premature abstraction.
  • DRY (knowledge, not shape): A business rule, constant, or schema has exactly one authoritative representation. Code-shape duplication defers to Rule of 3.
  • Frame-check before execute: When an issue, spec, or PRD prescribes implementation steps (a numbered "Implementation Approach" section, a multi-step task list, a build/CI plumbing plan), DO NOT start by executing step 1. First run the necessity gate from functionality-complexity-tradeoff §1 against the framing the steps assume — what problem is this code actually addressing, does that problem still occur in this stack, is it already owned by another layer? Issue authors prescribe solutions; the gate asks whether the prescription matches a problem we have. A prescribed plan exceeding 3 steps or introducing a novel abstraction is the strongest trigger for this check.

2. Consistency & Coupling

  • Eventual Consistency by Default: Strong consistency couples subsystems. Accept idempotency / compensation to preserve modularity.
  • Full Migration: When adopting a new pattern, migrate all sibling subsystems in the same PR — but always ask the user and pick a pattern that fits both new and existing logic.
  • Dependency Inversion: Domain logic depends on abstractions, never concrete implementations.

3. Functional Core

  • Pure Domain Logic, I/O at the Edges: Business logic is pure, side-effect free, environment-agnostic. External systems live at the edges.
  • Testability: A pure core is unit-testable without mocks. If the domain needs mocks, purity has been violated.

4. Modularity

  • SoC: One responsibility per subsystem.
  • Aspects are extracted, not interleaved: an aspect has one obligation — a rule over the subsystems it holds across — and one mechanism — one subsystem that implements it. Extract the mechanism into its own subsystem; never copy it per subsystem, never model the obligation as a subsystem.
  • SRP: One reason to change per subsystem. Two forces of change → split.
  • Capability Boundary = Subsystem Boundary: A capability with its own domain name, lifecycle, dependency surface, test surface, or reason to change gets its own subsystem directory. Do not group multiple atomic capabilities in one parent subsystem unless together they form a higher-level capability with a single public interface and shared change reason.
  • High Cohesion, Loose Coupling: Internals tightly related; external dependencies minimized and abstracted.
  • Interface Discipline:
    • Caller: depend on the contract, never the implementation.
    • Subsystem: internals encapsulated; the interface is the only access point.
    • Designer: expose everything every caller needs and only what every caller needs.

Review check: If a directory contains multiple named capabilities, require one of: a single facade/interface proving they are one higher-level capability, or a split into capability-named subsystem directories. For each aspect the design touches, name its mechanism subsystem and the subsystems it holds across.

5. Resilience

  • Fail Fast: Validate and sanitize inputs at all system or atomicity boundaries.
  • Idempotency: Safe under repeated execution; succeeds when the desired state already holds. Does not suppress errors that prevent reaching it.
  • Statelessness: Prefer stateless services.
  • Failure Classification: Categorize each external call as hard (blocks subsequent steps) or best-effort (logged, no cascade) before implementation.
  • Atomicity: Decide whether partial success is acceptable or rollback is required.
  • State Visibility: Log decision and outcome at each step.

6. Naming & Traceability

  • Domain-Driven Names: Every function, variable, directory reveals architectural layer, domain role, and technical purpose. utils / helpers fail this test.
  • Self-Documenting Structure: Directory and filename alone should reveal architectural boundaries and business rules.

7. Concurrency & Shared Mutable State

Every shared mutable state must declare its concurrency model:

  • Per-instance (multi-tab) → use navigator.locks or BroadcastChannel.
  • Per-tab → fine; document in JSDoc.
  • Global → atomic writes or locks.

Review check: if state is modified after an await, ask: "is this guarded against concurrent mutation?"

8. Layer Self-Sufficiency

  • Controls complete at their own layer: a control a layer owns must hold on that layer alone. One that works only because a lower layer limits who can reach it is inherited, not implemented.
  • Assume the layer below is absent: every authentication and authorization decision must hold with the endpoint publicly reachable. Network isolation, private connectivity, and firewall placement are additional layers, never the control.
  • Ambient guarantees are invisible dependencies: the assumption lives outside the codebase, so the deployment or infrastructure change that invalidates it never appears in a diff, review, or test of the code relying on it.
  • Name the reason for every gap: when a control is weakened, deferred, or dropped, state why. A reason that cites a property of a lower layer or the deployment environment means the control is missing, not satisfied.

Review check: for each control, ask "does this still hold when the layer below it disappears?" A "no" is a defect in the layer under review, never a requirement on the layer below.

9. Integration Discipline

Rules for edges that cross an application boundary: a different deployable, data store, team, or lifecycle.

  • Smart endpoints, dumb pipes: The transport (gateway, proxy, queue, topic, bus) decouples parties in location and time and does nothing else. Business logic, validation, enrichment, transformation, storage, replay, and access decisions live in the endpoints, never in the pipe.
  • Producers are consumer-agnostic; consumers transform: A producer publishes its own domain representation once. Each consumer maps it into its own model. A canonical or unified intermediate model shared across applications couples every party to every change; do not introduce one.
  • No peer internals: An application reaches another only through that application's published contract (API, event, queue, file exchange), never its database, file system, or internal subsystems. Reaching past the contract is the integration form of the interface violation in §4.
  • Untrusted network: Every cross-application edge is designed for the open internet. The receiving endpoint authenticates, authorizes, and validates on its own; §8 governs what the pipe's placement can and cannot satisfy.
  • Asynchronous where the caller can continue: Use a queue or topic when the caller does not need the answer to proceed; reserve synchronous request-response for when it does. Fire-and-forget only where loss is acceptable and stated.
  • Contracts expose domain, not implementation: Payloads carry domain entities, never storage rows, join tables, or internal identifiers. A change to a shared payload shape follows evolutionary-database-design.

Review check: every rule above needs a question, or the check passes while the rule fails. For each cross-application edge, ask all four:

  1. "Which side transforms, and what does the pipe do besides carry?" An answer that names the pipe is a defect in the endpoint.
  2. "Does the receiver authenticate, authorize, and validate on its own, as if the network were public?"
  3. "Does the caller wait for an answer it does not need, and what happens to the message when the pipe fails after the caller's own write?" A synchronous edge that leaves a stored record with no way to complete or retry it is an unrecoverable half-state, not a failed call.
  4. "Does the edge reach past the peer's published contract, and does the payload carry domain entities rather than storage rows or internal identifiers?"

[!IMPORTANT] Complexity Warning: If a solution violates any guideline above, state: "Complexity Warning: introduces [X]. A simpler alternative is [Y]." If the violation is non-trivial, see structural-simplification §8 Decision Protocol for a per-axis comparison before accepting it.

10. Enforcement Handoff

Use architecture-as-code only for constraints that can be enforced as import or dependency rules. Do not duplicate this skill's principles there; hand off the specific rule to encode.

Examples:

Principle:   DI / functional core
Constraint:  domain must not import infrastructure
Enforcement: add architecture rule: forbid <domain-subsystem> -> <infra-subsystem>
Principle:   interface discipline
Constraint:  external callers use the facade only
Enforcement: add architecture rule: forbid * -> <subsystem-internal-*>, except <subsystem-*>
Principle:   integration discipline
Constraint:  no subsystem reaches a peer application's internals
Enforcement: add architecture rule: forbid * -> <peer-storage-client | peer-internal-*>, except <integration-adapter-*>
Principle:   aspect extraction
Constraint:  only <audit-mechanism> reaches the audit internals and SDK
Enforcement: add architecture rule: forbid * -> <audit-internal-*>, except <audit-mechanism>

A principle can also settle as no handoff. Record that outcome rather than omitting it:

Principle:   layer self-sufficiency
Constraint:  the control holds with the layer below absent
Enforcement: none - not an import or dependency edge; verify by exercising the
             subsystem without that layer (`defect-shift-left`)

One aspect yields two handoffs: the mechanism's exclusivity edge above, and a coverage obligation that is not an edge:

Principle:   aspect coverage
Constraint:  every subsystem in <holds across> routes through <audit-mechanism>
Enforcement: none - not an edge; place a coverage check over the subsystem
             registry (`defect-shift-left`)

11. Output Contract

When this skill changes or rejects a design, emit a coder-facing decision record:

Subject:        <subsystem / service / abstraction / PR / code path>
Decision:       Proceed | Simplify | Split | Inline | Reject | Defer
Principle:      <YAGNI | Rule of 3 | DRY | SoC | SRP | capability-boundary | DI | fail-fast | idempotency | atomicity | integration | layer-self-sufficiency | naming | concurrency | aspect>
Evidence:       <callers, imports, tests, runtime invariant, or file paths checked>
Enforcement:    <none | add architecture rule: constraint | update architecture rule: constraint>
Next action:    <edit, delete, extract, add test, add lint rule, or ask user>
Verification:   <command / review check / Not run + reason>

See also

  • functionality-complexity-tradeoff — necessity gate and worth ledger applied to individual decisions.
  • structural-simplification — per-axis complexity comparison (D, K, P, n).
  • morphogenetic-architecture — declared placement, observed coupling fields, and topology evolution.
  • architecture-as-code — consumes explicit Enforcement handoffs and turns enforceable dependency constraints into lint rules.
  • evolutionary-database-design — staged, compatible change to a payload or stored shape shared across an integration edge.

常见问题

Architecture Guidelines AI 技能有什么作用?

关于子系统、服务和抽象设计的第一性原理架构规则,涵盖极简主义、模块化、函数式核心、韧性、层级自足性、集成、命名和并发。当您引入子系统、服务或抽象,跨子系统边界重构,应用 SOLID 原则,判断某个控制是否可以依赖其下层,设计应用或服务之间的集成边,或审查架构属性(纯度、幂等性、命名、快速失败)时,触发此技能。对于现有子系统内的错误修复、内容或文案编辑、仅涉及 CSS 的更改、依赖项升级和简单重命名,请跳过此技能。当设计决策产生可强制执行的依赖约束时,向 `architecture-as-code` 输出 `Enforcement` 交接内容。

为什么在 TypingMind 中使用 Architecture Guidelines?

因为您只需安装一次,就能搭配任何模型使用。Architecture Guidelines 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Architecture Guidelines?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/l-gevity/l-gevity-skills/tree/main/.agents/skills/architecture-guidelines。TypingMind 会读取其中的 SKILL.md,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Architecture Guidelines?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Architecture Guidelines 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Architecture Guidelines 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Architecture Guidelines AI 技能免费吗?

是的。l-gevity 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇