본문으로 건너뛰기
Skillpedia
일반 코딩48k · #5644

robius-state-management

하는 일

이 스킬은 화면 설정이나 사용자 환경설정처럼 중요한 앱 정보를 정리하고 저장해, 나중에 다시 쓸 수 있도록 돕습니다. 앱을 닫았다가 다시 열어도 앱의 상태가 유지되도록 합니다.

사용하는 경우

  • ✓앱이 정보를 저장하는 방식을 설계할 때.
  • ✓사용자 설정을 저장해야 할 때.
  • ✓여러 세션에 걸쳐 화면에 보이는 것을 관리해야 할 때.

스킬 링크

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

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/robius-state-management/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“앱을 다시 열었을 때 화면 설정이 그대로 나타나도록 어떻게 저장할 수 있을까요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

이 스킬은 ‘serde’라는 시스템을 사용해 앱 데이터를 디스크에 저장할 수 있는 형식으로 바꿉니다. 앱이 이 데이터를 필요로 하면 다시 메모리로 불러옵니다.

기술 내용 (원본 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/persistence-patterns.md
  • <support-root>/references/state-structures.md
  • <support-root>/references/moly-state-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 State Management Skill

Best practices for state management and persistence in Makepad applications based on Robrix and Moly codebases.

Source codebases:

  • Robrix: Matrix chat client - AppState, SelectedRoom, persistence via serde
  • Moly: AI chat application - Central Store pattern, async initialization, Preferences

When to Use

Use this skill when:

  • Designing application state structure
  • Implementing state persistence
  • Passing state through widget tree
  • Managing UI state across sessions
  • Keywords: app state, makepad state, persistence, Scope::with_data, save state, load state

Production Patterns

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

Pattern Description
06-global-registry Global widget registry with Cx::set_global
07-radio-navigation Tab-style navigation with radio buttons
10-state-machine Enum-based state machine widgets
11-theme-switching Multi-theme support with apply_over
12-local-persistence Save/load user preferences

AppState Structure

Core State Definition

use serde::{Serialize, Deserialize};
use std::collections::HashMap;
use matrix_sdk::ruma::OwnedRoomId;

/// App-wide state that is stored persistently across multiple app runs
/// and shared/updated across various parts of the app.
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
pub struct AppState {
    /// The currently-selected room
    pub selected_room: Option<SelectedRoom>,

    /// Saved UI layout state for main view
    pub saved_layout_state: SavedLayoutState,

    /// Per-item saved states (e.g., per-space dock layouts)
    pub saved_state_per_item: HashMap<OwnedRoomId, SavedLayoutState>,

    /// Whether a user is currently logged in
    #[serde(skip)]  // Don't persist login state
    pub logged_in: bool,
}

/// Represents a currently selected item
#[derive(Clone, Debug, Serialize, Deserialize)]
pub enum SelectedRoom {
    JoinedRoom { room_name_id: RoomNameId },
    InvitedRoom { room_name_id: RoomNameId },
    Space { space_name_id: RoomNameId },
}

impl SelectedRoom {
    pub fn room_id(&self) -> &OwnedRoomId {
        match self {
            Self::JoinedRoom { room_name_id } => room_name_id.room_id(),
            Self::InvitedRoom { room_name_id } => room_name_id.room_id(),
            Self::Space { space_name_id } => space_name_id.room_id(),
        }
    }

    /// Upgrade from invited to joined state
    pub fn upgrade_invite_to_joined(&mut self, room_id: &RoomId) -> bool {
        match self {
            Self::InvitedRoom { room_name_id } if room_name_id.room_id() == room_id => {
                let name = room_name_id.clone();
                *self = Self::JoinedRoom { room_name_id: name };
                true
            }
            _ => false,
        }
    }
}

// Equality based on room_id only
impl PartialEq for SelectedRoom {
    fn eq(&self, other: &Self) -> bool {
        self.room_id() == other.room_id()
    }
}
impl Eq for SelectedRoom {}

Layout/Dock State Persistence

/// A snapshot of UI layout state for restoration
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
pub struct SavedLayoutState {
    /// All items contained in the layout, keyed by ID
    pub layout_items: HashMap<LiveIdSerde, LayoutItemSerde>,

    /// Items currently open, keyed by ID
    pub open_items: HashMap<LiveIdSerde, SelectedRoom>,

    /// Order items were opened (chronological)

…
자주 묻는 질문

애플리케이션의 ‘상태(state)’란 무엇인가요?

특정 순간에 앱이 작동하기 위해 필요한 모든 정보입니다. 예를 들어 열려 있는 탭, 입력된 텍스트, 선택된 테마 등이 있습니다.

상태를 저장하는 것이 왜 중요한가요?

앱이 사용자가 마지막으로 있던 곳을 기억하게 해 줍니다. 그래서 사용자가 앱을 열 때마다 모든 것을 다시 설정하지 않아도 되어 사용 경험이 좋아집니다.

‘지속성(persistence)’이란 무엇인가요?

앱이 닫혀도 데이터가 사라지지 않도록 저장하는 것을 말합니다. 문서를 파일로 저장하는 것과 비슷합니다.

상세 정보

작성자의 원본 설명

CRITICAL: Use for Robius state management patterns. Triggers on: AppState, persistence, theme switch, 状态管理, Scope::with_data, save state, load state, serde, 状态持久化, 主题切换

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#5644
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