Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

architecture-design建筑设计

Agent Skill

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

总安装

1,551

周安装

64

GitHub Stars

1

下载量

507
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:architecture-design(建筑设计)
来源仓库:https://github.com/swiftyjourney/architecture-design-skill
仓库路径:skills/architecture-design
安装命令:
npx skills add https://github.com/swiftyjourney/architecture-design-skill --skill architecture-design
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/swiftyjourney/architecture-design-skill --skill architecture-design

简介

建筑设计技能用于辅助界面设计、视觉规范和交互体验优化,适合页面结构整理。

  • 它能生成 UI 方案、检查视觉一致性并改进组件层级,需要结合品牌和设计系统使用。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 了解具体用法。
  • 涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出和对齐表现。
  • architecture-design 属于前端设计类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Architecture & Design Principles Skill

Transform codebases into maintainable, testable, and scalable architectures using Clean Architecture principles, SOLID design patterns, and industry best practices from the Essential Developer methodology.

Overview

This skill guides you through a structured 5-step process to:

  1. Analyze Requirements → Identify components, responsibilities, and boundaries
  2. Apply SOLID Principles → Design with SRP, OCP, LSP, ISP, DIP
  3. Define Clean Architecture → Establish layers, boundaries, and dependency rules
  4. Design Testing Strategy → Plan unit tests, integration tests, and test boundaries
  5. Document Decisions → Create Architecture Decision Records (ADRs)

Core Philosophy

"Good architecture is a byproduct of good team processes and communication"

This skill follows these principles:

  • Framework Independence - Business logic doesn't depend on frameworks
  • Testability - Architecture enables easy testing
  • UI Independence - UI can change without affecting business rules
  • Database Independence - Business rules don't know about the database
  • External Agency Independence - Business rules don't depend on external services

The 5-Step Process

Step 1: Analyze Requirements

Objective: Identify components, responsibilities, and architectural boundaries

Actions:

  1. Break down feature into distinct responsibilities
  2. Identify core business logic vs infrastructure concerns
  3. Recognize cross-cutting concerns (logging, analytics, caching)
  4. Map data flow through the system
  5. Identify potential architectural boundaries

Key Questions to Ask:

  • What is the core business logic?
  • What are the external dependencies (network, database, UI)?
  • What needs to be testable in isolation?
  • What components might change independently?
  • What are the inputs and outputs of each component?

Output: Component diagram with clear responsibilities

Reference: See references/modular_design.md for component identification patterns


Step 2: Apply SOLID Principles

Objective: Design components following SOLID principles

S - Single Responsibility Principle (SRP)

Each class/module has one reason to change. Separate business logic from infrastructure.

  • ❌ A class that loads data AND presents it
  • ✅ Separate UseCase for business logic; separate Presenter for view logic

O - Open/Closed Principle (OCP)

Open for extension via protocols/interfaces, closed for modification:

// Open for extension via protocol (Swift example — same idea in any language)
protocol ItemLoader {
    func load() async throws -> [Item]
}

// Closed for modification — implementations extend behavior
final class RemoteItemLoader: ItemLoader { ... }
final class CachedItemLoader: ItemLoader { ... }
final class FallbackItemLoader: ItemLoader { ... }

L - Liskov Substitution Principle (LSP)

Subtypes must be substitutable for base types. Contracts must be honored by all implementations.

I - Interface Segregation Principle (ISP)

Clients shouldn't depend on interfaces they don't use. Create focused, specific protocols.

  • protocol DataStore {func save(_:); func load(); func delete(); func migrate(); func backup()}
  • protocol ItemReader {func retrieve() throws -> [Item]?} + separate ItemCache

D - Dependency Inversion Principle (DIP)

High-level modules depend on abstractions, not concretions.

class ItemListViewController {
    private let loader: ItemLoader  // depends on abstraction, not concrete type
    init(loader: ItemLoader) { self.loader = loader }
}

Output: SOLID-compliant component design

Reference: See references/solid_principles.md for detailed patterns and anti-patterns


Step 3: Define Clean Architecture

Objective: Establish clear architectural layers with proper dependency flow

The Clean Architecture Layers:

┌─────────────────────────────────────────┐
│          Presentation Layer             │
│    (UI, ViewModels, Presenters)        │
└─────────────────┬───────────────────────┘
                  │ depends on
┌─────────────────▼───────────────────────┐
│         Domain/Business Layer           │
│      (Use Cases, Entities, Rules)      │
└─────────────────┬───────────────────────┘
                  │ depends on
┌─────────────────▼───────────────────────┐
│         Infrastructure Layer            │
│   (Network, Database, Framework Code)  │
└─────────────────────────────────────────┘

Dependency Rule: Source code dependencies point inward only

