.claude/skills/generate-test/SKILL.md
Generate iRule test scripts using the Event Orchestrator framework. Analyzes an iRule to extract events, commands, pools, data groups, and variables, then produces a complete test file with assertions. Auto-detects multi-TMM / CMP-sensitive patterns and adds fakeCMP distribution tests when appropriate.
npx skillsauth add bitwisecook/tcl-lsp generate-testInstall 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.
Generates a complete test script for an iRule using the Event Orchestrator
test framework (core/irule_test/tcl/orchestrator.tcl).
python3 -m ai.claude.tcl_ai generate-test <irule_file>
Extracts metadata from the iRule source:
Analyzes control flow using the compiler IR:
Generates test script with:
::orch::configure_tests with profiles, iRule source, and setup::orch::test cases targeting each branch path::orch::done for pass/fail summaryDetects multi-TMM patterns automatically:
static:: writes in hot events (not just RULE_INIT)static::table incr/table set shared-state patternsfakecmp_suggest_sources$ python3 -m ai.claude.tcl_ai generate-test samples/for_screenshots/ai-scene.irul
$ python3 -m ai.claude.tcl_ai generate-test my_irule.tcl > test_my_irule.tcl
$ tclsh test_my_irule.tcl
# In a generated or hand-written test:
set plan [::orch::fakecmp_suggest_sources -count 2]
foreach tmm_id [::orch::tmm_ids] {
set sources [dict get $plan $tmm_id]
foreach {addr port} $sources {
::orch::configure -client_addr $addr -client_port $port
::orch::run_http_request -host app.example.com
}
}
| Command | Purpose |
|---|---|
| ::orch::configure_tests -profiles ... -irule {...} | Set up test defaults |
| ::orch::test "name" "desc" -body {...} | Define a test case |
| ::orch::run_http_request -host ... -uri ... | Simulate HTTP traffic |
| ::orch::assert_pool_selected pool_name | Assert pool routing |
| ::orch::assert_equal $actual $expected | Assert equality |
| ::orch::assert {$expr} "message" | Assert condition |
| ::orch::fakecmp_suggest_sources -count N | Plan TMM distribution |
| ::orch::fakecmp_which_tmm addr port dst_addr dst_port | Query TMM for tuple |
| ::orch::done | Print summary, return exit code |
core/irule_test/tcl/orchestrator.tclcore/irule_test/tcl/example_test.tcl, example_multi_tmm_test.tcldocs/kcs/kcs-irule-test-framework.mdgenerate_irule_test, irule_cfg_paths, fakecmp_which_tmm, fakecmp_suggest_sourcespython3 -m ai.claude.tcl_ai cfg-paths <irule_file> — extract control flow paths$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.