Agent Skills › AIEraDev/Clypra › architecture-design-review

architecture-design-review

GitHub

指导 Clypra 多子系统架构决策与审查,涵盖模块边界变更、接口调整及重大重构。确保尊重现有架构不变量,明确数据所有权,评估跨子系统交互的风险与权衡,防止状态损坏或性能瓶颈。

.agents/skills/architecture-design-review/SKILL.md AIEraDev/Clypra

Trigger Scenarios

改变模块边界或公共接口 引入新子系统或重大依赖 修改项目序列化或播放协调逻辑 涉及多个子系统的跨层交互 提出重大重构方案

Install

npx skills add AIEraDev/Clypra --skill architecture-design-review -g -y
More Options

Non-standard path

npx skills add https://github.com/AIEraDev/Clypra/tree/master/.agents/skills/architecture-design-review -g -y

Use without installing

npx skills use AIEraDev/Clypra@architecture-design-review

指定 Agent (Claude Code)

npx skills add AIEraDev/Clypra --skill architecture-design-review -a claude-code -g -y

安装 repo 全部 skill

npx skills add AIEraDev/Clypra --all -g -y

预览 repo 内 skill

npx skills add AIEraDev/Clypra --list

SKILL.md

Frontmatter
{
    "name": "architecture-design-review",
    "description": "Guides architectural decisions, cross-subsystem boundaries, and structural changes in Clypra. Activate when changing module boundaries, public interfaces, store ownership, asynchronous coordination, project persistence schemas, or proposing significant refactorings."
}

Architecture Design and Review Workflow

Mission & Scope

Clypra is a multi-tier native desktop application spanning a React 19 UI (Tier 1), Web Worker algorithmic compute (Tier 2), and a native Rust/wgpu/CPAL engine (Tier 3). Architectural decisions carry significant risks: introducing playhead jitter, state corruption, IPC bottlenecks, resource exhaustion, or breaking synchronization between interactive preview and background export.

This skill guides coding agents through disciplined, evidence-based architectural design and review. It ensures that changes respect existing architectural invariants, establish clear ownership, and evaluate trade-offs before implementation.


When to Activate This Skill

Activate this skill whenever a task:

  • Changes module boundaries, public interfaces, or dependency relationships.
  • Introduces a new subsystem, major dependency, or architectural abstraction.
  • Modifies project serialization, media management, playback coordination, rendering, or asynchronous execution.
  • Crosses multiple major subsystems (e.g., Zustand store $\leftrightarrow$ Web Worker $\leftrightarrow$ Tauri IPC $\leftrightarrow$ Rust engine).
  • Creates significant compatibility, migration, performance, or operational risks.
  • Proposes a substantial refactor or a replacement for an existing implementation.

When NOT to Activate This Skill

  • Localized UI component styling, layout tweaks, or copy changes.
  • Isolated bug fixes that conform to established subsystem invariants (use bugfix-regression).
  • Routine test additions or fixture updates (use clypra-media-regression-testing).

The Required 6-Step Workflow

Step 1 — Understand the Existing Architecture

  1. Inspect Actual Code & Data Flows: Inspect the relevant implementations, callers, dependencies, state ownership, data flows, and existing architectural decisions.
  2. Identify Ownership:
    • Which module owns the data? (e.g., timelineStore owns tracks/clips, projectStore owns disk persistence, PlaybackClock owns playback time).
    • Which module coordinates operations? (e.g., historyStore coordinates undoable commands, ProjectSession manages worker lifecycles).
  3. Verify the Real Dependency Graph: Never propose an architecture based solely on folder names or aspirational documentation. Verify the actual dependency graph, execution paths, and compute tier boundaries.

Step 2 — Define the Engineering Problem

Clearly distinguish and document:

  • Observed Problem: The concrete symptom or limitation in current behavior.
  • Root Cause: The verified upstream flaw causing the problem, if established.
  • Functional Requirements: Exactly what the system must accomplish.
  • Non-Functional Requirements: Latency budgets (e.g. $<2\text{ms}$ on main thread, $<12\text{ms}$ for scopes), memory bounds, zero-copy preservation.
  • Existing Constraints: Invariants that must be preserved (e.g., EvaluatedScene as canonical rendering currency).
  • Assumptions vs Facts: Explicitly mark unverified assumptions.
  • Explicitly Out-of-Scope: What is intentionally NOT being changed.

Step 3 — Evaluate Alternatives

For significant decisions, compare reasonable options against relevant criteria:

  • Correctness & Behavioral Compatibility: Does it preserve existing user workflows and project integrity?
  • Complexity & Long-Term Maintenance: Does the abstraction justify its maintenance surface?
  • Performance & Resource Utilization: Does it avoid blocking the main thread or causing excessive allocations?
  • Testability & Observability: Can the subsystem be tested with pure, deterministic inputs without mocking the entire app?
  • Concurrency & Lifecycle Management: Does it handle cancellation, stale results, and resource release cleanly?
  • Failure Recovery: How does the system recover from unexpected faults or timeouts?
  • Migration Cost: Can existing projects open cleanly? Can the change be safely rolled back?
  • Dependency & Operational Cost: What are the runtime, build, and maintenance costs of new dependencies?
  • Cross-Platform Feasibility: Does it maintain consistent semantics across macOS, Windows, and Linux? (Consult docs/engineering/platform-compatibility.md).

Rules:

  • Do not manufacture artificial alternatives for trivial changes.
  • Do not automatically choose a more sophisticated architecture simply because it appears more scalable.

