| name | irule-create |
| description | Create a new F5 iRule from a natural-language description. Generates the code following security best practices, validates with the LSP analyser, and iterates until clean. Use when creating new iRules, generating F5 iRule code from descriptions, writing iRule event handlers, or scaffolding iRule logic. |
| allowed-tools | Bash, Read, Write |
iRule Create
Generate a new iRule from a user description, validate with LSP, and iterate until clean.
Steps
- Read the domain knowledge from
ai/prompts/irules_system.md
- Generate an iRule based on the user's description. Requirements:
- Use appropriate event handlers (
when blocks)
- Follow security best practices (braced expressions, option terminators, no eval with user data)
- Include comments explaining the logic
- Use K&R brace style, 4-space indentation
- Write the generated code to a
.tcl file (ask the user for the filename, or use a sensible default)
- Validate the generated code:
uv run --no-dev python ai/claude/tcl_ai.py diagnostics $FILE
- If the tool fails (e.g. parse error), report the error and adjust the generated code
- If there are errors or warnings, fix them and re-validate (up to 5 iterations)
- If validation still fails after 5 iterations, report remaining issues and explain what could not be resolved
- Report the final status: clean or remaining issues
Output format
Show the final iRule in a ```tcl code fence. Report the validation result
(clean / N issues remaining) and iteration count.
$ARGUMENTS