.claude/skills/lsp-client/SKILL.md
Use when verifying Tcl LSP server behavior: semantic tokens, diagnostics, formatting, hover, completion, definition, references, code actions, optimizations, document symbols, diagram extraction, event/command registry lookups, or benchmarking server performance and collecting timing logs. Tests the server directly over JSON-RPC without VS Code.
npx skillsauth add bitwisecook/tcl-lsp lsp-clientInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Runs a standalone LSP client that starts the Tcl language server, exercises an LSP feature against a Tcl file, and prints human-readable results. Use this to verify server behavior after making changes.
Run from the project root (the git worktree directory):
python3 .claude/skills/lsp-client/lsp_client.py <subcommand> <args...>
The script auto-detects the tcl-lsp/ server directory. Override with
--server-dir /path/to/tcl-lsp if needed.
| Subcommand | Arguments | What it does |
|---|---|---|
| semantic-tokens | <file.tcl> | Decode and display all semantic tokens with types |
| diagnostics | <file.tcl> | Show warnings, errors, hints from the analyzer and optimizer |
| format | <file.tcl> | Show formatting edits the server would apply |
| hover | <file.tcl> <line> <col> | Show hover info at a 0-based position |
| completion | <file.tcl> <line> <col> | Show completions at a 0-based position |
| definition | <file.tcl> <line> <col> | Show go-to-definition locations |
| references | <file.tcl> <line> <col> | Show all reference locations |
| code-actions | <file.tcl> <l> <c> <el> <ec> | Show code actions in a 0-based range |
| optimize | <file.tcl> | Show optimization suggestions and rewritten source |
| symbols | <file.tcl> | Show document symbol hierarchy (procs, events, namespaces, variables) |
| diagram | <file.tcl> | Extract control flow diagram data from compiler IR |
| event-info | <EVENT_NAME> | Show iRules event registry metadata (no file needed) |
| command-info | <COMMAND_NAME> | Show iRules command registry metadata (no file needed) |
| context | <file.tcl> | Build context pack: diagnostics + symbols + event metadata |
| all | <file.tcl> | Run semantic-tokens + diagnostics + symbols + format + optimize together |
| bench | <file.tcl> [--iterations N] | Benchmark time-to-semantic-tokens with server timing breakdown |
| logs | <file.tcl> [--timing-only] | Collect and display server logs and timing information |
All line/col arguments are 0-based, matching the LSP protocol.
Each token shows line:col type "text":
0:0 keyword "set"
0:4 string "name"
1:0 keyword "puts"
1:5 variable "$name"
Token types: keyword, function, variable, string, comment, number, operator, parameter, namespace, regexp.
WARNING W100 2:4-2:18 Unbraced expr in 'if' condition
HINT W302 5:0-5:12 catch without result variable
INFO O101 3:10-3:18 Fold constant expression
Optimizer suggestions (O100, O101, O102) appear as INFO-level diagnostics with QuickFix code actions in VS Code.
=== Optimizations (2 items) ===
O101 2:10-2:18 Fold constant expression → "{3}"
O102 3:8-3:27 Fold constant expr command substitution → "3"
=== Optimized Source ===
set a 1
set b 3
...
Shows each optimization and the fully rewritten source.
=== Symbol Definitions (4 symbols) ===
Event HTTP_REQUEST (line 1)
Event HTTP_RESPONSE (line 15)
Function my_proc (a b) (line 25)
Variable result (line 26)
Hierarchical display of events, procs, namespaces, and variables.
Shows events in canonical firing order with multiplicity and priority, procedures with parameters, and the full structured JSON for diagram generation.
=== Event Info ===
Event: HTTP_REQUEST
Known: yes
Deprecated: no
Valid commands: 87
Sample commands: HTTP::host, HTTP::path, HTTP::method, ...
=== Command Info ===
Command: HTTP::uri
Summary: Returns or sets the HTTP URI
Synopsis: HTTP::uri [<uri>]
Valid in: HTTP_REQUEST, HTTP_RESPONSE, ...
Combined output for AI skill consumption:
=== Context Pack ===
Dialect: f5-irules
File: redirect.tcl
Lines: 42
=== Diagnostics (2) ===
WARNING W100 line 15: unbraced expression in expr
WARNING W304 line 22: missing -- option terminator
=== Symbol Definitions (3) ===
Event HTTP_REQUEST (line 1)
Event HTTP_RESPONSE (line 15)
Function my_proc (a b) (line 25)
=== Event Metadata (2 events, in source order) ===
HTTP_REQUEST: known=yes, deprecated=no, validCommands=87
sample: HTTP::host, HTTP::path, HTTP::method, HTTP::uri
HTTP_RESPONSE: known=yes, deprecated=no, validCommands=45
sample: HTTP::header, HTTP::status
Shows the markdown content the editor would display on hover.
Shows label, kind (Keyword, Function, Variable), and detail.
Measures wall-clock time from request to semantic token response, plus
server-side timing breakdown from [timing] log entries:
=== Benchmark ===
File: 09_long_code.tcl
Lines: 540, Size: 15208 bytes
Iterations: 3
Iteration 1:
Wall clock (request → response): 445.1ms
Tokens: 1557
Server timings:
_build_full_chunk_caches: 1ms
semantic_tokens_full: 200ms
semanticTokens/full: 200ms
workspace_state.update: 459ms
After mid-file edit:
Wall clock: 180.5ms
Server timings:
workspace_state.update: 150ms
Use --iterations N to run multiple open/close cycles for reliable medians.
The edit benchmark simulates a mid-file change to measure incremental
update performance.
Shows server stderr and window/logMessage notifications. Use --timing-only
to filter to just [timing] entries for performance analysis.
all on any example filecontext to build rich LSP context for AI skill consumptiondiagram to extract structured flow data for Mermaid generationevent-info / command-info to look up iRules registry metadatabench to measure time-to-semantic-tokenslogs --timing-only to see the server-side timing breakdownpython3 .claude/skills/lsp-client/lsp_client.py semantic-tokens tcl-lsp/samples/for_screenshots/03-completions.tcl
python3 .claude/skills/lsp-client/lsp_client.py diagnostics tcl-lsp/editors/vscode/testFixture/diagnostics.tcl
python3 .claude/skills/lsp-client/lsp_client.py hover tcl-lsp/editors/vscode/testFixture/procs.tcl 1 6
python3 .claude/skills/lsp-client/lsp_client.py optimize tcl-lsp/samples/for_screenshots/22-optimiser-before.tcl
python3 .claude/skills/lsp-client/lsp_client.py symbols tcl-lsp/samples/for_screenshots/ai-scene.irul
python3 .claude/skills/lsp-client/lsp_client.py diagram tcl-lsp/samples/for_screenshots/ai-scene.irul
python3 .claude/skills/lsp-client/lsp_client.py event-info HTTP_REQUEST
python3 .claude/skills/lsp-client/lsp_client.py command-info HTTP::uri
python3 .claude/skills/lsp-client/lsp_client.py context tcl-lsp/samples/for_screenshots/ai-scene.irul
python3 .claude/skills/lsp-client/lsp_client.py all tcl-lsp/samples/for_screenshots/03-completions.tcl
python3 .claude/skills/lsp-client/lsp_client.py bench tcl-lsp/samples/tcl/09_long_code.tcl --iterations 3
python3 .claude/skills/lsp-client/lsp_client.py logs tcl-lsp/samples/tcl/09_long_code.tcl --timing-only
$ARGUMENTS
development
Apply LSP optimiser suggestions to a Tcl file and explain why each optimisation is safe and beneficial. Covers constant folding, propagation, dead code elimination, strength reduction, and expression canonicalisation. Use when optimising Tcl code, improving .tcl file performance, refactoring Tcl scripts for efficiency, or applying language server optimisation suggestions.
development
Apply LSP optimiser suggestions to an F5 iRule and explain why each optimisation is safe and beneficial. Covers constant folding, propagation, dead code elimination, strength reduction, and expression canonicalisation. Use when optimising iRule code, improving iRule performance, applying F5 iRule optimisations, or refactoring iRules for efficiency.
development
Create Tk GUI code from a description with proper widget hierarchy. Generates the code, validates with the LSP analyser (including TK-specific checks), and iterates until clean. Use when creating Tk GUIs, generating Tcl/Tk code from descriptions, building Tk widget layouts, or scaffolding Tk applications.
development
Run full LSP validation on a Tcl file and produce a categorised report of all issues: errors, security, style, and optimiser suggestions. Use when validating Tcl code, linting .tcl files, checking Tcl script quality, or running static analysis on Tcl scripts.