gpui
GPUI components: styling, actions/shortcuts, async, contexts, entities, events, focus, global state, testing, stories/docs, PR descriptions.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 2
- Forks
- 0
01 前言 Front Matter
- name
- gpui
- description
- GPUI components: styling, actions/shortcuts, async, contexts, entities, events, focus, global state, testing, stories/docs, PR descriptions.
02 资源文件 1
- 参考文档agents/openai.yaml161 B
03 SKILL.md 正文
GPUI Unified Skill
Summary
- Build GPUI components following existing
crates/uipatterns + style guide. Keep APIs consistent, builder-style. - Stateless vs stateful: deliberate choice. Use
Entity<T>for stateful patterns, notify on updates. - Styling:
StyleRefinement,Styled, fluent builders, theme tokens. - Actions/focus: wire explicitly with
key_context,actions!,FocusHandle. - Stories/docs: mirror
crates/storyanddocspatterns. - Tests:
TestAppContextfor non-visual logic,VisualTestContextfor window/rendering.
Component Build Steps
- Decide type: stateless element for pure presentation; stateful element +
Entity<State>when UI state persists. - Struct layout:
id: ElementId,base: Div,style: StyleRefinement. Field order: identity → config → content/children → callbacks. Callbacks asOption<Rc<dyn Fn(...)>>. - Builder API: return
Selffrom setters (label,on_click,disabled). Keep naming consistent with existing components. - Traits:
InteractiveElement,StatefulInteractiveElement(when stateful),Styled,RenderOnce. AddSizable/Selectable/Disableablewhen appropriate. - Render:
cx.theme()for colors/tokens. Compose with fluent builders (flex,gap,items_center,rounded).RenderOncefocused, no side effects. - State/async:
WeakEntityin closures to avoid retain cycles.cx.spawnforeground,cx.background_spawnheavy work. Sequence entity updates, don't nest. - Actions/focus/events:
actions!or#[derive(Action)].cx.bind_keys(),key_context()on root.FocusHandle+track_focus().cx.emit/cx.subscribe/cx.observe. - Stories/docs/tests: stories follow
crates/story/src/storieswithsection!. Docs followdocs/*.md. Tests:TestAppContextlogic,VisualTestContextwindow/rendering.
Task Routing
- New components/refactors →
references/style-guide.md+references/new-component.md(+references/layout-and-style.mdas needed) - Component stories →
references/generate-component-story.md - Component docs →
references/generate-component-documentation.md - Actions/key bindings →
references/actions.md - Async/background work →
references/async.md - Context/window/entity →
references/context.md - Entity state →
references/entity.md - Events/subscriptions/observers →
references/event.md - Focus/keyboard nav →
references/focus-handle.md - Global state →
references/global.md - Tests →
references/test.md,references/test-reference.md,references/test-examples.md,references/component-test-rules.md - PR descriptions →
references/github-pull-request-description.md
Reference Index
references/actions.md— actions, key bindings, key contextsreferences/async.md— async tasks, background work, task lifetimesreferences/context.md— App/Window/Context/AsyncApp usagereferences/entity.md— entity state, weak refs, update patternsreferences/event.md— events, subscriptions, observersreferences/focus-handle.md— focus handles, keyboard navigationreferences/global.md— global state and shared servicesreferences/layout-and-style.md— layout, styling, themingreferences/style-guide.md— component structure and API conventionsreferences/new-component.md— component creation checklistreferences/generate-component-story.md— story patternsreferences/generate-component-documentation.md— documentation patternsreferences/test.md— GPUI test framework overviewreferences/test-reference.md— detailed test patternsreferences/test-examples.md— testing best practices and commandsreferences/component-test-rules.md— component-specific test rulesreferences/github-pull-request-description.md— PR description format
04 同仓库更多 Skills
writing-plans
Use when you have a spec or requirements for a multi-step task, before touching code
workflow-from-chats
Extract preferences from agent chats → skills, rules, workflow docs. For learning preferences, mining feedback, personalizing workflows.
winui3-csharp-app
WinUI 3 / Windows App SDK desktop apps in C#/XAML. MVVM, bindings, navigation, Mica/Acrylic, windowing, packaging, performance.
why
Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.
what-did-i-get-done
Summarize authored commits over a user-specified time period into a concise status update.
weekly-review
Produce a short weekly synthesis of authored commits with highlights by bugfix, tech debt, and net-new work.