Irule optimise

From bitwisecook/tcl-lsp · View interactive version

Irule optimise is an AI agent skill from the GitHub repository bitwisecook/tcl-lsp. 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 op

How to use this skill

Skill file

iRule Optimise

Apply the optimiser's rewrites to an iRule and explain each one.

Steps

  1. Read ../_prompts/irules_system.md, then the iRule.
  2. Call mcp__tcl-lsp__optimize with the contents as source (profile

defaults to the user's config.ini [optimiser] profile, else full; a

named one wins; aggressive iterates to a fixpoint). On a tool error

(e.g. a parse failure) report it and suggest fixes; on no findings report

the code is already well-optimised.

  1. Apply the returned optimised source with Edit.
  2. For each optimisation, one or two sentences: why it preserves behaviour,

and what it gains on the hot path. A grouped item (constant propagation

O100–O105 whose dead store O109 was then eliminated) is one

transformation — explain it as one.

  1. Re-validate with mcp__tcl-lsp__analyze on the rewritten source; revert

any optimisation that introduced an issue and say why.

  1. Summarise what was applied.

Optimisation codes

Full table: docs/generated/optimisation_codes.md. Categories:

Profiles: off; readability (editor default: O111, O114, O115, O117, O120, O128); standard

(readability + constant folding + pattern recognition); full (every pass,

single pass; CLI/AI default); aggressive (every pass, to a fixpoint).

$ARGUMENTS

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.