debug-connection
Debug WebSocket connection issues between CLI and FigJam plugin. Use when diagrams aren't syncing or connection fails.
Best use case
debug-connection is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Debug WebSocket connection issues between CLI and FigJam plugin. Use when diagrams aren't syncing or connection fails.
Teams using debug-connection should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/debug-connection/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How debug-connection Compares
| Feature / Agent | debug-connection | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Debug WebSocket connection issues between CLI and FigJam plugin. Use when diagrams aren't syncing or connection fails.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# WebSocket Connection Debugging
## Architecture
```
┌─────────────┐ WebSocket ┌─────────────────┐ postMessage ┌─────────────────┐
│ CLI serve │ ◄───────────────► │ Plugin UI │ ◄───────────────► │ Plugin Main │
│ (Bun) │ ws://...:3456 │ (ui.ts) │ │ (code.ts) │
└─────────────┘ └─────────────────┘ └─────────────────┘
│ │ │
│ File watcher │ Browser APIs │ Figma API
│ YAML parsing │ WebSocket client │ Canvas rendering
└───────────────────────────────────┴─────────────────────────────────────┘
```
## Common Issues & Solutions
### 1. Connection Refused
**Symptoms**: Plugin shows "Connecting..." indefinitely
**Check**:
```bash
# Is CLI serve running?
ps aux | grep "figram serve"
# Check port availability (default: 3456)
lsof -i :3456
```
**Solution**: Start CLI with `bun run packages/cli/src/index.ts serve diagram.yaml`
### 2. Connection Drops
**Symptoms**: Works initially, then stops syncing
**Check**:
- Plugin UI console for WebSocket close events
- CLI terminal for error messages
**Solution**: Check for YAML parse errors blocking updates
### 3. Patches Not Applied
**Symptoms**: Connected but canvas doesn't update
**Debug steps**:
1. Check CLI output for patch generation
2. Check Plugin UI console for received messages
3. Check Plugin Main console for rendering errors
### 4. YAML Parse Errors
**Symptoms**: CLI shows validation errors
**Solution**: Validate YAML syntax and schema compliance
### 5. Secret Mismatch
**Symptoms**: Connection established but immediately closed
**Check**: Ensure `--secret` flag value matches between CLI and plugin
### 6. JSON Import Errors
**Symptoms**: Import dialog shows an error alert
**Check**:
- JSON must be an object
- DSL JSON requires `version`, `docId`, and `nodes` array
- IR JSON requires `version`, `docId`, and `nodes` object
**Solution**: Fix validation errors shown in the alert (path + message)
## Debugging Tools
### CLI Side
```bash
# Run with verbose output
DEBUG=* bun run packages/cli/src/index.ts serve diagram.yaml
# Specify custom port
bun run packages/cli/src/index.ts serve diagram.yaml --port 8080
# With authentication
bun run packages/cli/src/index.ts serve diagram.yaml --secret mysecret
```
### Plugin UI Side
1. Right-click plugin UI → Inspect
2. Check Console for WebSocket events
3. Check Network tab for WS frames
### Plugin Main Side
1. Figma Desktop → Plugins → Development → Open console
2. Check for rendering errors
## WebSocket Protocol
### Plugin → CLI Messages
```typescript
// Connection initiation
interface HelloMessage {
type: "hello";
docId: string;
secret?: string; // If server requires authentication
}
// Request full sync (e.g., after reconnection)
interface RequestFullMessage {
type: "requestFull";
docId: string;
}
```
### CLI → Plugin Messages
```typescript
// Full document sync
interface FullMessage {
type: "full";
rev: number; // Current revision number
ir: IRDocument; // Complete normalized document
}
// Incremental update
interface PatchMessage {
type: "patch";
baseRev: number; // Expected current revision
nextRev: number; // New revision after applying
ops: PatchOp[]; // Operations to apply
}
// Error notification
interface ErrorMessage {
type: "error";
message: string;
}
```
### Patch Operations
```typescript
type PatchOp =
| { op: "upsertNode"; node: IRNode }
| { op: "removeNode"; id: string }
| { op: "upsertEdge"; edge: IREdge }
| { op: "removeEdge"; id: string };
```
## Quick Diagnostic
```bash
# 1. Start CLI serve (default port: 3456)
bun run packages/cli/src/index.ts serve examples/diagram.yaml
# 2. Test WebSocket with wscat (if installed)
wscat -c ws://localhost:3456
# 3. Send hello message
{"type":"hello","docId":"test"}
# 4. Check YAML is valid
bun run packages/cli/src/index.ts build examples/diagram.yaml
```
## Message Flow
```
Plugin CLI
│ │
│──── HelloMessage ───────────►│ (docId, secret?)
│ │
│◄──── FullMessage ───────────│ (rev, ir)
│ │
│ [YAML file changes] │
│ │
│◄──── PatchMessage ──────────│ (baseRev, nextRev, ops)
│ │
│ [Plugin reconnects] │
│ │
│──── RequestFullMessage ─────►│ (docId)
│ │
│◄──── FullMessage ───────────│ (rev, ir)
│ │
```Related Skills
optimizing-database-connection-pooling
Process use when you need to work with connection management. This skill provides connection pooling and management with comprehensive guidance and automation. Trigger with phrases like "manage connections", "configure pooling", or "optimize connection usage".
exa-debug-bundle
Collect Exa debug evidence for support tickets and troubleshooting. Use when encountering persistent issues, preparing support tickets, or collecting diagnostic information for Exa problems. Trigger with phrases like "exa debug", "exa support bundle", "collect exa logs", "exa diagnostic".
evernote-debug-bundle
Debug Evernote API issues with diagnostic tools and techniques. Use when troubleshooting API calls, inspecting requests/responses, or diagnosing integration problems. Trigger with phrases like "debug evernote", "evernote diagnostic", "troubleshoot evernote", "evernote logs", "inspect evernote".
documenso-debug-bundle
Comprehensive debugging toolkit for Documenso integrations. Use when troubleshooting complex issues, gathering diagnostic information, or creating support tickets for Documenso problems. Trigger with phrases like "debug documenso", "documenso diagnostics", "troubleshoot documenso", "documenso support ticket".
deepgram-debug-bundle
Collect Deepgram debug evidence for support and troubleshooting. Use when preparing support tickets, investigating issues, or collecting diagnostic information for Deepgram problems. Trigger: "deepgram debug", "deepgram support ticket", "collect deepgram logs", "deepgram diagnostic", "deepgram debug bundle".
databricks-debug-bundle
Collect Databricks debug evidence for support tickets and troubleshooting. Use when encountering persistent issues, preparing support tickets, or collecting diagnostic information for Databricks problems. Trigger with phrases like "databricks debug", "databricks support bundle", "collect databricks logs", "databricks diagnostic".
customerio-debug-bundle
Collect Customer.io debug evidence for support tickets. Use when creating support requests, investigating delivery failures, or documenting integration issues. Trigger: "customer.io debug", "customer.io support ticket", "collect customer.io logs", "customer.io diagnostics".
cursor-debug-bundle
Debug AI suggestion quality, context issues, and code generation problems in Cursor. Triggers on "debug cursor ai", "cursor suggestions wrong", "bad cursor completion", "cursor ai debug", "cursor hallucination".
coreweave-debug-bundle
Collect CoreWeave cluster diagnostics for support tickets. Use when preparing a support case, collecting GPU node status, or documenting pod failures. Trigger with phrases like "coreweave debug", "coreweave support", "coreweave diagnostics", "collect coreweave logs".
connection-pooling-config
Connection Pooling Config - Auto-activating skill for API Integration. Triggers on: connection pooling config, connection pooling config Part of the API Integration skill category.
connection-pool-analyzer
Connection Pool Analyzer - Auto-activating skill for Performance Testing. Triggers on: connection pool analyzer, connection pool analyzer Part of the Performance Testing skill category.
coderabbit-debug-bundle
Collect CodeRabbit debug evidence for support tickets and troubleshooting. Use when encountering persistent issues, preparing support tickets, or collecting diagnostic information for CodeRabbit problems. Trigger with phrases like "coderabbit debug", "coderabbit support bundle", "coderabbit diagnostic", "coderabbit not working evidence".