DevHive-Cli canvas
Create, read, and manipulate shapes on the workspace canvas. Supports geometric shapes, text, notes, iframe embeds, images, and videos.
git clone https://github.com/El3tar-cmd/DevHive-Cli
T=$(mktemp -d) && git clone --depth=1 https://github.com/El3tar-cmd/DevHive-Cli "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/canvas" ~/.claude/skills/el3tar-cmd-devhive-cli-canvas && rm -rf "$T"
skills/canvas/SKILL.mdCanvas Skill
Overview
The workspace canvas is an infinite board where you can create, position, and manipulate visual elements. You have two tools:
-- Read what shapes are on the board, their positions, types, and properties.get_canvas_state
-- Create, update, delete, move, resize, reorder, align, or distribute shapes.apply_canvas_actions
Always read the board before making layout-sensitive changes.
Coordinate System
- Origin
is at the top-left of the canvas.(0, 0) - Positive
goes right, positivex
goes down.y - All positions and sizes are in canvas units.
Supported Shape Types
-- Geometric shapes (rectangles, ellipses). Props:geo
,color
,fill
.text
-- Text labels. Props:text
,text
.color
-- Sticky notes. Props:note
,text
.color
-- Embedded web content. Requiresiframe
(https only). Optional:url
,componentPath
,componentName
.componentProps
-- Embedded images. Props:image
(HTTPS image URL),src
. For local files, copy toaltText
and use.canvas/assets/
ashttps://<domain>:5904/<filename>
.src
-- Embedded videos. Props:video
(HTTPS video URL),src
. Local files work the same way as images viaaltText
..canvas/assets/
Reading the Board: get_canvas_state
get_canvas_stateReturns shapes at three detail levels:
- focusedShapes -- Full detail for shapes near the viewport or focus area. Geo/text/note shapes include color, fill, text. Iframe shapes include
,url
,componentName
. Image shapes includecomponentPath
,src
, andaltText
(local file path infilepath
, if applicable). Video shapes include.canvas/assets/
andsrc
.altText - blurryShapes -- Position and basic info for shapes farther away. Iframe shapes include only
. Image shapes includecomponentName
andsrc
. Video shapes includefilepath
.src - peripheralClusters -- Aggregated counts for distant shape groups.
- summary -- Quick text description of everything on the canvas.
Pass an optional
focus_area ({x, y, w, h}) to zoom into a specific region.
Example call with no arguments (uses current viewport):
{"focus_area": null}
Example response:
{ "focusedShapes": [ { "shapeId": "box-1", "shapeType": "geo", "x": 100, "y": 100, "w": 200, "h": 150, "color": "blue", "fill": "solid", "text": "Frontend" }, { "shapeId": "preview-1", "shapeType": "iframe", "x": 400, "y": 100, "w": 1280, "h": 720, "url": "https://<resolved-domain>.replit.dev/preview/hello-world/Card", "componentName": "Card", "componentPath": "mockup/src/components/mockups/hello-world/Card.tsx" } ], "blurryShapes": [ { "shapeId": "distant-iframe", "shapeType": "iframe", "x": 5000, "y": 100, "w": 1280, "h": 720, "componentName": "Sidebar" } ], "peripheralClusters": [], "viewport": {"x": 0, "y": 0, "w": 1920, "h": 1080}, "summary": "2 shapes on canvas.", "focusedOmittedCount": 0, "blurryOmittedCount": 0 }
Focused iframe shapes include
url, componentName, and componentPath. Blurry iframe shapes only include componentName (no URL or path). Focused image shapes include src, altText, and filepath. Focused video shapes include src and altText. Blurry image shapes include src and filepath. Blurry video shapes include src.
Modifying the Board: apply_canvas_actions
apply_canvas_actionsSend an ordered list of actions. Each action has a
type field. Results are returned per-action with generated shapeId values.
Create
Set a
shapeId so you can reference the shape later.
{ "type": "create", "shapeId": "my-box", "shape": { "type": "geo", "x": 100, "y": 100, "w": 200, "h": 150, "color": "blue", "fill": "solid", "text": "Hello" } }
Create Iframe
Embed live web content. The
url must use https://.
To get the URL for a Replit dev server, run
echo $REPLIT_DOMAINS in the shell to get the domain, then construct the full URL. For the main app on port 5000, no port suffix is needed. For other ports, append :<port>.
Always resolve the actual domain first -- do not pass literal template strings as the iframe URL.
{ "type": "create", "shapeId": "app-preview", "shape": { "type": "iframe", "x": 0, "y": 0, "w": 1280, "h": 720, "url": "https://<resolved-domain>.replit.dev", "componentName": "App Preview" } }
-- Required. Must beurl
. This is what actually loads content.https
-- File path shown in the title bar (metadata label only).componentPath
-- Display name shown in the title bar (metadata label only).componentName
-- Extra props dict merged into shape props.componentProps
To embed individual React components (not just the full app), you need a component preview server that renders each component at its own URL. Use the mockup-sandbox skill to set it up.
Create Image
Embed an image on the canvas.
From an external URL:
{ "type": "create", "shapeId": "hero-image", "shape": { "type": "image", "x": 0, "y": 0, "w": 800, "h": 600, "src": "https://example.com/hero.png", "altText": "Hero banner image" } }
From a local file (copy to
.canvas/assets/, resolve domain, use port 5904):
mkdir -p .canvas/assets cp assets/hero.png .canvas/assets/hero.png echo $REPLIT_DOMAINS # e.g. abc123.replit.dev
{ "type": "create", "shapeId": "hero-image", "shape": { "type": "image", "x": 0, "y": 0, "w": 800, "h": 600, "src": "https://<resolved-domain>:5904/hero.png", "altText": "Hero banner image" } }
Create Video
Embed a video on the canvas. Local files work the same way as images via
.canvas/assets/.
From an external URL:
{ "type": "create", "shapeId": "demo-video", "shape": { "type": "video", "x": 0, "y": 0, "w": 1280, "h": 720, "src": "https://example.com/demo.mp4", "altText": "Product demo video" } }
From a local file:
cp assets/demo.mp4 .canvas/assets/demo.mp4
{ "type": "create", "shapeId": "demo-video", "shape": { "type": "video", "x": 0, "y": 0, "w": 1280, "h": 720, "src": "https://<resolved-domain>:5904/demo.mp4", "altText": "Product demo video" } }
Update
Only include the fields you want to change. Always set
shapeType to the shape's type (from get_canvas_state).
{ "type": "update", "shapeId": "my-box", "updates": {"shapeType": "geo", "color": "red", "text": "Updated"} }
Delete
{"type": "delete", "shapeId": "my-box"}
Move
{"type": "move", "shapeId": "my-box", "x": 300, "y": 200}
Resize
{"type": "resize", "shapeId": "my-box", "w": 400, "h": 300}
Reorder (Z-index)
Direction:
"front" or "back".
{"type": "reorder", "shapeId": "my-box", "direction": "front"}
Align
Align multiple shapes. Options:
"left", "center-horizontal", "right", "top", "center-vertical", "bottom".
{ "type": "align", "shapeIds": ["box-1", "box-2", "box-3"], "alignment": "center-horizontal" }
Distribute
Evenly space shapes. Direction:
"horizontal" or "vertical".
{ "type": "distribute", "shapeIds": ["box-1", "box-2", "box-3"], "direction": "horizontal" }
Iframe Rules & Gotchas
- URL must be
--https
andhttp
are rejected.about:blank - Resolve the domain first -- run
in the shell, then build the URL from the result. Never pass a literal template string as the URL.echo $REPLIT_DOMAINS - Port rules: no port suffix = port 5000 (main app). For other servers, append
.:<port> - External sites may block embedding -- sites with
or restrictive CSP headers will show a blank iframe. Replit dev URLs work fine.X-Frame-Options: DENY - For component previews, use the mockup sandbox -- do not embed the main app's dev server URL to preview individual components. The main app URL shows the entire app with navigation, layout, and routing — not an isolated component. Use the mockup-sandbox skill to set up a preview server, then embed
URLs. This gives you isolated components that can be iterated on independently./preview/{folder}/{Component}
Placeholder Workflow
Since iframe URLs must be
https (no about:blank), to plan a layout before you have real URLs:
- Create
shapes at the desired positions with labels describing what goes there.geo - Once you have the real URLs, delete the
shapes.geo - Create
shapes at the same positions with the actual URLs.iframe
Typical Workflow
- Call
to see what's on the board.get_canvas_state - Use the
andsummary
to understand positions and IDs.focusedShapes - Call
with a batch of changes.apply_canvas_actions - Communicate and offer to show -- Tell the user what you placed and where, referencing shape names or labels so they can orient themselves. Then ask if they'd like you to focus on the new or changed shapes (e.g. "Want me to pan to the new layout?"). Don't auto-focus -- moving the viewport while the user is working is disorienting.
- Show on request -- When the user confirms, call
with the IDs of all relevant shapes. Usefocus_canvas_shapes
for a smooth transition.animate_ms: 500
Error Codes
-- Shape ID doesn't exist.SHAPE_NOT_FOUND
-- Invalid shape type.UNSUPPORTED_SHAPE_TYPE
-- Bad property values (e.g., non-https iframe URL).INVALID_PROPS
-- Shape with that ID already exists.VALIDATION_FAILED
-- Not enough shapes for align/distribute.INSUFFICIENT_SHAPES
Best Practices
- Read before writing -- Always call
before layout-sensitive changes.get_canvas_state - Set shapeId on create -- So you can reference, update, or delete the shape later.
- Offer to show your work. After creating or significantly modifying shapes, don't auto-focus the viewport -- the user may be looking at something else and sudden panning is disorienting. Instead, finish your work and ask the user if they'd like to see it (e.g. "Would you like me to focus on the new shapes?"). When the user confirms, call
on the affected shape IDs withfocus_canvas_shapes
for smooth transitions. After a batch of creates, focus on all new shape IDs together in a single call.animate_ms: 500 - Batch actions -- Group related changes in one
call.apply_canvas_actions - Use https URLs -- Iframe shapes reject http URLs.
- Label iframes -- Set
andcomponentPath
so users can identify embedded content.componentName - Use focus_area -- For large boards, pass a region to
to get detail where you need it.get_canvas_state
Viewport Presets
- Mobile: 390 x 844
- Tablet: 768 x 1024
- Desktop: 1280 x 720