# Craft garnish

> Craft garnish is an open-source agent skill for developer tools. Guides agents writing Craft CMS control panel JavaScript with the Garnish UI toolkit. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/michtio/craftcms-claude-skills/tree/main/skills/craft-garnish
- **Repository:** https://github.com/michtio/craftcms-claude-skills
- **GitHub stars:** 91
- **License:** MIT
- **Skill name:** craft-garnish
- **Collection:** https://github.com/michtio/craftcms-claude-skills
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill is a reference for Garnish, the JavaScript UI library built into Craft CMS for its control panel. It covers the class system used to define widgets, the built-in UI components such as modals, menus, selects and HUDs, drag-and-drop sorting, and the helpers for keyboard handling and focus management.

The reference is split into focused files for class inheritance and listener cleanup, UI widgets, drag interactions, utilities and integration with Craft's asset bundles and webpack externals. It points the agent to the right file for each task, such as building a custom slideout, adding ARIA attributes to a modal, or loading an element index class. It also lists common pitfalls, including memory leaks from unmanaged listeners, bundling Garnish instead of using the external, and deprecated managers.

A small bash script reads the project's Craft version so version-specific advice matches the installed release. Without that output, the skill tells the agent to check composer files before giving version-dependent guidance.

## When your agent uses it

> Garnish, Craft CMS's built-in JavaScript UI toolkit for the control panel. ALWAYS load when writing, editing, or reviewing JavaScript that runs in the Craft CP: plugin CP assets, custom field type JS, element index JS, CP webpack config, or code importing garnishjs / referencing window.Garnish. Also for CP accessibility, keyboard interactions, drag-sort, and CP JS memory issues.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Runs shell scripts](https://github.com/michtio/craftcms-claude-skills/tree/HEAD/skills/craft-garnish)
- [Asks for: Bash(sh ${CLAUDE_SKILL_DIR}/scripts/craft-version.sh)](https://github.com/michtio/craftcms-claude-skills/blob/HEAD/skills/craft-garnish/SKILL.md)
- [No network calls found in its scripts](https://github.com/michtio/craftcms-claude-skills/tree/HEAD/skills/craft-garnish)
- [License: MIT](https://github.com/michtio/craftcms-claude-skills/tree/HEAD/skills/craft-garnish)

## Features

- **Class system guidance:** Explains extending Garnish base classes, initialization, events and listener cleanup on destroy.
- **UI widget reference:** Covers modals, HUDs, disclosure menus, custom selects and other built-in controls.
- **Drag interaction patterns:** Describes drag-sort and drag-drop classes, their settings, events and insertion behavior.
- **Accessibility and focus helpers:** Documents keyboard constants, focus trapping, ARIA attributes and layer-aware shortcuts.
- **Integration with Craft:** Covers asset bundles, webpack externals, element index loading and form widgets.
- **Version-aware checks:** Reads the project's Craft version so advice matches the installed release.

## Good for

- Build a custom modal dialog for a plugin's control panel page
- Add drag-to-reorder to a custom field type
- Fix a memory leak in a slideout that is repeatedly created and destroyed
- Make a custom menu keyboard accessible with Escape handling
- Set up webpack externals so a plugin uses window.Garnish

## Install

### Claude Code

This skill ships in the `craftcms-claude-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add michtio/craftcms-claude-skills
/plugin install craftcms-claude-skills@craftcms-claude-skills
```

Or copy only this skill to `~/.claude/skills/craft-garnish`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/craft-garnish &&
cp -R "$tmp/skills/craft-garnish" ~/.claude/skills/craft-garnish &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/craft-garnish` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/craft-garnish` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/craft-garnish &&
cp -R "$tmp/skills/craft-garnish" ~/.agents/skills/craft-garnish &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/craft-garnish` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/craft-garnish` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/craft-garnish &&
cp -R "$tmp/skills/craft-garnish" ~/.cursor/skills/craft-garnish &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/craft-garnish` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/michtio/craftcms-claude-skills.git --path skills/craft-garnish
```

Or copy the folder to `~/.gemini/skills/craft-garnish` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/craft-garnish`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/craft-garnish &&
cp -R "$tmp/skills/craft-garnish" ~/.copilot/skills/craft-garnish &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/craft-garnish` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/michtio/craftcms-claude-skills.git
```

Then copy `craftcms-claude-skills/skills/craft-garnish` into your agent's skills folder as `craft-garnish`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When does Craft garnish load?

It is meant to load when writing, editing or reviewing JavaScript that runs in the Craft control panel, including plugin CP assets, custom field type JS and code that references window.Garnish. It is not intended for front-end JavaScript or Twig templates.

### Does Craft garnish need anything installed?

It uses a bash script to read the Craft version from the project. If that output is missing, it advises checking composer.lock or composer.json to establish the version.

### Is there official documentation Craft garnish relies on?

The skill states that no official external documentation exists for Garnish and that the skill itself serves as the reference, pointing to the Garnish source in the Craft CMS repository.

### How do I install Craft garnish in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/craft-garnish to use it in all your projects, or to .claude/skills/craft-garnish in one project. Or install the craftcms-claude-skills plugin, which includes it: /plugin marketplace add michtio/craftcms-claude-skills, then /plugin install craftcms-claude-skills@craftcms-claude-skills.

### Does Craft garnish run scripts?

Yes. It runs shell scripts. No network calls were found in its scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Craft garnish?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Craft garnish?

The closest alternatives to Craft garnish are Craftcms, Craft twig guidelines, Frontend UI engineering, Craft content modeling and Craft site.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Craftcms](https://ai-powered.com/skills/craftcms): Craftcms is an open-source agent skill for developer tools.
- [Craft twig guidelines](https://ai-powered.com/skills/craft-twig-guidelines): Craft twig guidelines is an open-source agent skill for developer tools.
- [Frontend UI engineering](https://ai-powered.com/skills/frontend-ui-engineering): Frontend UI engineering is an open-source agent skill for developer tools.
- [Craft content modeling](https://ai-powered.com/skills/craft-content-modeling): Craft content modeling is an open-source agent skill for developer tools.
- [Craft site](https://ai-powered.com/skills/craft-site): Craft site is an open-source agent skill for design and media.
- [Aria authoring patterns](https://ai-powered.com/skills/aria-authoring-patterns): Aria authoring patterns is an open-source agent skill for developer tools.
- [Design](https://ai-powered.com/skills/design-rshankras): Design is an open-source agent skill for design and media.
- [Component design](https://ai-powered.com/skills/component-design): Component design is an open-source agent skill for design and media.

---
Source: https://ai-powered.com/skills/craft-garnish
