castella-core
БесплатноЗапускает вложенные скриптыНе проверенBuild desktop, web, or terminal UIs with Castella. Create widgets, components, layouts, manage reactive state, handle events, and use the theme system.
Об этом скилле
Castella Core UI Development
Castella is a pure Python cross-platform UI framework for desktop (GLFW/SDL2), web (PyScript/Pyodide), and terminal (prompt-toolkit) applications. Write once, run everywhere with GPU-accelerated rendering via Skia.
When to use: "create a Castella app", "build a Castella UI", "Castella component", "add a button/input/text", "use reactive state", "layout with Row/Column", "change the theme", "handle click events", "preserve scroll position", "animate a widget"
Quick Start
Create a minimal Castella app:
from castella import App, Text
from castella.frame import Frame
App(Frame("Hello", 800, 600), Text("Hello, Castella!")).run()
Install and run:
uv sync --extra glfw # Desktop with GLFW
uv run python app.py
Core Concepts
App and Frame
Frame(title, width, height)- Window/container for the UIApp(frame, widget)- Application entry point with.run()- Frame auto-selects platform: GLFW (desktop), Web, or Terminal
from castella import App
from castella.frame import Frame
frame = Frame("My App", 800, 600)
app = App(frame, my_widget)
app.run()
Widgets
Base building blocks for UI elements:
| Widget | Description | Key Methods |
|---|---|---|
Text(content) |
Display text | .font_size(n) |
Button(label) |
Clickable button | .on_click(handler) |
Input(initial) |
Single-line input | .on_change(handler) |
MultilineInput(state) |
Multi-line editor | .on_change(handler) |
CheckBox(state) |
Toggle checkbox | .on_change(handler) |
Slider(state) |
Range slider | .on_change(handler) |
Image(path) |
Local image | - |
NetImage(url) |
Remote image | - |
Markdown(content) |
Rich markdown | .on_link_click(handler) |
Layout Containers
Arrange widgets hierarchically:
from castella import Column, Row, Box
# Vertical stack
Column(
Text("Header"),
Button("Click me"),
Text("Footer"),
)
# Horizontal stack
Row(
Button("Left"),
Button("Right"),
)
# Overlapping (z-index support)
Box(
main_content,
modal_overlay.z_index(10),
)
Component Pattern
Build reactive UIs with the Component class:
from castella import Component, State, Column, Text, Button
class Counter(Component):
def __init__(self):
super().__init__()
self._count = State(0)
self._count.attach(self) # Trigger view() on change
def view(self):
return Column(
Text(f"Count: {self._count()}"),
Button("+1").on_click(lambda _: self._count.set(self._count() + 1)),
)
State Management
State[T] is an observable value that triggers UI rebuilds:
from castella import State
count = State(0) # Create with initial value
value = count() # Read current value
count.set(42) # Set new value
count += 1 # Operator support: +=, -=, *=, /=
ListState for Collections
ListState is an observable list:
from castella import ListState
items = ListState(["a", "b", "c"])
items.append("d") # Triggers rebuild
items.set(["x", "y"]) # Atomic replace (single rebuild)
Multiple States Pattern
When using multiple states, attach each to the component:
class MultiStateComponent(Component):
def __init__(self):
super().__init__()
self._tab = State("home")
self._counter = State(0)
# Attach each state
self._tab.attach(self)
self._counter.attach(self)
def view(self):
return Column(
Text(f"Tab: {self._tab()}"),
Text(f"Count: {self._counter()}"),
)
Size Policies
Control how widgets size themselves:
| Policy | Behavior |
|---|---|
SizePolicy.FIXED |
Exact size specified |
SizePolicy.EXPANDING |
Fill available space |
SizePolicy.CONTENT |
Size to fit content |
Fluent API Shortcuts
from castella import SizePolicy
# Fixed sizing
widget.fixed_width(100)
widget.fixed_height(40)
widget.fixed_size(200, 100)
# Content sizing
widget.fit_content() # Both dimensions
widget.fit_content_width() # Width only
widget.fit_content_height() # Height only
# Fill parent
widget.fit_parent()
Scrollable Auto-Downgrade
Scrollable Column/Row automatically downgrade EXPANDING children to CONTENT:
# Just works! No need to set size policies manually.
Column(Text("hello"), scrollable=True)
# Fluent API also works:
col = Column(Text("hello"))
col.scrollable() # Existing children are downgraded too
Important Constraint
A Layout with CONTENT height_policy cannot have EXPANDING height children:
# This will raise RuntimeError:
Column(
Text("Hello"), # Text defaults to EXPANDING height
).height_policy(SizePolicy.CONTENT)
# Fix by setting children to FIXED or CONTENT:
Column(
Text("Hello")
Установить castella-core в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл castella-core?
Build desktop, web, or terminal UIs with Castella. Create widgets, components, layouts, manage reactive state, handle events, and use the theme system.
Как установить скилл castella-core?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл castella-core запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic