Skip to content
Back to skills

Debug Connection

ASecurity

Debug WebSocket connection issues between CLI and FigJam plugin. Use when diagrams aren't syncing, connection fails, plugin shows "Connecting..." indefinitely, or patches aren't being applied to canvas.

  • 6 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 8, 2026
ai-agentsbashnodedebuggingapi

Works with

  • terminal
  • cli
  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add bg-szy/TOP-SKILLS --skill debug-connection --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Debug Connection?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Debug Connection
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/bg-szy-debug-connection/badge)](https://www.skillsdirectory.com/skills/bg-szy-debug-connection)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: debug-connection
description: Debug WebSocket connection issues between CLI and FigJam plugin. Use when diagrams aren't syncing, connection fails, plugin shows "Connecting..." indefinitely, or patches aren't being applied to canvas.
---

# WebSocket Connection Debugging

## Architecture

```
CLI serve (Bun) ←── WebSocket ──→ Plugin UI (ui.ts) ←── postMessage ──→ Plugin Main (code.ts)
     │                                  │                                    │
  File watcher                    Browser APIs                          Figma API
  YAML parsing                    WebSocket client                      Canvas rendering
```

## Common Issues

| Issue | Symptom | Solution |
|-------|---------|----------|
| CLI not running | "Connecting..." indefinitely | Start `bun run packages/cli/src/index.ts serve diagram.yaml` |
| Port in use | Connection refused | Check `lsof -i :3456`, use different port |
| Secret mismatch | Connects then immediately closes | Match `--secret` value in CLI and plugin |
| YAML errors | Connected but no updates | Fix validation errors in CLI output |
| docId mismatch | No response after hello | Ensure plugin docId matches YAML `docId` |
| Patches not applied | Connected, canvas unchanged | Check Plugin Main console for render errors |

## Debugging Steps

1. **CLI side**: Check terminal for errors, verify YAML with `bun run packages/cli/src/index.ts build diagram.yaml`
2. **Plugin UI**: Right-click plugin → Inspect → Console for WebSocket events
3. **Plugin Main**: Figma Desktop → Plugins → Development → Open console

## Message Flow

```
Plugin                          CLI
  │                              │
  │──── hello ─────────────────►│  {type:"hello", docId, secret?}
  │◄──── full ─────────────────│  {type:"full", rev, ir}
  │                              │
  │      [YAML changes]          │
  │◄──── patch ────────────────│  {type:"patch", baseRev, nextRev, ops}
  │                              │
  │      [Reconnect]             │
  │──── requestFull ───────────►│  {type:"requestFull", docId}
  │◄──── full ─────────────────│
```

## JSON Import Errors

- JSON must be an object with `version`, `docId`, `nodes`
- DSL format: `nodes` as array
- IR format: `nodes` as object (Record)
- Validation errors shown in alert with path + message

## Quick Test

```bash
# Start server
bun run packages/cli/src/index.ts serve examples/diagram.yaml

# Test with wscat
wscat -c ws://localhost:3456
> {"type":"hello","docId":"test"}
```

Files in this skill

  • SKILL.md2.7 KB
  • skill-report.json18.2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.