跳到正文
Skillpedia
通用编程48k · #5641

robius-app-architecture

它能做什么

这项技能可以帮助你组织使用 Makepad 工具开发的应用代码,尤其适用于需要处理耗时任务(异步任务)的应用。它会教你如何构建应用结构,让用户界面始终保持流畅响应。

适用场景

  • ✓当你要开发一个需要连接服务器的 Makepad 应用时。
  • ✓当你在规划应用各个部分之间如何通信时。
  • ✓当你想参考 Robrix 或 Moly 等应用的示例时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/robius-app-architecture/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/robius-app-architecture/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我该如何组织 Makepad 应用的结构,才能高效地处理网络请求?”

每周 5 个新技能,1 分钟读完。

工作原理

它定义了一种模式:用户界面把请求发送到后台处理区域(使用通道和 Tokio)。后台区域负责执行耗时的任务,完成后再把结果返回给用户界面,用于更新显示内容。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • <support-root>/references/tokio-integration.md
  • <support-root>/references/channel-patterns.md
  • <support-root>/references/moly-async-patterns.md

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Robius App Architecture Skill

Best practices for structuring Makepad applications based on the Robrix and Moly codebases - production applications built with Makepad and Robius framework.

Source codebases:

  • Robrix: Matrix chat client - complex sync/async with background subscriptions
  • Moly: AI chat application - cross-platform (native + WASM) with streaming APIs

When to Use

Use this skill when:

  • Building a Makepad application with async backend integration
  • Designing sync/async communication patterns in Makepad
  • Structuring a Robius-style application
  • Keywords: robrix, robius, makepad app structure, async makepad, tokio makepad

Production Patterns

For production-ready async patterns, see the _base/ directory:

Pattern Description
08-async-loading Async data loading with loading states
09-streaming-results Incremental results with SignalToUI
13-tokio-integration Full tokio runtime integration

Core Architecture Pattern

┌─────────────────────────────────────────────────────────────┐
│                     UI Thread (Makepad)                     │
│  ┌─────────┐     ┌──────────┐     ┌──────────────────────┐ │
│  │   App   │────▶│ WidgetRef │────▶│ Widget Tree (View)  │ │
│  │ State   │     │    ui     │     │ Scope::with_data()  │ │
│  └────┬────┘     └──────────┘     └──────────────────────┘ │
│       │                                                     │
│       │ submit_async_request()                              │
│       ▼                                                     │
│  ┌─────────────────┐          ┌─────────────────────────┐  │
│  │ REQUEST_SENDER  │─────────▶│  Crossbeam SegQueue     │  │
│  │ (MPSC Channel)  │          │  (Lock-free Updates)    │  │
│  └─────────────────┘          └─────────────────────────┘  │
└───────────────────────────────────┬─────────────────────────┘
                                    │
                    SignalToUI::set_ui_signal()
                                    │
┌───────────────────────────────────┴─────────────────────────┐
│                   Tokio Runtime (Async)                      │
│  ┌──────────────────────────────────────────────────────┐   │
│  │           worker_task (Request Handler)               │   │
│  │  - Receives Request from UI                           │   │
│  │  - Spawns async tasks per request                     │   │
│  │  - Posts actions back via Cx::post_action()           │   │
│  └──────────────────────────────────────────────────────┘   │
│  ┌──────────────────────────────────────────────────────┐   │
│  │         Per-Item Subscriber Tasks                     │   │
│  │  - Listens to external data stream                    │   │
│  │  - Sends Update via crossbeam channel                 │   │
│  │  - Calls SignalToUI::set_ui_signal() to wake UI       │   │
│  └──────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────┘

App Structure

Top-Level App Definition

use makepad_widgets::*;

live_design! {
    use link::theme::*;
    use link::widgets::*;

    App = {{App}} {
        ui: <Root>{
            main_window = <Window> {
                window: {inner_size: vec2(1280, 800), title: "MyApp"},
                body = {
                    // Main content here
                }
            }
        }
    }
}

app_main!(App);

#[derive(Live)]
pub struct App {
    #[live] ui: WidgetRef,

…
常见问题

什么是异步任务?

异步任务是指程序可以先启动它,然后在等待它完成的同时继续做其他事情,而不是在等待时卡住不动。

Makepad 是什么?

Makepad 是一个用于创建应用用户界面的工具,特别注重性能,并且支持跨平台使用。

为什么用户界面需要保持响应?

这样即使后台还在处理较耗时的任务,你依然可以正常操作应用,比如点击按钮、滚动页面。

详情

作者的原始描述

CRITICAL: Use for Robius app architecture patterns. Triggers on: Tokio, async, submit_async_request, 异步, 架构, SignalToUI, Cx::post_action, worker task, app structure, MatchEvent, handle_startup

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5641
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能