agentskills.codes
VS

vscode-extension-dev

>

Install

mkdir -p .claude/skills/vscode-extension-dev && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15827" && unzip -o skill.zip -d .claude/skills/vscode-extension-dev && rm skill.zip

Installs to .claude/skills/vscode-extension-dev

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Guide for developing, building, packaging, and installing the VS Code extension for the TokenDisplay project. Use this when asked to modify the extension UI (ConfigPanel.ts), add commands, change config logic, rebuild after edits, or reinstall the .vsix into VS Code.
267 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)

About this skill

Extension Architecture

FileRole
src/extension.tsEntry point — registers commands, activates ConfigPanel
src/ConfigPanel.tsWebview panel with all tabs (Home, Device, API Keys, AI Providers, Claude.ai, Actions)
src/ConfigManager.tsRead/write config: include/config.h, server/.env, platformio.ini
src/RelayManager.tsSpawns/stops server/relay.py as a child process
src/PortDetector.tsDetects serial ports via PlatformIO → pyserial → PowerShell fallback
package.jsonManifest: commands, views, activity bar, contributes
out/extension.jsCompiled bundle (generated — never edit directly)

Recent behavior to preserve:

  • Board env list is read dynamically from platformio.ini sections ([env:...]).
  • Selected board env is persisted in .vscode/esp32-display.json.
  • Build/flash command includes the selected env (pio run -e <env>).
  • Saving config patches only the selected env section in platformio.ini (upload_port, monitor_port, upload_speed).

Where Config Is Stored

ConfigManager.save() writes to three files:

FileFields written
include/config.hWiFi, API keys, Anthropic/OpenRouter URLs, relay host/port, update interval
server/.envCLAUDEAI_SESSION, LASTACTIVE_ORG, RELAY_PORT
platformio.iniselected env section: upload_port, monitor_port, upload_speed

Also written by extension:

FilePurpose
.vscode/esp32-display.jsonPersist last selected boardEnv

ConfigManager.load() reads all three and merges them.


Tab ↔ Pane Map

Tab button labeldata-tabid="tab-*" pane
🏠 Homehometab-home
📡 Devicedevicetab-device
🔑 API Keysapikeystab-apikeys
🤖 AI Providersanthropictab-anthropic
☁️ Claude.aiclaudeaitab-claudeai
⚡ Actionsactionstab-actions

Board-aware flow

  1. Device tab board selector (#board-env) is populated from getAvailableEnvs().
  2. UI sends boardEnv in build/buildAndFlash messages.
  3. Panel backend spawns PlatformIO with -e boardEnv.
  4. Config save patches only that env in platformio.ini.

If adding a new board env to platformio.ini, no extra extension code should be required for the selector to show it.


Build Commands

All commands run inside vscode-extension/:

cd vscode-extension

# Compile TypeScript (type-check only — does NOT produce out/)
npm run compile

# Fast dev build (produces out/extension.js with source map)
npm run build

# Watch mode (rebuilds on every file save)
npm run watch

# Package into .vsix (runs vscode:prepublish → minified build first)
npm run package

# Build + package + install in one go
npm run package ; code --install-extension esp32-token-display-1.0.0.vsix --force

Edit → Rebuild → Reinstall Workflow

cd e:\Gap_code\TokenDisply\vscode-extension

# 1. Edit source files (ConfigPanel.ts, ConfigManager.ts, etc.)

# 2. Package (compiles + bundles + creates .vsix)
npm run package

# 3. Install
code --install-extension esp32-token-display-1.0.0.vsix --force

# 4. In VS Code: Ctrl+Shift+P → "Developer: Reload Window"

Tip: After reload, the Config Panel reopens automatically because activate() calls ConfigPanel.createOrShow().

Tip: When testing board-specific flows, verify both the board selector value and the generated PlatformIO command line in the Actions output.


Adding a New Tab

  1. Add a tab button in _html() (around line 257–262):
    <button class="tab-btn" data-tab="mytab">🆕 My Tab</button>
    
  2. Add the matching pane with id="tab-mytab":
    <div class="tab-pane" id="tab-mytab">
      ...content...
    </div>
    
  3. If new fields need saving, add them to ESP32Config interface in ConfigManager.ts, update DEFAULTS, buildConfigH() / buildEnv(), and load().

Adding a New VS Code Command

  1. Register in package.jsoncontributes.commands:
    { "command": "esp32td.myCommand", "title": "My Command", "category": "ESP32 Token Display" }
    
  2. Wire up in extension.ts:
    vscode.commands.registerCommand('esp32td.myCommand', () => { /* … */ })
    

Common Issues

Build/flash runs against wrong board env

  • Check Device tab board selection.
  • Confirm Actions output starts with pio ... run -e <expected-env>.
  • If selection resets after reload, check .vscode/esp32-display.json write permissions.

Port/speed changed in wrong env section

Confirm that save logic is patching only the selected env section in platformio.ini. If keys are missing in that section, add them manually once (upload_port, monitor_port, upload_speed) so future patches can replace values safely.

out/extension.js is stale after editing

Run npm run build (or npm run package to also get a fresh .vsix).

Extension does not activate

  • Check the Output panel → ESP32 Token Display channel.
  • Make sure "activationEvents": ["onStartupFinished"] is in package.json.
  • Verify the installed version with: code --list-extensions --show-versions | Select-String esp32.

Webview shows blank / old content

The webview HTML is inlined as a template string in ConfigPanel._html(). After rebuilding the extension JS, reload VS Code (Developer: Reload Window).

vsce not found

npm install --save-dev @vscode/vsce

TypeScript errors

npm run compile   # shows all tsc errors without bundling

Search skills

Search the agent skills registry