Key Patterns:

  1. Use Cases — contain business rules, orchestrate data flow, independent of UI and frameworks
  2. Boundaries (Protocols) — define contracts between layers, enable testability
  3. Adapters — convert data between layers, implement boundary protocols
  4. Composition Root — wire dependencies together, configure the object graph

Output: Layered architecture with clear boundaries

Reference: See references/clean_architecture.md for detailed layer definitions; examples/generic/layered_architecture.md for a language-agnostic example; examples/swift/ for Swift/iOS real implementations


Step 4: Design Testing Strategy

Objective: Plan comprehensive testing at all architectural layers

Testing Pyramid:

        ┌──────────┐
        │    UI    │ Few - End to End
        ├──────────┤
        │Integration│ Some - Integration
        ├──────────┤
        │   Unit   │ Many - Fast & Isolated
        └──────────┘

Testing Boundaries:

  1. Domain Layer (Unit Tests) — test use cases in isolation, mock all dependencies
  2. Infrastructure Layer (Integration Tests) — test adapters with real dependencies
  3. Presentation Layer (Unit Tests) — test presenters/view models, mock use cases

Test Double Vocabulary:

  • Stubs: Provide canned answers
  • Spies: Record calls for verification
  • Mocks: Verify behavior expectations
  • Fakes: Working implementations for testing

Testing Strategies:

  • Test behavior, not implementation details
  • Use native async test primitives; avoid manual callback synchronization when the language supports await
  • Factory helper pattern: create the system under test (SUT) and its dependencies together in a makeSUT() helper to keep individual test methods clean
  • Arrange, Act, Assert structure; extract helpers for clarity

Output: Comprehensive testing strategy document

Reference: See references/testing_strategies.md for patterns and best practices


Step 5: Document Decisions

Objective: Create clear architectural documentation and decision records

ADR Format:

# ADR-NNN: <Decision Title>
## Status: Accepted | Superseded | Deprecated
## Context: Why this decision was needed
## Decision: What was decided
## Consequences: Positive and negative outcomes
## Alternatives Considered: What was rejected and why

See examples/generic/ for a complete ADR example.

Documentation Requirements:

  1. Architecture Overview — system context diagram, component diagram, layer relationships
  2. Component Documentation — purpose, dependencies, usage examples
  3. Design Patterns Used — which patterns and why, trade-offs
  4. Testing Strategy — what gets tested and how

Output: Complete architectural documentation

Reference: See references/ for detailed documentation patterns


Best Practices

DO ✅

  • Separate business logic from infrastructure
  • Depend on abstractions, not concretions
  • Make dependencies explicit through initializer injection
  • Write tests for all business logic
  • Use async IO protocols at network/network boundaries; synchronous protocols for in-process storage
  • Isolate presentation types to the main/UI thread using the language's concurrency primitives
  • Design for testability from the start

DON'T ❌

  • Let business logic depend on frameworks
  • Use singletons for dependency management
  • Mix presentation and business logic
  • Create god classes with multiple responsibilities
  • Use manual callback/completion-handler patterns where the language's native async/await is available
  • Dispatch to the UI thread manually — use structured concurrency instead
Swift/iOS: Use async throws at network boundaries, sync throws at cache boundaries, @MainActor for presentation types, and Sendable for value types crossing actor boundaries. See the Swift Concurrency section below.

Common Architectural Patterns

  1. Clean Architecture (Recommended) — clear separation of concerns, dependency rule: inward only
  2. Hexagonal Architecture (Ports & Adapters) — business logic at the center, ports define boundaries
  3. MVVM — separation of UI and logic, testable view models
  4. MVC — traditional separation, controller as composition root

Reference: See examples/generic/layered_architecture.md for a language-agnostic layered example; examples/swift/ for MVVM+Coordinator, Composition Root, and Two-Layer View in Swift/iOS


Language-Specific Guidance

Swift/iOS

  • Use async throws protocols for network boundaries
  • Use sync throws for cache/store boundaries; bridge to async via Scheduler protocol
  • Apply @MainActor to presentation types (ResourceView, LoadResourcePresenter)
  • Mark domain value types Sendable (e.g. FeedImage: Hashable, Sendable)
  • Use LoadResourcePresenter<Resource, View> generic presenter — one type for all features
  • Use WeakRefVirtualProxy<T> to break retain cycles without per-type boilerplate
  • Apply Composition Root pattern in SceneDelegate; extract infrastructure into @MainActor service objects (see examples/swift/composition_root.md)

Reference: See examples/swift/ for Swift-specific patterns

Generic/Agnostic

  • Apply SOLID principles universally
  • Use interfaces/traits/protocols depending on language
  • Adapt patterns to language features
  • Maintain Clean Architecture layers

Reference: See examples/generic/ for language-agnostic examples


Swift Concurrency *(Swift/iOS only)*

The concepts in this section — async IO boundaries, main-thread isolation, value-type thread safety, generic presenter, memory-safe proxies — apply universally. The syntax and APIs below are Swift-specific. For the detailed implementations, see references/concurrency_patterns.md.

