gpui-macros

Generate GPUI procedural macros for actions, components, and tests.

Updated Mar 6, 2026
One-click install
npx skills add https://github.com/onehr/gpui-skills --skill gpui-macros
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpui-macros
Source: https://github.com/onehr/gpui-skills/tree/main/skills/gpui-macros
Command: npx skills add https://github.com/onehr/gpui-skills --skill gpui-macros

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill simplifies the creation of GPUI applications by providing powerful procedural macros for defining actions, creating reusable UI components, and writing tests, reducing boilerplate code and improving developer productivity.

Core Features & Use Cases

  • Action Definition: Define simple unit actions with actions!() and complex, data-carrying actions with #[derive(Action)].
  • Component Creation: Easily create renderable components using #[derive(IntoElement)] and #[derive(Render)].
  • Testing Utilities: Leverage #[gpui::test] for a streamlined testing experience with TestAppContext.
  • Use Case: When building a new feature in a GPUI application, use #[derive(Action)] to define user interactions and #[derive(IntoElement)] to create custom UI elements for those interactions.

Quick Start

Use the gpui-macros skill to define a new action named 'SaveFile' for the 'editor' namespace.

Frequently Asked Questions about gpui-macros

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce boilerplate when defining actions in Rust GPUI applications?

To reduce boilerplate when defining actions in GPUI, use the `actions!()` macro for simple unit actions and `#[derive(Action)]` for complex, parameterized actions to streamline code generation.

What is the best way to create reusable UI components in GPUI?

The best way to create reusable UI components in GPUI is by applying the `#[derive(IntoElement)]` and `#[derive(Render)]` procedural macros to easily define renderable elements with minimal boilerplate.

How do I write tests for GPUI components in Rust?

You can write tests for GPUI components by applying the `#[gpui::test]` attribute, which provides a streamlined testing experience using `TestAppContext` to validate your application workflows.

Can I define parameterized actions carrying data in GPUI?

Yes, you can define parameterized, data-carrying actions in GPUI by using the `#[derive(Action)]` procedural macro, which simplifies the creation of complex user interactions within Rust applications.

Does GPUI provide macros to simplify testing workflows?

Yes, GPUI provides the `#[gpui::test]` macro to simplify testing workflows, allowing developers to easily set up a `TestAppContext` and reduce boilerplate typically associated with writing application tests.

When should I use procedural macros in GPUI development?

You should use procedural macros in GPUI development when defining actions, creating reusable UI components, or writing tests, effectively reducing boilerplate code and improving developer productivity.