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 平台支持4---567# Makepad Platform 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 Makepad cross-platform development. Help users by:14- **Understanding platforms**: Explain supported platforms and backends15- **Platform-specific code**: Help with conditional compilation and platform APIs1617## When to Use18- You need to understand or target specific platforms and graphics backends in Makepad.19- The task involves platform compatibility, conditional compilation, or OS-specific behavior across desktop, mobile, or web.20- You need guidance on backend differences such as Metal, D3D11, OpenGL, WebGL, or platform modules.2122## Documentation2324Refer to the local files for detailed documentation:25- `./references/platform-support.md` - Platform details and OsType2627## IMPORTANT: Documentation Completeness Check2829**Before answering questions, Claude MUST:**30311. Read the relevant reference file(s) listed above322. If file read fails or file is empty:33 - Inform user: "本地文档不完整,建议运行 `/sync-crate-skills makepad --force` 更新文档"34 - Still answer based on SKILL.md patterns + built-in knowledge353. If reference file exists, incorporate its content into the answer3637## Supported Platforms3839| Platform | Graphics Backend | OS Module |40|----------|------------------|-----------|41| macOS | Metal | `apple/metal_*.rs`, `apple/cocoa_*.rs` |42| iOS | Metal | `apple/metal_*.rs`, `apple/ios_*.rs` |43| Windows | D3D11 | `mswindows/d3d11_*.rs`, `mswindows/win32_*.rs` |44| Linux | OpenGL | `linux/opengl_*.rs`, `linux/x11*.rs`, `linux/wayland*.rs` |45| Web | WebGL2 | `web/*.rs`, `web_browser/*.rs` |46| Android | OpenGL ES | `android/*.rs` |47| OpenHarmony | OHOS | `open_harmony/*.rs` |48| OpenXR | VR/AR | `open_xr/*.rs` |4950## OsType Enum5152```rust53pub enum OsType {54 Unknown,55 Windows,56 Macos,57 Linux { custom_window_chrome: bool },58 Ios,59 Android(AndroidParams),60 OpenHarmony,61 Web(WebParams),62 OpenXR,63}6465// Check platform in code66fn handle_event(&mut self, cx: &mut Cx, event: &Event) {67 match cx.os_type() {68 OsType::Macos => { /* macOS-specific */ }69 OsType::Windows => { /* Windows-specific */ }70 OsType::Web(_) => { /* Web-specific */ }71 _ => {}72 }73}74```7576## Platform Detection7778```rust79// In Cx80impl Cx {81 pub fn os_type(&self) -> OsType;82 pub fn gpu_info(&self) -> &GpuInfo;83 pub fn xr_capabilities(&self) -> &XrCapabilities;84 pub fn cpu_cores(&self) -> usize;85}86```8788## Conditional Compilation8990```rust91// Compile-time platform detection92#[cfg(target_os = "macos")]93fn macos_only() { }9495#[cfg(target_os = "windows")]96fn windows_only() { }9798#[cfg(target_os = "linux")]99fn linux_only() { }100101#[cfg(target_arch = "wasm32")]102fn web_only() { }103104#[cfg(target_os = "android")]105fn android_only() { }106107#[cfg(target_os = "ios")]108fn ios_only() { }109```110111## Platform-Specific Features112113### Desktop (macOS/Windows/Linux)114- Window management (resize, minimize, maximize)115- File dialogs116- System menu117- Drag and drop118- Multiple monitors119120### Mobile (iOS/Android)121- Touch input122- Virtual keyboard123- Screen orientation124- App lifecycle (foreground/background)125126### Web (WebGL2)127- DOM integration128- Browser events129- Local storage130- HTTP requests131132## Entry Point133134```rust135// App entry macro136app_main!(App);137138pub struct App {139 ui: WidgetRef,140}141142impl LiveRegister for App {143 fn live_register(cx: &mut Cx) {144 // Register components145 crate::makepad_widgets::live_design(cx);146 }147}148149impl AppMain for App {150 fn handle_event(&mut self, cx: &mut Cx, event: &Event) {151 // Handle app events152 self.ui.handle_event(cx, event, &mut Scope::empty());153 }154}155```156157## When Answering Questions1581591. Makepad compiles to native code for each platform (no runtime interpreter)1602. Shaders are compiled at build time for each graphics backend1613. Platform-specific code is in `platform/src/os/` directory1624. Use `cx.os_type()` for runtime platform detection1635. Use `#[cfg(target_os = "...")]` for compile-time platform detection164165## Limitations166- Use this skill only when the task clearly matches the scope described above.167- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.168- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.169170---171172**Source:** [`sickn33/agentic-awesome-skills`](https://github.com/sickn33/agentic-awesome-skills) → `skills/makepad-platform/SKILL.md`173174**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`