gpui-entities

Manage GPUI entity and context state with type-safe APIs.

27|3|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/cnwzhu/gpui-skills --skill gpui-entities
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gpui-entities
Source: https://github.com/cnwzhu/gpui-skills/tree/main/gpui-entities
Command: npx skills add https://github.com/cnwzhu/gpui-skills --skill gpui-entities

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

GPUI apps often struggle with predictable state management across entities and contexts. This skill provides clear patterns to manage entity lifecycles, subscriptions, and safe references, reducing boilerplate and bugs.

Core Features & Use Cases

  • Entity lifecycle management: Create, read, update, and drop entities with predictable lifecycles.
  • Context-aware state access: Use window and entity contexts to share and observe state safely.
  • Subscriptions & weak references: Subscribe to changes and use WeakEntity to avoid memory leaks in complex UIs.

Quick Start

Initialize an entity in a window context, perform a read, update, and observe a change to demonstrate the core patterns.

Frequently Asked Questions about gpui-entities

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

FAQPage Schema
How do I manage GPUI component state using entities and contexts?

To manage GPUI component state, use structured entity patterns to handle creation, reading, and updating within window and entity contexts, ensuring predictable state access and safe lifecycle management across your application.

How do I avoid memory leaks when subscribing to state changes in GPUI?

To avoid memory leaks when subscribing to state changes in GPUI, use WeakEntity references. Weak references allow you to observe entity updates without preventing the garbage collector from dropping unused complex UI components.

What is the best way to handle entity lifecycle management in Rust GPUI?

The best way to handle entity lifecycle management in Rust GPUI is to apply type-safe APIs for Entity, Context, and WeakEntity, which define clear creation, update, and drop sequences to reduce boilerplate and runtime bugs.

Does GPUI support context-aware state access for window and entity contexts?

Yes, GPUI supports context-aware state access by allowing you to initialize entities within a window context and safely share or observe that state across entity contexts, providing predictable updates and change notifications throughout the UI.