Chuyển đến nội dung
Skillpedia
Website và giao diện (frontend)48k · #5147

makepad-dsl

Skill này làm gì

Công cụ này giúp viết và hiểu ngôn ngữ đặc biệt (DSL) dùng trong framework Makepad để tạo giao diện. Nó cho phép định nghĩa cách các phần tử hình ảnh trông và hoạt động.

Khi nào nên dùng

  • ✓Khi bạn cần tạo một nút mới với kiểu dáng riêng trong Makepad.
  • ✓Khi bạn cố hiểu một thành phần trong Makepad kế thừa đặc điểm từ thành phần khác như thế nào.
  • ✓Khi bạn muốn định nghĩa một mẫu tái sử dụng cho nhiều phần tử trong ứng dụng Makepad.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-dsl/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/makepad-dsl/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một nút màu xanh dương kế thừa từ nút mặc định của Makepad, nhưng với chữ màu trắng.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ dùng ví dụ mã và quy tắc cú pháp để tạo hoặc giải thích mã DSL của Makepad. Nó hiểu cách định nghĩa đối tượng, cách chúng kế thừa từ đối tượng khác và cách kết nối các kiểu này với mã Rust.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Supporting material availability

This catalog copy contains the inline guidance below, but does not include the following supporting paths. They are external prerequisites, not bundled files:

  • ./references/dsl-syntax.md
  • ./references/inheritance.md

Ask for the original supporting material or an existing installation before using a step that depends on these paths; this catalog does not identify a verified download source for them. Resolve each path relative to that installation, inspect its contents, and verify any applicable license and execution prerequisites. Do not run a command or claim a referenced procedure was followed until its required file exists. Do not fabricate the missing scripts or treat an unrelated file with the same name as equivalent. Independent steps fully documented here can proceed within the user’s authorized scope; report any dependent step as unavailable.

Makepad DSL 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 DSL. Help users by:

  • Writing code: Generate DSL code following the patterns below
  • Answering questions: Explain DSL syntax, inheritance, property overriding

When to Use

  • You need help with Makepad live_design! syntax, object definitions, or inheritance patterns.
  • The task involves widget declarations, property overrides, prototypes, or DSL composition rules.
  • You want Makepad DSL-specific examples rather than generic Rust syntax advice.

Documentation

Refer to the local files for detailed documentation:

  • ./references/dsl-syntax.md - Complete DSL syntax reference
  • ./references/inheritance.md - Inheritance patterns and examples

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

Key Patterns

1. Anonymous Object

{
    width: 100.0
    height: 50.0
    color: #FF0000
}

2. Named Object (Prototype)

MyButton = {
    width: Fit
    height: 40.0
    padding: 10.0
    draw_bg: { color: #333333 }
}

3. Inheritance with Override

PrimaryButton = <MyButton> {
    draw_bg: { color: #0066CC }  // Override parent color
    draw_text: { color: #FFFFFF }  // Add new property
}

4. Widget Instantiation

<View> {
    // Inherits from View prototype
    width: Fill
    height: Fill

    <Button> { text: "Click Me" }  // Child widget
    <Label> { text: "Hello" }      // Another child
}

5. Linking Rust Struct to DSL

// In live_design!
MyWidget = {{MyWidget}} {
    // DSL properties
    width: 100.0
}

// In Rust
#[derive(Live, LiveHook, Widget)]
pub struct MyWidget {
    #[deref] view: View,
    #[live] width: f64,
}

DSL Syntax Reference

Syntax Description Example
{ ... } Anonymous object { width: 100.0 }
Name = { ... } Named prototype MyStyle = { color: #FFF }
<Name> { ... } Inherit from prototype <MyStyle> { size: 10.0 }
{{RustType}} Link to Rust struct App = {{App}} { ... }
name = <Widget> Named child widget btn = <Button> { }
dep("...") Resource dependency dep("crate://self/img.png")

Property Types

Type Example Description
Number width: 100.0 Float value
Color color: #FF0000FF RGBA hex color
String text: "Hello" Text string
Enum flow: Down Enum variant
Size width: Fit Fit, Fill, or numeric
Object padding: { top: 10.0 } Nested object
Array labels: ["A", "B"] List of values

Inheritance Rules

  1. Eager Copy: All parent properties are copied immediately
  2. Override: Child can override any parent property
  3. Extend: Child can add new properties
  4. Nested Override: Override nested objects partially
Parent = {
    a: 1
    nested: { x: 10, y: 20 }
}

Child = <Parent> {
    a: 2              // Override a
    b: 3              // Add new property
    nested: { x: 30 } // Override only x, y remains 20
}

…

Câu hỏi thường gặp

“live_design!” là gì?

Đây là một macro Rust cho phép nhúng mã DSL của Makepad trực tiếp vào dự án, giúp tạo giao diện trực quan dễ hơn.

Kế thừa trong DSL của Makepad hoạt động thế nào?

Hoạt động giống các ngôn ngữ khác: một kiểu mới có thể 'kế thừa' từ kiểu có sẵn, sao chép thuộc tính và cho phép bạn sửa đổi hoặc thêm thuộc tính mới.

Bạn có thể đổi màu của một phần tử có sẵn không?

Có. Bạn có thể 'ghi đè' thuộc tính của kiểu cha để thay đổi diện mạo hoặc hành vi của nó.

Chi tiết

Mô tả gốc của tác giả

CRITICAL: Use for Makepad DSL syntax and inheritance. Triggers on: makepad dsl, live_design, makepad inheritance, makepad prototype, "<Widget>", "Foo = { }", makepad object, makepad property, makepad DSL 语法, makepad 继承, makepad 原型, 如何定义 makepad 组件

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5147
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự