makepad-platform

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 平台支持

31,392 stars
Complexity: easy

About this skill

The `makepad-platform` skill equips an AI agent with specialized knowledge in Makepad, a Rust-based cross-platform UI framework. This skill is critical for developers seeking assistance with Makepad's multi-platform capabilities, allowing the AI to explain support for various operating systems (macOS, Windows, Linux, Android, iOS, Web/WASM) and graphics APIs (Metal, D3D11, OpenGL, WebGL). The AI can help users understand platform differences, implement conditional compilation for platform-specific features using `#[cfg()]` attributes, and navigate Makepad's `OsType` and `CxOs` constructs. It triggers on a wide range of keywords related to Makepad platforms and operating systems, including Chinese terms for cross-platform support.

Best use case

Use this skill when developing UI applications with Makepad and requiring assistance with cross-platform compatibility, platform-specific optimizations, or understanding the various target environments and rendering technologies Makepad supports.

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 平台支持

Users can expect clear explanations, detailed guidance, and practical advice on Makepad's cross-platform architecture. The AI will provide insights into platform-specific development, helping to write more robust and adaptable Makepad applications across diverse environments.

Practical example

Example input

How can I implement platform-specific UI adjustments in Makepad for macOS vs. Android? What rendering backend should I use for Makepad on Windows, and what are its advantages?

Example output

For platform-specific UI adjustments in Makepad, you'll primarily use Rust's conditional compilation with `#[cfg()]` attributes. For example, to adjust a widget's size or behavior based on the OS:

```rust
match self.cx.os_type() {
    OsType::Macos => { /* macOS specific logic */ },
    OsType::Android => { /* Android specific logic */ },
    _ => { /* Default or other platform logic */ }
}

#[cfg(target_os = "macos")]
fn macos_only_function() { /* ... */ }
```

Regarding rendering backends for Makepad on Windows, the primary choice is **D3D11 (Direct3D 11)**. Makepad abstracts this, but knowing it's D3D11 is useful for debugging or understanding performance characteristics. Its advantages include native integration with Windows, generally good performance on modern hardware, and access to advanced graphics features. Makepad also offers an OpenGL backend, which is more cross-platform but might not always offer the absolute best performance on Windows compared to D3D11. If you're targeting Windows specifically and performance is key, D3D11 is often preferred, but Makepad handles this abstraction for you.

When to use this skill

  • When you need to understand how Makepad targets different operating systems, when writing platform-specific code for macOS, Windows, Linux, Android, iOS, or Web, when troubleshooting rendering issues related to Metal, D3D11, OpenGL, or WebGL, or when seeking guidance on using `OsType` and `CxOs` within your Makepad projects.

When not to use this skill

  • Do not use this skill for general Rust programming not related to Makepad, for UI development using other frameworks, or for tasks that do not involve cross-platform considerations or specific Makepad technologies.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/makepad-platform/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/makepad-platform/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/makepad-platform/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How makepad-platform Compares

Feature / Agentmakepad-platformStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

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 平台支持

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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:**

1. Read the relevant reference file(s) listed above
2. 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
3. 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

```rust
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

```rust
// 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

```rust
// 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

```rust
// 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

1. Makepad compiles to native code for each platform (no runtime interpreter)
2. Shaders are compiled at build time for each graphics backend
3. Platform-specific code is in `platform/src/os/` directory
4. Use `cx.os_type()` for runtime platform detection
5. Use `#[cfg(target_os = "...")]` for compile-time platform detection

Related Skills

makepad-layout

31392
from sickn33/antigravity-awesome-skills

CRITICAL: Use for Makepad layout system. Triggers on: makepad layout, makepad width, makepad height, makepad flex, makepad padding, makepad margin, makepad flow, makepad align, Fit, Fill, Size, Walk, "how to center in makepad", makepad 布局, makepad 宽度, makepad 对齐, makepad 居中

Development ToolsClaude

makepad-font

31392
from sickn33/antigravity-awesome-skills

CRITICAL: Use for Makepad font and text rendering. Triggers on: makepad font, makepad text, makepad glyph, makepad typography, font atlas, text layout, font family, font size, text shaping, makepad 字体, makepad 文字, makepad 排版, makepad 字形

Development ToolsClaude

makepad-animation

31355
from sickn33/antigravity-awesome-skills

CRITICAL: Use for Makepad animation system. Triggers on: makepad animation, makepad animator, makepad hover, makepad state, makepad transition, "from: { all: Forward", makepad pressed, makepad 动画, makepad 状态, makepad 过渡, makepad 悬停效果

Development ToolsClaude

moodle-external-api-development

31392
from sickn33/antigravity-awesome-skills

This skill guides you through creating custom external web service APIs for Moodle LMS, following Moodle's external API framework and coding standards.

Development ToolsClaude

mobile-developer

31392
from sickn33/antigravity-awesome-skills

Develop React Native, Flutter, or native mobile apps with modern architecture patterns. Masters cross-platform development, native integrations, offline sync, and app store optimization.

Development ToolsClaude

graphql-architect

31392
from sickn33/antigravity-awesome-skills

Master modern GraphQL with federation, performance optimization, and enterprise security. Build scalable schemas, implement advanced caching, and design real-time systems.

Development ToolsClaude

git-pr-workflows-pr-enhance

31392
from sickn33/antigravity-awesome-skills

You are a PR optimization expert specializing in creating high-quality pull requests that facilitate efficient code reviews. Generate comprehensive PR descriptions, automate review processes, and ensu

Development ToolsClaude

git-advanced-workflows

31392
from sickn33/antigravity-awesome-skills

Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.

Development ToolsClaude

debugging-toolkit-smart-debug

31392
from sickn33/antigravity-awesome-skills

Use when working with debugging toolkit smart debug

Development ToolsClaude

debugger

31392
from sickn33/antigravity-awesome-skills

Debugging specialist for errors, test failures, and unexpected behavior. Use proactively when encountering any issues.

Development ToolsClaude

conductor-setup

31392
from sickn33/antigravity-awesome-skills

Configure a Rails project to work with Conductor (parallel coding agents)

Development ToolsClaudeGitHub CopilotDeepSeek

comprehensive-review-pr-enhance

31392
from sickn33/antigravity-awesome-skills

Generate structured PR descriptions from diffs, add review checklists, risk assessments, and test coverage summaries. Use when the user says "write a PR description", "improve this PR", "summarize my changes", "PR review", "pull request", or asks to document a diff for reviewers.

Development ToolsClaude