スキル一覧に戻る
ZhangHanDong

makepad-dsl

by ZhangHanDong

makepad-dslは、ソフトウェア開発を効率化するスキルです。開発ワークフロー全体をサポートし、チームの生産性向上とコード品質の改善を実現します。

677🍴 76📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


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

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

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

SyntaxDescriptionExample
{ ... }Anonymous object{ width: 100.0 }
Name = { ... }Named prototypeMyStyle = { color: #FFF }
<Name> { ... }Inherit from prototype<MyStyle> { size: 10.0 }
{{RustType}}Link to Rust structApp = {{App}} { ... }
name = <Widget>Named child widgetbtn = <Button> { }
dep("...")Resource dependencydep("crate://self/img.png")

Property Types

TypeExampleDescription
Numberwidth: 100.0Float value
Colorcolor: #FF0000FFRGBA hex color
Stringtext: "Hello"Text string
Enumflow: DownEnum variant
Sizewidth: FitFit, Fill, or numeric
Objectpadding: { top: 10.0 }Nested object
Arraylabels: ["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
}

When Writing Code

  1. Use <Widget> syntax to inherit from built-in widgets
  2. Define reusable styles as named prototypes
  3. Use {{RustType}} to link DSL to Rust structs
  4. Override only properties that need to change
  5. Use meaningful names for child widget references

When Answering Questions

  1. Explain inheritance as "eager copy" - properties are copied at definition time
  2. Emphasize that DSL is embedded in Rust via live_design! macro
  3. Highlight that changes to DSL are live-reloaded without recompilation
  4. Distinguish between named objects (prototypes) and widget instances

スコア

総合スコア

80/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 500以上

+10
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

+5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

レビュー

💬

レビュー機能は近日公開予定です