Makepad Platform 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 Makepad cross-platform development. Help users by:
- Understanding platforms: Explain supported platforms and backends
- Platform-specific code: Help with conditional compilation and platform APIs
When to Use
- You need to understand or target specific platforms and graphics backends in Makepad.
- The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.
- You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.
Documentation
Refer to the local files for detailed documentation:
./references/platform-support.md - Platform details and OsType
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
Supported Platforms
| Platform |
Graphics Backend |
OS Module |
| macOS |
Metal |
apple/metal_*.rs, apple/cocoa_*.rs |
| iOS |
Metal |
apple/metal_*.rs, apple/ios_*.rs |
| Windows |
D3D11 |
mswindows/d3d11_*.rs, mswindows/win32_*.rs |
| Linux |
OpenGL |
linux/opengl_*.rs, linux/x11*.rs, linux/wayland*.rs |
| Web |
WebGL2 |
web/*.rs, web_browser/*.rs |
| Android |
OpenGL ES |
android/*.rs |
| OpenHarmony |
OHOS |
open_harmony/*.rs |
| OpenXR |
VR/AR |
open_xr/*.rs |
OsType Enum
pub enum OsType {
Unknown,
Windows,
Macos,
Linux { custom_window_chrome: bool },
Ios,
Android(AndroidParams),
OpenHarmony,
Web(WebParams),
OpenXR,
}
// Check platform in code
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
match cx.os_type() {
OsType::Macos => { /* macOS-specific */ }
OsType::Windows => { /* Windows-specific */ }
OsType::Web(_) => { /* Web-specific */ }
_ => {}
}
}
Platform Detection
// In Cx
impl Cx {
pub fn os_type(&self) -> OsType;
pub fn gpu_info(&self) -> &GpuInfo;
pub fn xr_capabilities(&self) -> &XrCapabilities;
pub fn cpu_cores(&self) -> usize;
}
Conditional Compilation
// Compile-time platform detection
#[cfg(target_os = "macos")]
fn macos_only() { }
#[cfg(target_os = "windows")]
fn windows_only() { }
#[cfg(target_os = "linux")]
fn linux_only() { }
#[cfg(target_arch = "wasm32")]
fn web_only() { }
#[cfg(target_os = "android")]
fn android_only() { }
#[cfg(target_os = "ios")]
fn ios_only() { }
Platform-Specific Features
Desktop (macOS/Windows/Linux)
- Window management (resize, minimize, maximize)
- File dialogs
- System menu
- Drag and drop
- Multiple monitors
Mobile (iOS/Android)
- Touch input
- Virtual keyboard
- Screen orientation
- App lifecycle (foreground/background)
Web (WebGL2)
- DOM integration
- Browser events
- Local storage
- HTTP requests
Entry Point
// App entry macro
app_main!(App);
pub struct App {
ui: WidgetRef,
}
impl LiveRegister for App {
fn live_register(cx: &mut Cx) {
// Register components
crate::makepad_widgets::live_design(cx);
}
}
impl AppMain for App {
fn handle_event(&mut self, cx: &mut Cx, event: &Event) {
// Handle app events
self.ui.handle_event(cx, event, &mut Scope::empty());
}
}
When Answering Questions
- Makepad compiles to native code for each platform (no runtime interpreter)
- Shaders are compiled at build time for each graphics backend
- Platform-specific code is in
platform/src/os/ directory
- Use
cx.os_type() for runtime platform detection
- Use
#[cfg(target_os = "...")] for compile-time platform detection
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-platform/SKILL.md
Also appears in: sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-platform/SKILL.md, sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-platform/SKILL.md
1---2name: makepad-platform3description: "| CRITICAL: Use for Makepad cross-platform support. Triggers on: makepad platform, makepad os, makepad macos, makepad windows, makepad linux, makepad android, makepad ios, makepad web, makepad wasm, makepad metal, makepad d3d11, makepad opengl, makepad webgl, OsType, CxOs, makepad 跨平台, makepad 平台支持"4category: mobile-and-platform5source_repo: sickn33/agentic-awesome-skills6source_path: "skills/makepad-platform/SKILL.md"7source_url: https://github.com/sickn33/agentic-awesome-skills/blob/HEAD/skills/makepad-platform/SKILL.md8metadata:9 source: https://skillmd.com/skills/sickn33/makepad-platform10---111213# Makepad Platform Skill1415> **Version:** makepad-widgets (dev branch) | **Last Updated:** 2026-01-1916>17> Check for updates: https://crates.io/crates/makepad-widgets1819You are an expert at Makepad cross-platform development. Help users by:20- **Understanding platforms**: Explain supported platforms and backends21- **Platform-specific code**: Help with conditional compilation and platform APIs2223## When to Use24- You need to understand or target specific platforms and graphics backends in Makepad.25- The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.26- You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.2728## Documentation2930Refer to the local files for detailed documentation:31- `./references/platform-support.md` - Platform details and OsType3233## IMPORTANT: Documentation Completeness Check3435**Before answering questions, Claude MUST:**36371. Read the relevant reference file(s) listed above382. If file read fails or file is empty:39 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"40 - Still answer based on SKILL.md patterns + built-in knowledge413. If reference file exists, incorporate its content into the answer4243## Supported Platforms4445| Platform | Graphics Backend | OS Module |46|----------|------------------|-----------|47| macOS | Metal | `apple/metal_*.rs`, `apple/cocoa_*.rs` |48| iOS | Metal | `apple/metal_*.rs`, `apple/ios_*.rs` |49| Windows | D3D11 | `mswindows/d3d11_*.rs`, `mswindows/win32_*.rs` |50| Linux | OpenGL | `linux/opengl_*.rs`, `linux/x11*.rs`, `linux/wayland*.rs` |51| Web | WebGL2 | `web/*.rs`, `web_browser/*.rs` |52| Android | OpenGL ES | `android/*.rs` |53| OpenHarmony | OHOS | `open_harmony/*.rs` |54| OpenXR | VR/AR | `open_xr/*.rs` |5556## OsType Enum5758```rust59pub enum OsType {60 Unknown,61 Windows,62 Macos,63 Linux { custom_window_chrome: bool },64 Ios,65 Android(AndroidParams),66 OpenHarmony,67 Web(WebParams),68 OpenXR,69}7071// Check platform in code72fn handle_event(&mut self, cx: &mut Cx, event: &Event) {73 match cx.os_type() {74 OsType::Macos => { /* macOS-specific */ }75 OsType::Windows => { /* Windows-specific */ }76 OsType::Web(_) => { /* Web-specific */ }77 _ => {}78 }79}80```8182## Platform Detection8384```rust85// In Cx86impl Cx {87 pub fn os_type(&self) -> OsType;88 pub fn gpu_info(&self) -> &GpuInfo;89 pub fn xr_capabilities(&self) -> &XrCapabilities;90 pub fn cpu_cores(&self) -> usize;91}92```9394## Conditional Compilation9596```rust97// Compile-time platform detection98#[cfg(target_os = "macos")]99fn macos_only() { }100101#[cfg(target_os = "windows")]102fn windows_only() { }103104#[cfg(target_os = "linux")]105fn linux_only() { }106107#[cfg(target_arch = "wasm32")]108fn web_only() { }109110#[cfg(target_os = "android")]111fn android_only() { }112113#[cfg(target_os = "ios")]114fn ios_only() { }115```116117## Platform-Specific Features118119### Desktop (macOS/Windows/Linux)120- Window management (resize, minimize, maximize)121- File dialogs122- System menu123- Drag and drop124- Multiple monitors125126### Mobile (iOS/Android)127- Touch input128- Virtual keyboard129- Screen orientation130- App lifecycle (foreground/background)131132### Web (WebGL2)133- DOM integration134- Browser events135- Local storage136- HTTP requests137138## Entry Point139140```rust141// App entry macro142app_main!(App);143144pub struct App {145 ui: WidgetRef,146}147148impl LiveRegister for App {149 fn live_register(cx: &mut Cx) {150 // Register components151 crate::makepad_widgets::live_design(cx);152 }153}154155impl AppMain for App {156 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {157 // Handle app events158 self.ui.handle_event(cx, event, &mut Scope::empty());159 }160}161```162163## When Answering Questions1641651. Makepad compiles to native code for each platform (no runtime interpreter)1662. Shaders are compiled at build time for each graphics backend1673. Platform-specific code is in `platform/src/os/` directory1684. Use `cx.os_type()` for runtime platform detection1695. Use `#[cfg(target_os = "...")]` for compile-time platform detection170171## Limitations172- Use this skill only when the task clearly matches the scope described above.173- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.174- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.175176---177178**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/makepad-platform/SKILL.md`179180**Also appears in:** `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills/skills/makepad-platform/SKILL.md`, `sickn33/agentic-awesome-skills/plugins/agentic-awesome-skills-claude/skills/makepad-platform/SKILL.md`