Step 4 — Define Responsibility and Ownership

For proposed subsystems, explicitly specify:

  • Single Primary Responsibility: What is its one job?
  • Inputs and Outputs: Strongly typed interfaces in src/types/.
  • State Ownership: Where does its state live? (Persisted in project vs ephemeral in session).
  • Public Interfaces: Minimal, cohesive method signatures.
  • Dependencies & Prohibited Dependencies: e.g., Web Workers must never import React or invoke Tauri IPC; render loops must never read timelineStore directly.
  • Error Propagation: How errors are caught, transformed, and reported to the user.
  • Cancellation Semantics: How in-flight tasks are aborted.
  • Resource Ownership & Cleanup: How buffers, textures, worker processes, and file handles are disposed.
  • Testing Boundaries: How the subsystem is verified in isolation.

Avoid: Circular dependencies, duplicated business logic, unbounded orchestration layers, global mutable state, and speculative abstractions with no demonstrated benefit.

Step 5 — Establish Invariants and Failure Behavior

Identify the conditions that must remain true during normal operation, concurrency, cancellation, and failure:

  • Unavailable Dependencies: What happens when native audio, hardware video decode, or an external tool is missing or fails?
  • Invalid Inputs: How are corrupt project files, zero-duration clips, or malformed timecodes handled?
  • Timeouts & Deadlocks: How are hanging background processes or IPC calls bounded?
  • Stale Asynchronous Results: How does the system reject out-of-order responses when the user rapidly scrubs while a frame is decoding?

Step 6 — Plan Migration and Verification

  1. Affected Consumers: Identify all components reading or writing the affected interfaces.
  2. Schema & Compatibility: If project serialization changes, provide explicit migration functions with backwards-compatibility tests.
  3. Architecture Decision Record (ADR): For consequential or difficult-to-reverse decisions, create an ADR in docs/architecture/adr/ documenting:
    • Status (Proposed, Accepted, Superseded)
    • Context & Problem Statement
    • Decision & Alternatives Considered
    • Consequences & Trade-offs
    • Verification Strategy & Rollback Considerations
  4. Smallest Coherent Implementation: Keep the initial implementation as small as possible while satisfying the verified requirements.

Architectural Enforcement in Clypra

  • Documentation for Intent: Use docs/engineering/architecture-overview.md, docs/engineering/nle-architecture-and-semantics.md, and ADRs to capture intended designs.
  • Code Boundaries for Constraints: Enforce isolation via TypeScript compiler contracts, separate worker scripts, and Rust crate boundaries.
  • Automated Verification: Enforce invariants mechanically through CI tests (tsc --noEmit, Vitest, Cargo).
  • Descriptive Honesty: Never document an aspirational design as if it already exists. Describe the delta between current and target architecture explicitly.
  • No Unwarranted Tooling Overhead: Do not add a repository-wide dependency-rule framework unless the codebase's size and structure justify it.

Version History

  • b371446 Current 2026-10-18 23:25

Same Skill Collection

.agents/skills/behavior-coverage/SKILL.md
.agents/skills/bugfix-regression/SKILL.md
.agents/skills/clypra-codebase-optimization-research/SKILL.md
.agents/skills/clypra-dev/SKILL.md
.agents/skills/clypra-media-regression-testing/SKILL.md
.agents/skills/clypra-performance-log-analysis/SKILL.md
.agents/skills/clypra-preview-performance-engineering/SKILL.md
.agents/skills/clypra-ui-ux-engineering/SKILL.md
.agents/skills/code-review/SKILL.md
.agents/skills/feature-implementation/SKILL.md
.agents/skills/i18n-localization-engineering/SKILL.md
.agents/skills/nle-domain-engineering/SKILL.md
.agents/skills/performance-reliability-engineering/SKILL.md
.agents/skills/release-readiness/SKILL.md
.agents/skills/senior-engineer-decision-making/SKILL.md
.agents/skills/tauri-cross-platform-engineering/SKILL.md
.kiro/skills/architecture-design-review/SKILL.md
.kiro/skills/behavior-coverage/SKILL.md
.kiro/skills/bugfix-regression/SKILL.md
.kiro/skills/clypra-codebase-optimization-research/SKILL.md
.kiro/skills/clypra-dev/SKILL.md
.kiro/skills/clypra-media-regression-testing/SKILL.md
.kiro/skills/clypra-performance-log-analysis/SKILL.md
.kiro/skills/clypra-preview-performance-engineering/SKILL.md
.kiro/skills/clypra-ui-ux-engineering/SKILL.md
.kiro/skills/code-review/SKILL.md
.kiro/skills/feature-implementation/SKILL.md
.kiro/skills/i18n-localization-engineering/SKILL.md
.kiro/skills/nle-domain-engineering/SKILL.md
.kiro/skills/performance-reliability-engineering/SKILL.md
.kiro/skills/release-readiness/SKILL.md
.kiro/skills/senior-engineer-decision-making/SKILL.md
.kiro/skills/tauri-cross-platform-engineering/SKILL.md
.agents/skills/clypra-bug-hunter/SKILL.md
.agents/skills/tauri-native-thread-safety/SKILL.md
.kiro/skills/clypra-bug-hunter/SKILL.md
.kiro/skills/tauri-native-thread-safety/SKILL.md

Metadata

Files
0
Version
b371446
Hash
f956be9a
Indexed
2026-10-18 23:25

ホーム - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-10-19 19:22
浙ICP备14020137号-1