본문으로 건너뛰기
Skillpedia
에이전트48k · #6285

molykit

하는 일

MolyKit은 여러 운영체제에서 작동하는 AI 채팅 애플리케이션을 만들기 위한 도구 모음입니다. OpenAI 같은 AI 서비스와 연결하고, 대화를 정리된 방식으로 보여 주도록 돕습니다.

사용하는 경우

  • ✓AI 채팅 애플리케이션을 만들 때.
  • ✓OpenAI 같은 AI 서비스를 앱에 연결할 때.
  • ✓채팅 앱이 컴퓨터와 웹에서 모두 작동해야 하는 경우.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/skills/molykit/SKILL.md

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

사용 방법

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

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

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

AI에게 요청하는 예시

“MolyKit을 사용해 OpenAI와 연결된 채팅 화면을 만들려면 어떻게 해야 하나요?”

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

작동 방식

MolyKit은 메시지를 표시하고 텍스트를 입력하는 완성된 구성 요소를 제공합니다. 또한 인공지능과 효율적이고 비동기적으로 연결하는 도구를 제공하여, 여러 플랫폼에서 모두 잘 작동하도록 합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

MolyKit Skill

Best practices for building AI chat interfaces with Makepad using MolyKit - a toolkit for cross-platform AI chat applications.

Source codebase: /Users/zhangalex/Work/Projects/FW/robius/moly/moly-kit

When to Use

Use this skill when:

  • Building AI chat interfaces with Makepad
  • Integrating OpenAI or other LLM APIs
  • Implementing cross-platform async for native and WASM
  • Creating chat widgets (messages, prompts, avatars)
  • Handling SSE streaming responses
  • Keywords: molykit, moly-kit, ai chat, bot client, openai makepad, chat widget, sse streaming

Overview

MolyKit provides:

  • Cross-platform async utilities (PlatformSend, spawn(), ThreadToken)
  • Ready-to-use chat widgets (Chat, Messages, PromptInput, Avatar)
  • BotClient trait for AI provider integration
  • OpenAI-compatible client with SSE streaming
  • Protocol types for messages, bots, and tool calls
  • MCP (Model Context Protocol) support

Cross-Platform Async Patterns

PlatformSend - Send Only on Native

/// Implies Send only on native platforms, not on WASM
/// - On native: implemented by types that implement Send
/// - On WASM: implemented by ALL types
pub trait PlatformSend: PlatformSendInner {}

/// Boxed future type for cross-platform use
pub type BoxPlatformSendFuture<'a, T> = Pin<Box<dyn PlatformSendFuture<Output = T> + 'a>>;

/// Boxed stream type for cross-platform use
pub type BoxPlatformSendStream<'a, T> = Pin<Box<dyn PlatformSendStream<Item = T> + 'a>>;

Platform-Agnostic Spawning

/// Runs a future independently
/// - Uses tokio on native (requires Send)
/// - Uses wasm-bindgen-futures on WASM (no Send required)
pub fn spawn(fut: impl PlatformSendFuture<Output = ()> + 'static);

// Usage
spawn(async move {
    let result = fetch_data().await;
    Cx::post_action(DataReady(result));
    SignalToUI::set_ui_signal();
});

Task Cancellation with AbortOnDropHandle

/// Handle that aborts its future when dropped
pub struct AbortOnDropHandle(AbortHandle);

// Usage - task cancelled when widget dropped
#[rust]
task_handle: Option<AbortOnDropHandle>,

fn start_task(&mut self) {
    let (future, handle) = abort_on_drop(async move {
        // async work...
    });
    self.task_handle = Some(handle);
    spawn(async move { let _ = future.await; });
}

ThreadToken for Non-Send Types on WASM

/// Store non-Send value in thread-local, access via token
pub struct ThreadToken<T: 'static>;

impl<T> ThreadToken<T> {
    pub fn new(value: T) -> Self;
    pub fn peek<R>(&self, f: impl FnOnce(&T) -> R) -> R;
    pub fn peek_mut<R>(&self, f: impl FnOnce(&mut T) -> R) -> R;
}

// Usage - wrap non-Send type for use across Send boundaries
let token = ThreadToken::new(non_send_value);
spawn(async move {
    token.peek(|value| {
        // use value...
    });
});

BotClient Trait

Implementing AI Provider Integration

pub trait BotClient: Send {
    /// Send message with streamed response
    fn send(
        &mut self,
        bot_id: &BotId,
        messages: &[Message],
        tools: &[Tool],
    ) -> BoxPlatformSendStream<'static, ClientResult<MessageContent>>;

    /// Get available bots/models
    fn bots(&self) -> BoxPlatformSendFuture<'static, ClientResult<Vec<Bot>>>;

    /// Clone for passing around
    fn clone_box(&self) -> Box<dyn BotClient>;
}

// Usage
let client = OpenAIClient::new("https://api.openai.com/v1".into());
client.set_key("sk-...")?;
let context = BotContext::from(client);

BotContext - Sharable Wrapper

/// Sharable wrapper with loaded bots for sync UI access
pub struct BotContext(Arc<Mutex<InnerBotContext>>);

impl BotContext {
    pub fn load(&mut self) -> BoxPlatformSendFuture<ClientResult<()>>;
    pub fn bots(&self) -> Vec<Bot>;
    pub fn get_bot(&self, id: &BotId) -> Option<Bot>;
    pub fn client(&self) -> Box<dyn BotClient>;
}

// Usage
let mut context = BotContext::from(client);
spawn(async move {
    if let Err(errors) = context.load().await.into_result() {
        // handle errors
    }
    Cx::post_action(BotsLoaded);
});

Protocol Types

Message Structure

pub struct Message {
    pub from: EntityId,         // User, System, Bot(BotId), App
    pub metadata: MessageMetadata,
    pub content: MessageContent,
}

pub struct MessageContent {
    pub text: String,           // Main content (markdown)
    pub reasoning: String,      // AI reasoning/thinking

…
자주 묻는 질문

‘크로스 플랫폼 비동기’란 무엇인가요?

코드가 인터페이스를 멈추지 않고 비동기로 실행되며, Windows와 macOS 같은 네이티브 시스템과 웹(WASM) 모두에서 각 환경에 맞는 도구를 사용해 실행된다는 뜻입니다.

‘채팅 위젯’이란 무엇인가요?

메시지 표시 영역, 텍스트 입력창, 아바타 이미지처럼 MolyKit이 제공하여 채팅 제작을 간편하게 해 주는 미리 만들어진 화면 요소입니다.

MolyKit은 AI와 어떻게 연결되나요?

‘BotClient’를 사용하며, 이를 설정해 OpenAI 같은 여러 AI 제공자와 통신할 수 있습니다. 응답은 실시간(스트리밍)으로 받습니다.

상세 정보

작성자의 원본 설명

CRITICAL: Use for MolyKit AI chat toolkit. Triggers on: BotClient, OpenAI, SSE streaming, AI chat, molykit, PlatformSend, spawn(), ThreadToken, cross-platform async, Chat widget, Messages, PromptInput, Avatar, LLM

repo: sickn33/agentic-awesome-skills

인기도

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

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