cocosketch

cocosketch is a skill for Claude Code from Snowflake-Labs/cocoplus. It costs 20 tokens per session (2,105 once invoked), scanned A, original, MIT.

A pipeline for turning CocoPlus project artifacts into draw.io diagrams, which are editable diagrams made from structured XML data.

In plain words
What is it for?
Use it to create diagrams, preview them as PNG images, check overlaps and clipped labels, and export a repaired final image.
Why use it?
It validates and repairs generated diagrams so layout problems and invalid diagram files are caught before delivery.

Skill for Claude Code

Written for Claude Code: user-invocable in frontmatter.

Good fit Use it to create diagrams, preview them as PNG images, check overlaps and clipped labels, and export a repaired final image.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/snowflake-labs/cocoplus/cocosketch
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Snowflake-Labs/cocoplus --skill cocosketch
Clone the repo
git clone --depth 1 https://github.com/Snowflake-Labs/cocoplus

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cocosketch

README.md
[![agentmods](https://agentmods.dev/badge/skills/snowflake-labs/cocoplus/cocosketch/github.svg)](https://agentmods.dev/skills/snowflake-labs/cocoplus/cocosketch)
Your own site
<a href="https://agentmods.dev/skills/snowflake-labs/cocoplus/cocosketch"><img src="https://agentmods.dev/badge/skills/snowflake-labs/cocoplus/cocosketch/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cocosketch

Your own site · 80×15
<a href="https://agentmods.dev/skills/snowflake-labs/cocoplus/cocosketch"><img src="https://agentmods.dev/badge/skills/snowflake-labs/cocoplus/cocosketch.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 20 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,105 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00020 $0.02105
Opus 5 $0.00010 $0.01052
Sonnet 5 $0.00004 $0.00421
Haiku 4.5 $0.00002 $0.00211

Measured 5d ago against content hash 88ecd7baab52, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

cocosketch scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cortex/skills/cocosketch/cocosketch.skill.md · 173 lines

How it starts

The opening of the file, as written. The whole thing — 173 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CocoSketch — Visual Artifact Generation Pipeline

Core Principle

Diagram quality requires a pipeline, not a single prompt. The AI generates XML; deterministic scripts validate and repair. Never skip validation or repair steps.

Seven-Step Pipeline (ALL modes)

Step 1: Resolve style preset
Step 2: Check draw.io CLI availability (resolve binary once, use verbatim)
Step 3: Plan layout — shapes, relationships, groups; run cocosketch/sketch-autolayout for >15 nodes
Step 4: Generate draw.io XML → run cocosketch/sketch-validate → STOP pipeline if FAIL
Step 5: Export PREVIEW PNG (NO -e flag) capped at 2000px
Step 6: Self-check preview via vision — auto-fix overlaps/clipped labels (max 2 rounds)
Step 7: Export FINAL PNG (WITH -e flag) → run cocosketch/sketch-repair → deliver to developer

NEVER skip Steps 4 or 7. NEVER add -e to Step 5. NEVER omit -e from Step 7.

Step 1 — Resolve Style Preset

Check ~/.cocoplus/sketch-styles/ first, then .cortex/sketch/styles/built-in/. Available built-in styles: default, corporate, handdrawn. Default: default.json. Load and apply to all generated cells.

Step 2 — Check draw.io CLI

Try in order: drawio --version, draw.io --version, OS-specific paths. Resolve binary name ONCE. Store as DRAWIO_BIN. Use DRAWIO_BIN verbatim in Steps 5 and 7.

Fallback chain (if draw.io unavailable):

  1. Generate Mermaid markup → write <name>.mmd, inform developer
  2. If Mermaid not applicable: deliver raw .drawio XML with open-in-browser instructions

Step 3 — Plan Layout

  • Direction: LR for sequences/pipelines, TB for hierarchies/schemas
  • For >15 nodes: run invoke cocosketch/sketch-autolayout <input.json> <layout.json>
  • For ≤15 nodes: hand-place coordinates with reasonable spacing (120px wide × 60px tall, 50px H-gap, 40px V-gap)
  • Groups: use swimlane cells to visually cluster related nodes

Step 4 — Generate XML + Validate

Required XML structure:

<mxGraphModel>
  <root>
    <mxCell id="0" />
    <mxCell id="1" parent="0" />
    <!-- shape cells: parent="1", unique id each -->
  </root>
</mxGraphModel>

Run: invoke cocosketch/sketch-validate <file.drawio> If FAIL: stop immediately. Report structural errors. Do not proceed to Step 5.

Read the full file on GitHub · 173 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 173 lines · 20 tokens per session scan A 88ecd7baab52

Subscribe to this mod's changes

cocosketch is a skill published in the GitHub repository Snowflake-Labs/cocoplus (720 stars, last pushed 6d ago), licensed MIT. It adds 20 tokens to every session and 2,105 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

cad-skill

Generate interior design planning artifacts, 2D SVG floorplans, BOM outputs, analysis boards, and renovation image sets from structured requirements. Use for staged interior-design work that moves through plan, 2D drafting, BOM, and image outputs.

CodingFeng101/CanvasAnvil · 53 tokens

flow-skill

Generate, edit, validate, and bundle draw.io or diagrams.net diagrams in XML form. Use for new diagrams, local XML edits, shape-library diagrams, truncated XML continuation, and local image export.

CodingFeng101/CanvasAnvil · 44 tokens

drawio-skill

Create, edit, synchronize, inspect, test, and publish editable draw.io diagrams. Use when the user explicitly requests draw.io/diagrams.net, needs a polished architecture, ERD, UML, sequence, C4, SysML, BPMN, network, swimlane, ML, or infrastructure diagram, wants code/IaC/SQL/OpenAPI converted into a diagram, or…

Agents365-ai/drawio-skill · 127 tokens

decocms-ui

Build or style React UI with the decocms product design system (@decocms/ui). Use when creating interfaces, pages, or components in a project that should look like decocms products, when the user mentions "design system", "@decocms/ui", "decocms style", or asks to make UI consistent with Studio. Covers installation…

decocms/studio · 91 tokens

bare-eval

Run isolated eval and grading calls using CC 2.1.81 --bare mode. Constructs claude -p --bare invocations for skill evaluation, trigger testing, and LLM grading without plugin/hook interference. Use when running eval pipelines, grading skill outputs, benchmarking prompt quality, or testing trigger accuracy in isolation.

yonatangross/orchestkit · 69 tokens

apply-mantel-styles

Provides guidelines for applying Mantel's brand styles to diagrams and frontend components. Use when asked to create visuals that need to align with Mantel's branding.

sammcj/agentic-coding · 37 tokens