Makepad Basics Skill
Version: makepad-widgets (dev branch) | Last Updated: 2026-01-19
Check for updates: https://crates.io/crates/makepad-widgets
You are an expert at the Rust makepad-widgets crate. Help users by:
- Writing code: Generate Rust code following the patterns below
- Answering questions: Explain concepts, troubleshoot issues, reference documentation
When to Use
- You need to get started with Makepad or understand basic app structure and boilerplate.
- The task involves project setup,
live_design!, app_main!, or first-screen application wiring.
- You want foundational Makepad guidance before moving into more specific layout, widget, or shader topics.
Documentation
Refer to the local files for detailed documentation:
./references/app-structure.md - Complete app boilerplate and structure
./references/event-handling.md - Event handling patterns
IMPORTANT: Documentation Completeness Check
Before answering questions, Claude MUST:
- Read the relevant reference file(s) listed above
- If file read fails or file is empty:
- Inform user: "本地文档不完整,建议运行
/sync-crate-skills makepad --force 更新文档"
- Still answer based on SKILL.md patterns + built-in knowledge
- If reference file exists, incorporate its content into the answer
Key Patterns
1. Basic App Structure
use makepad_widgets::*;
live_design! {
use link::theme::*;
use link::shaders::*;
use link::widgets::*;
App = {{App}} {
ui: <Root> {
main_window = <Window> {
body = <View> {
width: Fill, height: Fill
flow: Down
<Label> { text: "Hello Makepad!" }
}
}
}
}
}
app_main!(App);
#[derive(Live, LiveHook)]
pub struct App {
#[live] ui: WidgetRef,
}
impl LiveRegister for App {
fn live_register(cx: &mut Cx) {
crate::makepad_widgets::live_design(cx);
}
}
impl AppMain for App {
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
self.ui.handle_event(cx, event, &mut Scope::empty());
}
}
2. Cargo.toml Setup
[package]
name = "my_app"
version = "0.1.0"
edition = "2024"
[dependencies]
makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev" }
3. Handling Button Clicks
impl AppMain for App {
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
let actions = self.ui.handle_event(cx, event, &mut Scope::empty());
if self.ui.button(id!(my_button)).clicked(&actions) {
log!("Button clicked!");
}
}
}
4. Accessing and Modifying Widgets
// Get widget references
let label = self.ui.label(id!(my_label));
label.set_text("Updated text");
let input = self.ui.text_input(id!(my_input));
let text = input.text();
API Reference Table
| Macro/Type |
Description |
Example |
live_design! |
Defines UI in DSL |
live_design! { App = {{App}} { ... } } |
app_main! |
Entry point macro |
app_main!(App); |
#[derive(Live)] |
Derive live data |
#[derive(Live, LiveHook)] |
WidgetRef |
Reference to UI tree |
#[live] ui: WidgetRef |
Cx |
Context for rendering |
fn handle_event(&mut self, cx: &mut Cx, ...) |
id!() |
Widget ID macro |
self.ui.button(id!(my_button)) |
Platform Setup
| Platform |
Requirements |
| macOS |
Works out of the box |
| Windows |
Works out of the box |
| Linux |
apt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev |
| Web |
cargo install wasm-pack |
When Writing Code
- Always include required imports:
use makepad_widgets::*;
- Use
live_design! macro for all UI definitions
- Implement
LiveRegister and AppMain traits
- Use
id!() macro for widget references
- Handle events through
handle_event method
When Answering Questions
- Emphasize live design - changes in DSL reflect instantly without recompilation
- Makepad is GPU-first - all rendering is shader-based
- Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web
- Recommend UI Zoo example for widget exploration
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Source: sickn33/agentic-awesome-skills → skills/makepad-basics/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-basics/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-basics/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-bundle-makepad-builder/skills/makepad-basics/SKILL.md
1---2name: makepad-basics3description: | CRITICAL: Use for Makepad getting started and app structure. Triggers on: makepad, makepad getting started, makepad tutorial, live_design!, app_main!, makepad project setup, makepad hello world, "how to create makepad app", makepad 入门, 创建 makepad 应用, makepad 教程, makepad 项目结构4---567# Makepad Basics Skill89> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1910>11> Check for updates: https://crates.io/crates/makepad-widgets1213You are an expert at the Rust `makepad-widgets` crate. Help users by:14- **Writing code**: Generate Rust code following the patterns below15- **Answering questions**: Explain concepts, troubleshoot issues, reference documentation1617## When to Use18- You need to get started with Makepad or understand basic app structure and boilerplate.19- The task involves project setup, `live_design!`, `app_main!`, or first-screen application wiring.20- You want foundational Makepad guidance before moving into more specific layout, widget, or shader topics.2122## Documentation2324Refer to the local files for detailed documentation:25- `./references/app-structure.md` - Complete app boilerplate and structure26- `./references/event-handling.md` - Event handling patterns2728## IMPORTANT: Documentation Completeness Check2930**Before answering questions, Claude MUST:**31321. Read the relevant reference file(s) listed above332. If file read fails or file is empty:34 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"35 - Still answer based on SKILL.md patterns + built-in knowledge363. If reference file exists, incorporate its content into the answer3738## Key Patterns3940### 1. Basic App Structure4142```rust43use makepad_widgets::*;4445live_design! {46 use link::theme::*;47 use link::shaders::*;48 use link::widgets::*;4950 App = {{App}} {51 ui: <Root> {52 main_window = <Window> {53 body = <View> {54 width: Fill, height: Fill55 flow: Down5657 <Label> { text: "Hello Makepad!" }58 }59 }60 }61 }62}6364app_main!(App);6566#[derive(Live, LiveHook)]67pub struct App {68 #[live] ui: WidgetRef,69}7071impl LiveRegister for App {72 fn live_register(cx: &mut Cx) {73 crate::makepad_widgets::live_design(cx);74 }75}7677impl AppMain for App {78 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {79 self.ui.handle_event(cx, event, &mut Scope::empty());80 }81}82```8384### 2. Cargo.toml Setup8586```toml87[package]88name = "my_app"89version = "0.1.0"90edition = "2024"9192[dependencies]93makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "dev" }94```9596### 3. Handling Button Clicks9798```rust99impl AppMain for App {100 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {101 let actions = self.ui.handle_event(cx, event, &mut Scope::empty());102103 if self.ui.button(id!(my_button)).clicked(&actions) {104 log!("Button clicked!");105 }106 }107}108```109110### 4. Accessing and Modifying Widgets111112```rust113// Get widget references114let label = self.ui.label(id!(my_label));115label.set_text("Updated text");116117let input = self.ui.text_input(id!(my_input));118let text = input.text();119```120121## API Reference Table122123| Macro/Type | Description | Example |124|------------|-------------|---------|125| `live_design!` | Defines UI in DSL | `live_design! { App = {{App}} { ... } }` |126| `app_main!` | Entry point macro | `app_main!(App);` |127| `#[derive(Live)]` | Derive live data | `#[derive(Live, LiveHook)]` |128| `WidgetRef` | Reference to UI tree | `#[live] ui: WidgetRef` |129| `Cx` | Context for rendering | `fn handle_event(&mut self, cx: &mut Cx, ...)` |130| `id!()` | Widget ID macro | `self.ui.button(id!(my_button))` |131132## Platform Setup133134| Platform | Requirements |135|----------|--------------|136| macOS | Works out of the box |137| Windows | Works out of the box |138| Linux | `apt-get install clang libaudio-dev libpulse-dev libx11-dev libxcursor-dev` |139| Web | `cargo install wasm-pack` |140141## When Writing Code1421431. Always include required imports: `use makepad_widgets::*;`1442. Use `live_design!` macro for all UI definitions1453. Implement `LiveRegister` and `AppMain` traits1464. Use `id!()` macro for widget references1475. Handle events through `handle_event` method148149## When Answering Questions1501511. Emphasize live design - changes in DSL reflect instantly without recompilation1522. Makepad is GPU-first - all rendering is shader-based1533. Cross-platform: same code runs on Android, iOS, Linux, macOS, Windows, Web1544. Recommend UI Zoo example for widget exploration155156## Limitations157- Use this skill only when the task clearly matches the scope described above.158- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.159- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.160161---162163**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/makepad-basics/SKILL.md`164165**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-basics/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-basics/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-bundle-makepad-builder/skills/makepad-basics/SKILL.md`