Command Palette

Search for a command to run...

Назад к скиллам
скилл № 34301

corgi

Use this skill when working with any UI code

БесплатноБез исполняемых скриптов
escalante-bioот escalante-bio★ 16 звёзд на GitHub8 установок в других каталогах

Установить 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:

  1. A - Args type: Props passed from the component
  2. D - Deps method type: Dependencies (services and child controllers)
  3. E - Element type: The DOM element type (HTMLDivElement, HTMLInputElement, etc.)
  4. 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 constructor
  • args: Props to pass to the controller (accessible via response.args)
  • state: Tuple of [currentState, updateStateFn]
  • events: Map of DOM events to controller method names
  • ref: String identifier for dependency injection (see ref= 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 only updateArgs() 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
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл corgi?

Use this skill when working with any UI code

Как установить скилл corgi?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл corgi запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить corgi с