# Cowart Image Gen

Generate and place a final AI bitmap on the Cowart canvas, replacing a selected AI 图片...

- Repository: https://github.com/zhongerxin/Cowart (6049 stars)
- Category: Media
- License: MIT
- Last updated: 2026-10-08
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add zhongerxin/Cowart --skill cowart-image-gen -g -a claude-code -y`
Codex: `npx skills add zhongerxin/Cowart --skill cowart-image-gen -g -a codex -y`
Cursor: `npx skills add zhongerxin/Cowart --skill cowart-image-gen -g -a cursor -y`
Gemini CLI: `npx skills add zhongerxin/Cowart --skill cowart-image-gen -g -a gemini-cli -y`

## Description

Generate and place a final AI bitmap on the Cowart canvas, replacing a selected AI 图片 holder or inserting the image into the current page.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# Cowart Image Gen

Use this skill when the user wants an AI-generated image placed onto the Cowart canvas. A selected `AI 图片` holder gives a precise size and placement target, but it is not required. By default, a selected holder is a temporary target and should be replaced by the generated image.

## Preconditions

Ensure the `cowart_mcp` tools required by this workflow are available. Do not call `render_cowart_canvas_widget` as a routine prerequisite: requests sent from the Cowart widget already have an open canvas, and the existing widget synchronizes inserted images from MCP-backed storage. If the user separately asks to open, reopen, or explicitly refresh the canvas, handle that request once with the canvas-opening workflow.

Cowart state is read and written through Cowart MCP tools, not through a localhost browser service.

New holders are tldraw `frame` shapes with:

```json
{
  "type": "frame",
  "meta": {
    "cowartAiImageHolder": true
  }
}
```

Older canvases may still contain legacy `geo` rectangle holders with the same
meta flag. Support both shapes.

## Workflow

For a follow-up from Cowart's sidebar canvas, use the exact `projectDir` and `canvasDir` in the Cowart context/message for all Cowart tools. These paths can differ from the conversation working directory. In ordinary project conversations, keep using the active user project as before.

1. Read the selected shape from Cowart with the MCP `get_cowart_selection` tool. Pass the active user project directory as `projectDir`.

2. Check whether exactly one selected shape is an AI image holder. A holder is any selected shape with either:

   ```text
   isAiImageHolder: true
   ```

   or:

   ```text
   meta.cowartAiImageHolder: true
   ```

   If yes, use the holder replacement workflow below. If not, do not ask the user to select a holder; use the standalone workflow below and insert the generated image into the current Cowart page.

3. Choose the placement workflow.

The rest: https://github.com/zhongerxin/Cowart/blob/HEAD/skills/cowart-image-gen/SKILL.md
