ai/claude/skills/irule-datagroup/SKILL.md
Analyse an F5 iRule for opportunities to extract inline lookup patterns into BIG-IP data-groups. Uses the static extraction engine for mechanical conversions and AI reasoning for complex patterns. Type-aware: detects IP/CIDR, integer, and string data-groups. Use when extracting data-groups from iRules, optimising iRule lookup performance, converting inline iRule patterns to data-groups, or refactoring iRule switch/if chains.
npx skillsauth add bitwisecook/tcl-lsp irule-datagroupInstall 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.
Analyse an iRule for data-group extraction opportunities.
ai/prompts/irules_system.md (includes data-groups reference)uv run --no-dev python ai/claude/tcl_ai.py suggest-datagroups $FILE
This returns structured context for each candidate:
uv run --no-dev python ai/claude/tcl_ai.py extract-datagroup $FILE --line <LINE>
This produces both the rewritten iRule code and the tmsh data-group definition.class match operator (equals, contains, starts_with)class match / class lookupltm data-group internal <name> {
records {
<key> { data <value> }
}
type <string|ip|integer>
}
| Value type | Examples | class operator |
|------------|----------|----------------|
| string | "/api/v1", "example.com" | equals, starts_with, contains |
| ip | 10.0.0.0/8, 192.168.1.1, ::1 | equals (supports CIDR matching) |
| integer | 80, 443, 8080 | equals |
# Before: if/elseif chain
if { $host eq "a.com" } { pool web_pool } elseif { $host eq "b.com" } { pool web_pool }
# After: class match
if { [class match $host equals allowed_hosts] } { pool web_pool }
# Before: switch mapping
switch -exact -- $uri {
"/api" { pool api_pool }
"/web" { pool web_pool }
}
# After: class lookup
pool [class lookup $uri uri_pool_map]
# Before: nested if
if { [IP::addr [IP::client_addr] equals 10.0.0.0/8] } { ... }
# After: IP data-group (handles CIDR natively)
if { [class match [IP::client_addr] equals trusted_networks] } { ... }
$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.