corgi
Use this skill when working with any UI code

Установить corgi в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Corgi is a custom React-like UI framework with JSX support, server-side rendering, hydration, and a controller-based architecture for managing state and handling events.
Core Concepts
Virtual DOM and JSX
Corgi uses JSX with a custom factory function:
import * as corgi from 'external/dev_april_corgi+/js/corgi';
// JSX compiles to corgi.createVirtualElement calls
function MyComponent() {
return <div className="container">Hello World</div>;
}
Configure your tsconfig.json:
{
"compilerOptions": {
"jsx": "react",
"jsxFactory": "corgi.createVirtualElement",
"jsxFragmentFactory": "corgi.Fragment"
}
}
Component Functions
Components are functions that receive props, state, and an updateState callback:
interface State {
count: number;
}
function Counter(
props: { initialValue?: number },
state: State | undefined,
updateState: (newState: State) => void
) {
// Initialize state on first render
if (!state) {
state = { count: props.initialValue ?? 0 };
}
return (
<div>
<span>Count: {state.count}</span>
</div>
);
}
Fragments
Use <></> or corgi.Fragment to group elements without a wrapper:
function List() {
return <>
<li>Item 1</li>
<li>Item 2</li>
</>;
}
Controllers
Controllers are classes that manage component behavior, handle events, and maintain state.
They extend Controller and are attached to elements via the js prop.
Basic Controller
import { Controller, Response } from 'external/dev_april_corgi+/js/corgi/controller';
import { EmptyDeps } from 'external/dev_april_corgi+/js/corgi/deps';
interface Args {
multiplier: number;
}
interface State {
count: number;
}
class CounterController extends Controller<Args, EmptyDeps, HTMLDivElement, State> {
constructor(response: Response<CounterController>) {
super(response);
// Access args via response.args
// Access initial state via this.state
// Access root element via this.root
}
increment(): void {
this.updateState({
count: this.state.count + 1,
});
}
}
Controller Type Parameters
Controllers have four type parameters:
A- Args type: Props passed from the componentD- Deps method type: Dependencies (services and child controllers)E- Element type: The DOM element type (HTMLDivElement, HTMLInputElement, etc.)S- State type: Component state
Binding Controllers with js= Prop
Use corgi.bind() to attach a controller to an element:
function Counter(
props: {},
state: State | undefined,
updateState: (newState: State) => void
) {
if (!state) {
state = { count: 0 };
}
return (
<div
js={corgi.bind({
controller: CounterController,
args: { multiplier: 2 },
state: [state, updateState],
events: {
click: 'increment',
render: 'wakeup',
},
ref: 'counter', // Optional: for dependency injection
key: 'unique-id', // Optional: for controller reuse during patches
})}
>
Count: {state.count}
</div>
);
}
Bind Options
controller: The controller class constructorargs: Props to pass to the controller (accessible viaresponse.args)state: Tuple of [currentState, updateStateFn]events: Map of DOM events to controller method namesref: String identifier for dependency injection (seeref=section below)key: Unique key for controller instance identity during patching. When a component re-renders and patches an element with a controller, Corgi decides whether to reuse the existing controller or create a new one. If the controller type and key both match, the existing controller instance is reused and onlyupdateArgs()is called. If the key differs (or one binding has a key and the other doesn't), the old controller is disposed and a new one is created. This is useful when rendering lists where each item has the same controller type - without keys, reordering items would cause controllers to receive args for different items rather than being recreated. With unique keys (e.g., item IDs), each controller stays paired with its logical item.
Event Handling
Standard DOM Events via events=
Map DOM events to controller methods:
js={corgi.bind({
controller: MyController,
events: {
click: 'handleClick',
keydown: 'handleKeyDown',
focus: 'handleFocus',
blur: 'handleBlur',
input: 'handleInput',
change: 'handleChange',
mousedown: 'handleMouseDown',
mouseover: 'handleMouseOver',
pointerdown: 'handlePointerDown',
dragstart: 'handleDragStart',
drop: 'handleDrop',
render: 'wakeup', // Special: called when controller is instantiated
},
})}
Available events:
- Mouse:
click,mousedown,mouseup,mouseover,mouseout - Pointer:
pointerdown,pointerup,pointermove,pointerenter,pointerleave,pointerover, `pointero
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл corgi?
Use this skill when working with any UI code
Как установить скилл corgi?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл corgi запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