Async Protocol Boundaries

Network protocols use async throws; store protocols use sync throws:

// Network boundary — async because IO is inherently async
public protocol HTTPClient {
    func get(from url: URL) async throws -> (Data, HTTPURLResponse)
}

// Cache/store boundary — sync because the store runs on its own queue (bridged via Scheduler)
// Apply this pattern to any persistent store: CoreData, SQLite, in-memory, Realm, etc.
public protocol ItemStore {
    func delete() throws
    func insert(_ items: [LocalItem], timestamp: Date) throws
    func retrieve() throws -> CachedItems?
}
// Essential Feed uses FeedStore with identical structure for FeedImage caching

@MainActor Isolation

Presentation layer types are @MainActor — no manual thread dispatching:

@MainActor public protocol ResourceView {
    associatedtype ResourceViewModel
    func display(_ viewModel: ResourceViewModel)
}

@MainActor public final class LoadResourcePresenter<Resource, View: ResourceView> {
    public typealias Mapper = (Resource) throws -> View.ResourceViewModel
    public init(resourceView: View, loadingView: ResourceLoadingView,
                errorView: ResourceErrorView, mapper: @escaping Mapper)
    public init(resourceView: View, loadingView: ResourceLoadingView,
                errorView: ResourceErrorView) where Resource == View.ResourceViewModel
    public func didStartLoading()
    public func didFinishLoading(with resource: Resource)
    public func didFinishLoading(with error: Error)
}

Sendable Value Types

Domain entities crossing actor boundaries must be Sendable. All stored properties must themselves be Sendable; the compiler verifies this:

// Generic pattern — apply to any domain entity
public struct Item: Hashable, Sendable {
    public let id: UUID
    public let title: String
    // String, UUID, URL are all Sendable — compiler is satisfied
}

// Concrete example from Essential Feed:
// public struct FeedImage: Hashable, Sendable { ... }

WeakRefVirtualProxy

Prevents retain cycles via a single generic type with conditional conformances:

final class WeakRefVirtualProxy<T: AnyObject> {
    private weak var object: T?
    init(_ object: T) { self.object = object }
}

extension WeakRefVirtualProxy: ResourceErrorView where T: ResourceErrorView {
    func display(_ viewModel: ResourceErrorViewModel) { object?.display(viewModel) }
}

extension WeakRefVirtualProxy: ResourceLoadingView where T: ResourceLoadingView {
    func display(_ viewModel: ResourceLoadingViewModel) { object?.display(viewModel) }
}

Scheduler Protocol

Bridges sync FeedStore into async contexts without making the store async:

protocol Scheduler {
    @MainActor
    func schedule<T>(_ action: @escaping @Sendable () throws -> T) async rethrows -> T
}

Reference: See references/concurrency_patterns.md for full implementations and migration guide


Integration with Requirements Engineering

  1. Start with requirements → Use Cases → BDD scenarios
  2. Apply this skill → Architecture → Component design
  3. Implement → Following architectural patterns
  4. Test → Using defined testing strategy

References

Inside references/:

  • clean_architecture.md - Clean Architecture layers and rules
  • solid_principles.md - Detailed SOLID explanations with examples
  • design_patterns.md - Common patterns (Adapter, Decorator, Composite, Null Object, etc.)
  • null_object_pattern.md - Null Object Pattern with testing examples
  • command_query_separation.md - CQS principle for cache design
  • dependency_management.md - DI patterns and strategies
  • testing_strategies.md - Testing patterns and best practices
  • modular_design.md - Module organization and boundaries
  • concurrency_patterns.md - Swift Concurrency: async/await, @MainActor, Sendable, Scheduler

Inside examples/:

  • swift/ - Real implementations from Essential Feed (Swift 6)
  • generic/ - Language-agnostic examples

Output Format

When applying this skill, provide:

  1. Component Analysis - Identified components and responsibilities
  2. SOLID Review - Applied principles with rationale
  3. Architecture Diagram - Layers and dependencies (Mermaid)
  4. Testing Strategy - Test structure and coverage plan
  5. ADRs - Key decisions documented
  6. Implementation Guide - Step-by-step refactoring or implementation plan

Credits

Based on the Essential Developer's proven architecture methodology:


Version History

  • 2.1.0 - Generalized for multi-project use: domain-neutral SOLID examples, separated Swift-specific guidance, added scope labels, created generic ADR template and updated generic architecture example
  • 2.0.0 - Swift 6 migration: async/await, @MainActor, Sendable, LoadResourcePresenter, Scheduler, WeakRefVirtualProxy
  • 1.0.0 - Initial release with 5-step process

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

35.75%
按下载量换算181

Claude

27.91%
按下载量换算142

Cursor

17.29%
按下载量换算88

Gemini CLI

9.32%
按下载量换算47

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills